Handle undercloud autostart dependant on ansible version

On ansible version lower than 2.3:
 1.- Start undercloud vm
 2.- Make the vm automatically start

On ansible version equal or grater than 2.3:
 1.- Start the undercloud vm and make it automatically start

Change-Id: I57168f15d63f638bd0217955a3a3c245a986c541
Closes-bug: #1689620
This commit is contained in:
Juan Badia Payno 2017-08-21 13:34:10 +02:00
parent 1cbb105bae
commit 45e0321641
1 changed files with 23 additions and 9 deletions

View File

@ -301,21 +301,35 @@
state: 'directory'
when: non_root_chown|bool
# Start the undercloud virtual machine.
# This block only run when ansible version < 2.3.
- block:
# Start the undercloud virtual machine.
- name: Start undercloud vm
virt:
name: "{{ undercloud_node.name }}"
command: start
state: running
uri: "{{ libvirt_uri }}"
# Configure the undercloud virtual machine to be
# automatically started at boot.
- name: Configure undercloud vm to start at virthost boot
virt:
name: "{{ undercloud_node.name }}"
command: autostart
uri: "{{ libvirt_uri }}"
when: "{{ ansible_version.full | version_compare('2.3','<') }}"
# Start the undercloud virtual machine and make it
# automatically start for ansible-version >= 2.3
- name: Start undercloud vm
virt:
name: "{{ undercloud_node.name }}"
command: start
autostart: true
state: running
uri: "{{ libvirt_uri }}"
# Configure the undercloud virtual machine to be
# automatically started at boot.
- name: Configure undercloud vm to start at virthost boot
virt:
name: "{{ undercloud_node.name }}"
command: autostart
uri: "{{ libvirt_uri }}"
when: "{{ ansible_version.full | version_compare('2.3','>=') }}"
# Get the ip address of the undercloud. This will retry several times
# (`undercloud_ip_retries`) until the undercloud is ready. The script