blob: a4f9ef5a8ade4d99cd12cde48038a7ca7e915620 [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
4 tasks:
Andy Bavier1fbd9b42015-10-26 10:04:19 -04005 - name: Remind user what is going to happen
6 pause: prompt="Install nova-compute on all unused machines managed by Juju"
Andy Baviercccf27b2015-08-17 14:48:29 -04007
8 - name: Deploy nova-compute
9 script: scripts/juju-compute-setup.py
10
Andy Bavier1fbd9b42015-10-26 10:04:19 -040011 - name: Try to avoid race condition
12 pause: seconds=5
13
14 - name: Wait until nova-compute is deployed
15 script: scripts/wait-for-services.sh
16
Andy Baviercccf27b2015-08-17 14:48:29 -040017 - name: Make sure we're using KVM
18 shell: juju set nova-compute virt-type=kvm
19
Andy Baviercccf27b2015-08-17 14:48:29 -040020 - name: Add nova-compute relations
21 script: scripts/juju-compute-relations.py
22
Andy Bavier1fbd9b42015-10-26 10:04:19 -040023 - name: Try to avoid race condition
24 pause: seconds=5
25
Andy Bavier52017142015-10-05 15:01:36 -040026 - name: Wait until relations are added
27 script: scripts/wait-for-services.sh
Andy Baviercccf27b2015-08-17 14:48:29 -040028
29# Play: set up ansible-pull for OpenCloud-specific files on nova-compute nodes
Andy Bavier22552302015-10-22 12:44:40 -040030- hosts: compute
Andy Baviercccf27b2015-08-17 14:48:29 -040031 sudo: yes
32 vars:
33
34 # schedule is fed directly to cron
35 schedule: '*/15 * * * *'
36
37 # User to run ansible-pull as from cron
38 cron_user: root
39
40 # File that ansible will use for logs
41 logfile: /var/log/ansible-pull.log
42
43 # Directory to where repository will be cloned
44 workdir: /var/lib/ansible/local
45
46 # Repository to check out
47 # repo must contain a local.yml file at top level
48 #repo_url: git://github.com/sfromm/ansible-playbooks.git
49 repo_url: git://github.com/andybavier/opencloud-nova-compute-ansible.git
50
51 # Branch or tag to checkout
Andy Bavierc0c96ee2015-09-22 18:21:56 -040052 repo_version: kilo
Andy Baviercccf27b2015-08-17 14:48:29 -040053
54 tasks:
55
Andy Baviercccf27b2015-08-17 14:48:29 -040056 - name: Install ansible
57 apt: name=ansible state=installed
58
59 - name: Basic ansible inventory
60 template: src=templates/etc/ansible/hosts.j2
61 dest=/etc/ansible/hosts
62
63 - name: Create local directory to work from
64 file: path={{workdir}} state=directory owner=root group=root mode=0751
65
66 - name: Create crontab entry to clone/pull git repository
67 template: src=templates/etc/cron.d/ansible-pull.j2 dest=/etc/cron.d/ansible-pull owner=root group=root mode=0644
68
69 - name: Create logrotate entry for ansible-pull.log
70 template: src=templates/etc/logrotate.d/ansible-pull.j2 dest=/etc/logrotate.d/ansible-pull owner=root group=root mode=0644