Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 1 | --- |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [diff] [blame] | 2 | - hosts: head |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 3 | sudo: no |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [diff] [blame] | 4 | user: ubuntu |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 5 | tasks: |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [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 | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 8 | |
| 9 | - name: Deploy nova-compute |
| 10 | script: scripts/juju-compute-setup.py |
| 11 | |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [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 | |
| 18 | - name: Make sure we're using KVM |
| 19 | shell: juju set nova-compute virt-type=kvm |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 20 | |
| 21 | - name: Add nova-compute relations |
| 22 | script: scripts/juju-compute-relations.py |
| 23 | |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [diff] [blame] | 24 | - name: Try to avoid race condition |
| 25 | pause: seconds=5 |
| 26 | |
| 27 | - name: Wait until relations are added |
| 28 | script: scripts/wait-for-services.sh |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 29 | |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 30 | # Play: set up ansible-pull for OpenCloud-specific files on nova-compute nodes |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [diff] [blame] | 31 | - hosts: compute |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 32 | sudo: yes |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [diff] [blame] | 33 | user: ubuntu |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -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 | |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [diff] [blame] | 48 | # Repository to check out |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 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 | |
Tony Mack | 992a63b | 2016-02-23 22:05:56 +0000 | [diff] [blame] | 53 | # Branch or tag to checkout |
| 54 | repo_version: kilo |
| 55 | |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 56 | tasks: |
| 57 | |
| 58 | - name: Install ansible |
| 59 | apt: name=ansible state=installed |
| 60 | |
Andy Bavier | 1416aad | 2015-04-13 14:55:54 -0400 | [diff] [blame] | 61 | - name: Basic ansible inventory |
| 62 | template: src=templates/etc/ansible/hosts.j2 |
| 63 | dest=/etc/ansible/hosts |
| 64 | |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 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 |