blob: c342483575c57b4ab0e5dd59a63b341f5aa3e5c7 [file] [log] [blame]
Andy Baviercccf27b2015-08-17 14:48:29 -04001---
Andy Bavier22552302015-10-22 12:44:40 -04002- hosts: head
Andy Baviercccf27b2015-08-17 14:48:29 -04003 sudo: no
Tony Mackea7bdb52016-02-01 17:23:54 +00004 user: ubuntu
Andy Baviercccf27b2015-08-17 14:48:29 -04005 tasks:
Andy Bavier1fbd9b42015-10-26 10:04:19 -04006 - name: Remind user what is going to happen
7 pause: prompt="Install nova-compute on all unused machines managed by Juju"
Andy Baviercccf27b2015-08-17 14:48:29 -04008
9 - name: Deploy nova-compute
10 script: scripts/juju-compute-setup.py
11
Andy Bavier1fbd9b42015-10-26 10:04:19 -040012 - name: Try to avoid race condition
13 pause: seconds=5
14
15 - name: Wait until nova-compute is deployed
16 script: scripts/wait-for-services.sh
17
Andy Baviercccf27b2015-08-17 14:48:29 -040018 - name: Make sure we're using KVM
19 shell: juju set nova-compute virt-type=kvm
20
Andy Baviercccf27b2015-08-17 14:48:29 -040021 - name: Add nova-compute relations
22 script: scripts/juju-compute-relations.py
23
Andy Bavier1fbd9b42015-10-26 10:04:19 -040024 - name: Try to avoid race condition
25 pause: seconds=5
26
Andy Bavier52017142015-10-05 15:01:36 -040027 - name: Wait until relations are added
28 script: scripts/wait-for-services.sh
Andy Baviercccf27b2015-08-17 14:48:29 -040029
30# Play: set up ansible-pull for OpenCloud-specific files on nova-compute nodes
Andy Bavier22552302015-10-22 12:44:40 -040031- hosts: compute
Andy Baviercccf27b2015-08-17 14:48:29 -040032 sudo: yes
Tony Mackea7bdb52016-02-01 17:23:54 +000033 user: ubuntu
Andy Baviercccf27b2015-08-17 14:48:29 -040034 vars:
35
36 # schedule is fed directly to cron
37 schedule: '*/15 * * * *'
38
39 # User to run ansible-pull as from cron
40 cron_user: root
41
42 # File that ansible will use for logs
43 logfile: /var/log/ansible-pull.log
44
45 # Directory to where repository will be cloned
46 workdir: /var/lib/ansible/local
47
48 # Repository to check out
49 # repo must contain a local.yml file at top level
50 #repo_url: git://github.com/sfromm/ansible-playbooks.git
51 repo_url: git://github.com/andybavier/opencloud-nova-compute-ansible.git
52
53 # Branch or tag to checkout
Andy Bavierc0c96ee2015-09-22 18:21:56 -040054 repo_version: kilo
Andy Baviercccf27b2015-08-17 14:48:29 -040055
56 tasks:
57
Andy Baviercccf27b2015-08-17 14:48:29 -040058 - name: Install ansible
59 apt: name=ansible state=installed
60
61 - name: Basic ansible inventory
62 template: src=templates/etc/ansible/hosts.j2
63 dest=/etc/ansible/hosts
64
65 - name: Create local directory to work from
66 file: path={{workdir}} state=directory owner=root group=root mode=0751
67
68 - name: Create crontab entry to clone/pull git repository
69 template: src=templates/etc/cron.d/ansible-pull.j2 dest=/etc/cron.d/ansible-pull owner=root group=root mode=0644
70
71 - name: Create logrotate entry for ansible-pull.log
72 template: src=templates/etc/logrotate.d/ansible-pull.j2 dest=/etc/logrotate.d/ansible-pull owner=root group=root mode=0644