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 |
Tony Mack | ea7bdb5 | 2016-02-01 17:23:54 +0000 | [diff] [blame] | 4 | user: ubuntu |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 5 | tasks: |
Andy Bavier | 1fbd9b4 | 2015-10-26 10:04:19 -0400 | [diff] [blame] | 6 | - name: Remind user what is going to happen |
| 7 | pause: prompt="Install nova-compute on all unused machines managed by Juju" |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 8 | |
| 9 | - name: Deploy nova-compute |
| 10 | script: scripts/juju-compute-setup.py |
| 11 | |
Andy Bavier | 1fbd9b4 | 2015-10-26 10:04:19 -0400 | [diff] [blame] | 12 | - 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 Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 18 | - name: Make sure we're using KVM |
| 19 | shell: juju set nova-compute virt-type=kvm |
| 20 | |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 21 | - name: Add nova-compute relations |
| 22 | script: scripts/juju-compute-relations.py |
| 23 | |
Andy Bavier | 1fbd9b4 | 2015-10-26 10:04:19 -0400 | [diff] [blame] | 24 | - name: Try to avoid race condition |
| 25 | pause: seconds=5 |
| 26 | |
Andy Bavier | 5201714 | 2015-10-05 15:01:36 -0400 | [diff] [blame] | 27 | - name: Wait until relations are added |
| 28 | script: scripts/wait-for-services.sh |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 29 | |
| 30 | # 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] | 31 | - hosts: compute |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 32 | sudo: yes |
Tony Mack | ea7bdb5 | 2016-02-01 17:23:54 +0000 | [diff] [blame] | 33 | user: ubuntu |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 34 | 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 Bavier | c0c96ee | 2015-09-22 18:21:56 -0400 | [diff] [blame] | 54 | repo_version: kilo |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 55 | |
| 56 | tasks: |
| 57 | |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 58 | - 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 |