-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathawx-proxmox-set-ipconfig0.yml
39 lines (34 loc) · 1.32 KB
/
awx-proxmox-set-ipconfig0.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
- name: "Proxmox: set ipconfig0"
connection: local
hosts: all
gather_facts: False
vars:
collected_proxmox_vms: {}
tasks:
- name: Include Proxmox common discovery
include_tasks: "ansible-tasks/collect-proxmox-vms.yml"
- name: "Update VM settings (ipconfig0, ssh key)"
community.general.proxmox_kvm:
node: "{{ proxmox_env_info.node }}"
api_user: "{{ proxmox_env_info.api_user }}"
api_token_id: "{{ proxmox_env_info.api_token_id }}"
api_token_secret: "{{ proxmox_env_info.api_token_secret }}"
api_host: "{{ proxmox_env_info.api_host }}"
name: "{{ vm_config['name'] }}"
sshkeys: "{{ vm_config['ssh_key'] }}"
ipconfig:
#ipconfig0: "ip={{ item.ip }},gw={{ item.ip.split('.')[:3] | join('.') }}.{{ item.gw if item.gw is defined else gw_last_quad }}"
ipconfig0: "ip={{ vm_config['ip'] }},gw={{ vm_config['ip'].split('.')[:3] | join('.') }}.1"
update: true
when: vm_config['name'] in collected_proxmox_vms
register: update_vm_settings_job
async: 180
poll: 0
- name: Wait for VM settings updates processes to finish
async_status:
jid: "{{ update_vm_settings_job.ansible_job_id }}"
when: vm_config['name'] in collected_proxmox_vms
register: _ujobs_alias_vc_0
until: _ujobs_alias_vc_0.finished
retries: 60
delay: 10