Tony Mack | 0830b40 | 2016-03-19 16:07:31 +0000 | [diff] [blame] | 1 | --- |
| 2 | - hosts: head |
| 3 | sudo: no |
| 4 | user: ubuntu |
| 5 | tasks: |
| 6 | - name: Remind user what is going to happen |
| 7 | pause: prompt="Install nova-compute on all unused machines managed by Juju" |
| 8 | |
| 9 | - name: Deploy nova-compute |
| 10 | script: scripts/juju-compute-setup.py |
| 11 | |
| 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 |
| 20 | |
| 21 | - name: Add nova-compute relations |
| 22 | script: scripts/juju-compute-relations.py |
| 23 | |
| 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 |
| 29 | |
| 30 | # Play: set up ansible-pull for OpenCloud-specific files on nova-compute nodes |
| 31 | - hosts: compute |
| 32 | sudo: yes |
| 33 | user: ubuntu |
| 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 |
| 54 | repo_version: kilo |
| 55 | |
| 56 | tasks: |
| 57 | |
| 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 |