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: |
| 5 | - pause: "Install nova-compute on all unused machines managed by Juju" |
| 6 | |
| 7 | - name: Deploy nova-compute |
| 8 | script: scripts/juju-compute-setup.py |
| 9 | |
| 10 | - name: Make sure we're using KVM |
| 11 | shell: juju set nova-compute virt-type=kvm |
| 12 | |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 13 | - name: Add nova-compute relations |
| 14 | script: scripts/juju-compute-relations.py |
| 15 | |
Andy Bavier | 5201714 | 2015-10-05 15:01:36 -0400 | [diff] [blame] | 16 | - name: Wait until relations are added |
| 17 | script: scripts/wait-for-services.sh |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 18 | |
| 19 | # 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] | 20 | - hosts: compute |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 21 | sudo: yes |
| 22 | vars: |
| 23 | |
| 24 | # schedule is fed directly to cron |
| 25 | schedule: '*/15 * * * *' |
| 26 | |
| 27 | # User to run ansible-pull as from cron |
| 28 | cron_user: root |
| 29 | |
| 30 | # File that ansible will use for logs |
| 31 | logfile: /var/log/ansible-pull.log |
| 32 | |
| 33 | # Directory to where repository will be cloned |
| 34 | workdir: /var/lib/ansible/local |
| 35 | |
| 36 | # Repository to check out |
| 37 | # repo must contain a local.yml file at top level |
| 38 | #repo_url: git://github.com/sfromm/ansible-playbooks.git |
| 39 | repo_url: git://github.com/andybavier/opencloud-nova-compute-ansible.git |
| 40 | |
| 41 | # Branch or tag to checkout |
Andy Bavier | c0c96ee | 2015-09-22 18:21:56 -0400 | [diff] [blame] | 42 | repo_version: kilo |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 43 | |
| 44 | tasks: |
| 45 | |
Andy Bavier | cccf27b | 2015-08-17 14:48:29 -0400 | [diff] [blame] | 46 | - name: Install ansible |
| 47 | apt: name=ansible state=installed |
| 48 | |
| 49 | - name: Basic ansible inventory |
| 50 | template: src=templates/etc/ansible/hosts.j2 |
| 51 | dest=/etc/ansible/hosts |
| 52 | |
| 53 | - name: Create local directory to work from |
| 54 | file: path={{workdir}} state=directory owner=root group=root mode=0751 |
| 55 | |
| 56 | - name: Create crontab entry to clone/pull git repository |
| 57 | template: src=templates/etc/cron.d/ansible-pull.j2 dest=/etc/cron.d/ansible-pull owner=root group=root mode=0644 |
| 58 | |
| 59 | - name: Create logrotate entry for ansible-pull.log |
| 60 | template: src=templates/etc/logrotate.d/ansible-pull.j2 dest=/etc/logrotate.d/ansible-pull owner=root group=root mode=0644 |