| --- |
| # roles/juju-setup/main/tasks.yml |
| |
| - name: Verify that we can log into every VM |
| command: ansible services -m ping -u ubuntu |
| |
| - name: Initialize Juju |
| command: juju generate-config |
| creates={{ ansible_env['PWD'] }}/.juju/environments.yaml |
| |
| - name: Juju config file |
| template: |
| src=environments.yaml.j2 |
| dest={{ ansible_env['PWD'] }}/.juju/environments.yaml |
| |
| - name: Bootstrap Juju |
| command: juju bootstrap |
| creates={{ ansible_env['PWD'] }}/.juju/environments/manual.jenv |
| |
| - name: Copy openstack.cfg for Juju |
| become: yes |
| copy: |
| src=openstack.cfg |
| dest=/usr/local/src/openstack.cfg |
| |
| - name: Obtain Juju Facts |
| juju_facts: |
| |
| # list of VM names head_vm_list dict: head_vm_list | map(attribute='name') | list |
| # list of active juju_machines names: juju_machines.keys() |
| |
| - name: Add machines to Juju |
| command: "juju add-machine ssh:{{ item }}" |
| with_items: "{{ head_vm_list | map(attribute='name') | list | difference( juju_machines.keys()) }}" |
| |