Zack Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 1 | --- |
| 2 | # roles/juju-setup/main/tasks.yml |
| 3 | |
| 4 | - name: Verify that we can log into every VM |
| 5 | command: ansible services -m ping -u ubuntu |
| 6 | |
| 7 | - name: Initialize Juju |
| 8 | command: juju generate-config |
Zack Williams | 823d529 | 2016-02-29 10:31:17 -0700 | [diff] [blame] | 9 | creates={{ ansible_user_dir }}/.juju/environments.yaml |
Zack Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 10 | |
Zack Williams | 823d529 | 2016-02-29 10:31:17 -0700 | [diff] [blame] | 11 | - name: Create Juju config file from template |
Zack Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 12 | template: |
Zack Williams | 823d529 | 2016-02-29 10:31:17 -0700 | [diff] [blame] | 13 | src=environments.yaml.j2 |
| 14 | dest={{ ansible_user_dir }}/.juju/environments.yaml |
Zack Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 15 | |
| 16 | - name: Bootstrap Juju |
| 17 | command: juju bootstrap |
Zack Williams | 823d529 | 2016-02-29 10:31:17 -0700 | [diff] [blame] | 18 | creates={{ ansible_user_dir }}/.juju/environments/manual.jenv |
Zack Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 19 | |
| 20 | - name: Copy openstack.cfg for Juju |
| 21 | become: yes |
| 22 | copy: |
| 23 | src=openstack.cfg |
| 24 | dest=/usr/local/src/openstack.cfg |
| 25 | |
Zack Williams | 823d529 | 2016-02-29 10:31:17 -0700 | [diff] [blame] | 26 | # Code for juju_facts this is in library/juju_facts.py |
| 27 | |
Zack Williams | 32e12fb | 2016-02-29 10:25:59 -0700 | [diff] [blame] | 28 | - name: Obtain Juju Facts |
| 29 | juju_facts: |
Zack Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 30 | |
Zack Williams | 823d529 | 2016-02-29 10:31:17 -0700 | [diff] [blame] | 31 | # For setwise operations on desired vs Juju state: |
Zack Williams | 32e12fb | 2016-02-29 10:25:59 -0700 | [diff] [blame] | 32 | # list of VM names head_vm_list dict: head_vm_list | map(attribute='name') | list |
| 33 | # list of active juju_machines names: juju_machines.keys() |
Zack Williams | 823d529 | 2016-02-29 10:31:17 -0700 | [diff] [blame] | 34 | # list of active juju_services names: juju_services.keys() |
Zack Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 35 | |
Zack Williams | 9cdf862 | 2016-02-26 22:42:50 -0700 | [diff] [blame] | 36 | - name: Add machines to Juju |
Zack Williams | 32e12fb | 2016-02-29 10:25:59 -0700 | [diff] [blame] | 37 | command: "juju add-machine ssh:{{ item }}" |
| 38 | with_items: "{{ head_vm_list | map(attribute='name') | list | difference( juju_machines.keys()) }}" |
| 39 | |