blob: 593bfdb00c5ff32d9301740eba07b79faff20a22 [file] [log] [blame]
Zack Williams573bafc2016-02-26 16:35:42 -07001---
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 Williams823d5292016-02-29 10:31:17 -07009 creates={{ ansible_user_dir }}/.juju/environments.yaml
Zack Williams573bafc2016-02-26 16:35:42 -070010
Zack Williams823d5292016-02-29 10:31:17 -070011- name: Create Juju config file from template
Zack Williams573bafc2016-02-26 16:35:42 -070012 template:
Zack Williams823d5292016-02-29 10:31:17 -070013 src=environments.yaml.j2
14 dest={{ ansible_user_dir }}/.juju/environments.yaml
Zack Williams573bafc2016-02-26 16:35:42 -070015
16- name: Bootstrap Juju
17 command: juju bootstrap
Zack Williams823d5292016-02-29 10:31:17 -070018 creates={{ ansible_user_dir }}/.juju/environments/manual.jenv
Zack Williams573bafc2016-02-26 16:35:42 -070019
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 Williams823d5292016-02-29 10:31:17 -070026# Code for juju_facts this is in library/juju_facts.py
27
Zack Williams32e12fb2016-02-29 10:25:59 -070028- name: Obtain Juju Facts
29 juju_facts:
Zack Williams573bafc2016-02-26 16:35:42 -070030
Zack Williams823d5292016-02-29 10:31:17 -070031# For setwise operations on desired vs Juju state:
Zack Williams32e12fb2016-02-29 10:25:59 -070032# 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 Williams823d5292016-02-29 10:31:17 -070034# list of active juju_services names: juju_services.keys()
Zack Williams573bafc2016-02-26 16:35:42 -070035
Zack Williams9cdf8622016-02-26 22:42:50 -070036- name: Add machines to Juju
Zack Williams32e12fb2016-02-29 10:25:59 -070037 command: "juju add-machine ssh:{{ item }}"
38 with_items: "{{ head_vm_list | map(attribute='name') | list | difference( juju_machines.keys()) }}"
39