Compare commits
9 Commits
d523589423
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c4327b2d2 | |||
| 6bfb387008 | |||
| 36399b4d02 | |||
| fcf522c608 | |||
| 246d7aa18d | |||
| a5d3a387ca | |||
| a65387e536 | |||
| fe9c8803e1 | |||
| 45ad9f05ae |
@@ -5,4 +5,5 @@ vault_password_file = ~/.ansible/vault_pass.txt
|
||||
private_key_file=~/.ssh/ansible
|
||||
fact_caching = jsonfile
|
||||
fact_caching_connection = facts/
|
||||
host_key_checking = False
|
||||
host_key_checking = False
|
||||
roles_path:~/dev/ansible/roles/
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
- collections:
|
||||
|
||||
- community.general.proxmox
|
||||
collections:
|
||||
# Install a collection from Ansible Galaxy.
|
||||
- name: community.general
|
||||
source: https://galaxy.ansible.com
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
vm_memory: "2048"
|
||||
vm_cores: "2"
|
||||
resize_root_disk_size: "+20G"
|
||||
resize_root_disk_size: "15G"
|
||||
@@ -1,7 +1,7 @@
|
||||
[vms]
|
||||
semaphore vm_ip_address="ip=10.11.12.250/24,gw=10.11.12.254"
|
||||
fersenweg-shop vm_ip_address="ip=10.11.12.248/24,gw=10.11.12.254" resize_root_disk_size="30G"
|
||||
|
||||
## defaults:
|
||||
#vm_memory="2048"
|
||||
#vm_cores="2"
|
||||
#resize_root_disk_size="+20G"
|
||||
#resize_root_disk_size="20G"
|
||||
|
||||
30
main.yml
30
main.yml
@@ -1,9 +1,30 @@
|
||||
---
|
||||
### Setup needs to be done if task is run from ansible-semaphore docker container
|
||||
# FIXME NOT WORKING ON Semaphore in docker yet
|
||||
# - name: Install required Pip modules
|
||||
# hosts: localhost
|
||||
# tasks:
|
||||
# - name: Install python-setup tools
|
||||
# remote_user: semaphore
|
||||
# package:
|
||||
# name:
|
||||
# - python3-setuptools
|
||||
# state: latest
|
||||
|
||||
# - name: Install proxmoxer and requests modules
|
||||
# remote_user: semaphore
|
||||
# pip:
|
||||
# name:
|
||||
# - proxmoxer
|
||||
# - requests
|
||||
# state: present
|
||||
|
||||
- name: Create VM from template, update the ip and hardware, resize the disk,
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
vars_files:
|
||||
- vars/proxmox.yml
|
||||
- defaults/vm_sizing.yml
|
||||
|
||||
tasks:
|
||||
- name: Create VM from template
|
||||
@@ -20,6 +41,12 @@
|
||||
register: vm_created
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Wait 10s for VM to be fully deployed
|
||||
ansible.builtin.wait_for:
|
||||
timeout: 10
|
||||
delegate_to: localhost
|
||||
when: vm_created.changed
|
||||
|
||||
- name: Update VM configuration
|
||||
community.general.proxmox_kvm:
|
||||
api_host: "{{ pve_host }}"
|
||||
@@ -60,6 +87,7 @@
|
||||
ansible.builtin.wait_for:
|
||||
timeout: 180
|
||||
delegate_to: localhost
|
||||
when: vm_created.changed
|
||||
|
||||
- name: Extract VM IP with regex
|
||||
set_fact:
|
||||
@@ -86,4 +114,4 @@
|
||||
enabled: true
|
||||
when: ansible_virtualization_type == 'kvm'
|
||||
delegate_to: "{{ vm_ip }}"
|
||||
become: true
|
||||
become: true
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
64663830333734373030373566623961376465386165626232656232393238646663343564303335
|
||||
6235373166393464343831623735393834366130343836380a623463346161623430666235363630
|
||||
33373866306231653035346265666566373034326230663236396432343234343066363566623634
|
||||
3034383036343030370a643539633563353433356565356237323962626238386163626437353831
|
||||
30613130353766653961313337383739616364653234666631626565353730663832616531656565
|
||||
35316134613564343734353337363936633062656131633032353439643230633635316463316233
|
||||
30336438663432376237363864356266653266626431613862656665373636343465353165626365
|
||||
38326465306561313435343632393333653434346634396363636162353965643938383636643766
|
||||
36653561316463636131353135323931383461623932353865333431623731663663303736343632
|
||||
62386365393432623965373638396331343132313163333838336264353431313661653432353162
|
||||
626231633462656339396238663634626337
|
||||
31663663396665623963336664663531356538343866383537343032396633633634353133323039
|
||||
6363643061353636656234326664313039326534366532310a663262313836626534393037336165
|
||||
61313833343865353063343734343637333066643331323833343231356466663334646231373234
|
||||
3231313266373861620a663238343366396162356562356430653862636333653638393434326233
|
||||
39653231316332356332343364353633663965666466393231623466373430633836636635623636
|
||||
37373539303864323363636364366166376364616537626434373266663433373136346331616261
|
||||
65633132323736613934333033613862616533613433373430613334326236643062653330636135
|
||||
64343437336362616264316239386537663235363962333431343864373032363633386535613130
|
||||
34353931356564343535353531303632306330336563333239323233656335333531656661663864
|
||||
64643732376532363265376662326433336364616261656162623464383231353765626666623661
|
||||
323133346237306461373135613564323465
|
||||
|
||||
Reference in New Issue
Block a user