ok, just do this for now.
This commit is contained in:
parent
430bdb591a
commit
3a52dc1ac4
1 changed files with 11 additions and 9 deletions
|
@ -1,24 +1,26 @@
|
||||||
# setup a virt instance using a dizzying array of variables :)
|
#
|
||||||
# FIXME
|
# This task is the thing that creates a vm for later use
|
||||||
# do an action here that aborts if a bunch of vars are not set
|
#
|
||||||
|
|
||||||
- name: get vm list on "{{ vmhost }}"
|
- debug: msg="operating on {{vmhost}}"
|
||||||
|
|
||||||
|
- name: get vm list
|
||||||
delegate_to: "{{ vmhost }}"
|
delegate_to: "{{ vmhost }}"
|
||||||
virt: command=list_vms
|
virt: command=list_vms
|
||||||
register: result
|
register: result
|
||||||
always_run: yes
|
always_run: yes
|
||||||
|
|
||||||
- name: ensure the lv for the guest is made on {{ vmhost }}
|
- name: ensure the lv for the guest is made
|
||||||
lvol: lv={{ inventory_hostname }} vg={{ volgroup }} size={{ lvm_size }} state=present
|
lvol: lv={{ inventory_hostname }} vg={{ volgroup }} size={{ lvm_size }} state=present
|
||||||
delegate_to: "{{ vmhost }}"
|
delegate_to: "{{ vmhost }}"
|
||||||
when: inventory_hostname not in result.list_vms
|
when: inventory_hostname not in result.list_vms
|
||||||
|
|
||||||
- name: run the virt-install on "{{ vmhost }}"
|
- name: run the virt-install
|
||||||
shell: "{{ virt_install_command }}"
|
shell: "{{ virt_install_command }}"
|
||||||
delegate_to: "{{ vmhost }}"
|
delegate_to: "{{ vmhost }}"
|
||||||
when: inventory_hostname not in result.list_vms
|
when: inventory_hostname not in result.list_vms
|
||||||
|
|
||||||
- name: wait for the install to finish on "{{ vmhost }}"
|
- name: wait for the install to finish
|
||||||
virt: command=status name={{ inventory_hostname }}
|
virt: command=status name={{ inventory_hostname }}
|
||||||
register: vmstatus
|
register: vmstatus
|
||||||
until: vmstatus.status == 'shutdown'
|
until: vmstatus.status == 'shutdown'
|
||||||
|
@ -27,12 +29,12 @@
|
||||||
delay: 10
|
delay: 10
|
||||||
when: inventory_hostname not in result.list_vms
|
when: inventory_hostname not in result.list_vms
|
||||||
|
|
||||||
- name: start the vm up on "{{ vmhost }}"
|
- name: start the vm up
|
||||||
action: virt state=running name={{ inventory_hostname }}
|
action: virt state=running name={{ inventory_hostname }}
|
||||||
delegate_to: "{{ vmhost }}"
|
delegate_to: "{{ vmhost }}"
|
||||||
when: inventory_hostname not in result.list_vms
|
when: inventory_hostname not in result.list_vms
|
||||||
|
|
||||||
- name: set it to autostart on "{{ vmhost }}"
|
- name: set it to autostart
|
||||||
action: virt command=autostart name={{ inventory_hostname }}
|
action: virt command=autostart name={{ inventory_hostname }}
|
||||||
delegate_to: "{{ vmhost }}"
|
delegate_to: "{{ vmhost }}"
|
||||||
when: inventory_hostname not in result.list_vms
|
when: inventory_hostname not in result.list_vms
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue