---
- hosts: virthost
  any_errors_fatal: true
  gather_facts: true
  become: true
  roles:
    # FIXME(bogdando) fails to restart libvirt in the chrooted container
    # allow the "roles/parts/libvirt/tasks/main.yml" to fail!
    - environment/setup
    - { role: libvirt/teardown, when: teardown|bool }
    - { role: libvirt/setup/user, become: false }
    - libvirt/setup/overcloud
    - libvirt/setup/undercloud

- hosts: virthost
  any_errors_fatal: true
  gather_facts: true
  become: false
  roles:
    - { role: tripleo-inventory, tags: undercloud-inventory }

- name: Install the undercloud (oooq-extras)
  hosts: undercloud
  any_errors_fatal: true
  gather_facts: no
  become: false
  roles:
    - { role: undercloud-deploy, tags: undercloud-deploy }


# TODO install undercloud/overcloud with containers
# (extra_args: -e environments/docker.yaml, containerized_undercloud: true)
# see https://review.openstack.org/#/c/419040/ for undercloud
# Example vars:
#  vars:
#    extra_args: >
#      --control-scale 3
#      -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml
#      #OR for containers
#      -e environments/docker.yaml
#      --ntp-server pool.ntp.org


---
- hosts: virthost
  any_errors_fatal: true
  gather_facts: true
  become: true
  roles:
    # FIXME(bogdando) fails to restart libvirt in the chrooted container
    # allow the "roles/parts/libvirt/tasks/main.yml" to fail!
    - { role: environment/setup, when: teardown|bool }
    - { role: libvirt/teardown, when: teardown|bool }
    - { role: libvirt/setup/user, become: false }
    - libvirt/setup/overcloud
    - libvirt/setup/undercloud

- hosts: virthost
  any_errors_fatal: true
  gather_facts: true
  become: false
  roles:
    - { role: tripleo-inventory, tags: undercloud-inventory }

- name: Install the undercloud (oooq-extras)
  hosts: undercloud
  any_errors_fatal: true
  gather_facts: no
  become: false
  roles:
    - { role: undercloud-deploy, tags: undercloud-deploy }


# TODO install undercloud/overcloud with containers
# (extra_args: -e environments/docker.yaml, containerized_undercloud: true)
# see https://review.openstack.org/#/c/419040/ for undercloud
# Example vars:
#  vars:
#    extra_args: >
#      --control-scale 3
#      -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml
#      #OR for containers
#      -e environments/docker.yaml
#      --ntp-server pool.ntp.org


Fix nonidempotent user/keys setup for respinning
Fix nonidempotent user/keys setup for respinning

When respinning env using existing customized qcow2 image,
omit env setup tasks to keep the same access keys in place.

Signed-off-by: Bogdan Dobrelya <62b3a3e71fe69d786a0eb2bf561b6ce08e31d2cc@mail.ru>
