Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 1 | --- |
Andy Bavier | 2255230 | 2015-10-22 12:44:40 -0400 | [diff] [blame] | 2 | - hosts: head |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 3 | sudo: no |
| 4 | tasks: |
Andy Bavier | 1fbd9b4 | 2015-10-26 10:04:19 -0400 | [diff] [blame] | 5 | - name: Remind user what is going to happen |
| 6 | pause: prompt="Install nova-compute on all unused machines managed by Juju" |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 7 | |
| 8 | - name: Deploy nova-compute |
| 9 | script: scripts/juju-compute-setup.py |
| 10 | |
Andy Bavier | 1fbd9b4 | 2015-10-26 10:04:19 -0400 | [diff] [blame] | 11 | - 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 Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 17 | - name: Make sure we're using KVM |
| 18 | shell: juju set nova-compute virt-type=kvm |
| 19 | |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 20 | - name: Add nova-compute relations |
| 21 | script: scripts/juju-compute-relations.py |
| 22 | |
Andy Bavier | 1fbd9b4 | 2015-10-26 10:04:19 -0400 | [diff] [blame] | 23 | - name: Try to avoid race condition |
| 24 | pause: seconds=5 |
| 25 | |
Andy Bavier | 5201714 | 2015-10-05 15:01:36 -0400 | [diff] [blame] | 26 | - name: Wait until relations are added |
| 27 | script: scripts/wait-for-services.sh |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 28 | |
| 29 | # Play: set up ansible-pull for OpenCloud-specific files on nova-compute nodes |
Andy Bavier | 2255230 | 2015-10-22 12:44:40 -0400 | [diff] [blame] | 30 | - hosts: compute |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 31 | 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 Bavier | c0c96ee | 2015-09-22 18:21:56 -0400 | [diff] [blame] | 52 | repo_version: kilo |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 53 | |
| 54 | tasks: |
| 55 | |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 56 | - 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 |