Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: Detecting if cloudinit is installed
- uri:
- url: https://{{ inventory_hostname }}:8006/api2/json/nodes/{{ node }}/qemu/{{ vmid }}/config
- method: GET
- headers:
- Cookie: "{{ CookieToken }}"
- CSRFPreventionToken: "{{ CSRToken }}"
- status_code: 200
- validate_certs: no
- return_content: yes
- register: cloudinit.stdout
- - debug:
- var: cloudinit.stdout
- - name: add cloud-init ide to {{ vmid }} in node {{ inventory_hostname }}
- uri:
- url: https://{{ inventory_hostname }}:8006/api2/json/nodes/{{ node }}/qemu/{{ vmid }}/config
- method: POST
- body_format: form-urlencoded
- headers:
- Cookie: "{{ CookieToken }}"
- CSRFPreventionToken: "{{ CSRToken }}"
- body:
- ide2: "local-lvm:vm-{{ vmid }}-cloudinit,media=cdrom"
- status_code: 200
- validate_certs: no
- return_content: yes
- when:
- cloudinit.data.["ide2"] is not defined
Advertisement
Add Comment
Please, Sign In to add comment