Guest User

Untitled

a guest
Mar 27th, 2019
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.98 KB | None | 0 0
  1.  - name: Detecting if cloudinit is installed
  2.     uri:
  3.        url: https://{{ inventory_hostname }}:8006/api2/json/nodes/{{ node }}/qemu/{{ vmid }}/config
  4.        method: GET
  5.        headers:
  6.          Cookie: "{{ CookieToken }}"
  7.          CSRFPreventionToken: "{{ CSRToken }}"
  8.        status_code: 200
  9.        validate_certs: no
  10.        return_content: yes
  11.     register: cloudinit.stdout
  12.  
  13.   - debug:
  14.     var: cloudinit.stdout
  15.  
  16.   - name: add cloud-init ide to {{ vmid }} in node {{ inventory_hostname }}
  17.     uri:
  18.        url: https://{{ inventory_hostname }}:8006/api2/json/nodes/{{ node }}/qemu/{{ vmid }}/config
  19.        method: POST
  20.        body_format: form-urlencoded
  21.        headers:
  22.          Cookie: "{{ CookieToken }}"
  23.          CSRFPreventionToken: "{{ CSRToken }}"
  24.        body:
  25.          ide2: "local-lvm:vm-{{ vmid }}-cloudinit,media=cdrom"
  26.        status_code: 200
  27.        validate_certs: no
  28.        return_content: yes
  29.     when:
  30.       cloudinit.data.["ide2"] is not defined
Advertisement
Add Comment
Please, Sign In to add comment