Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 1 | --- |
| 2 | - hosts: singapore-head |
| 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 | - pause: "Wait until services have started" |
| 11 | |
| 12 | - name: Add nova-compute relations |
| 13 | script: scripts/juju-compute-relations.py |
| 14 | |
| 15 | - pause: "Wait until relations are added" |
| 16 | |
| 17 | - name: Copy network setup script |
| 18 | copy: src=scripts/network-setup.sh |
| 19 | dest=/home/ubuntu/network-setup.sh |
| 20 | |
| 21 | - name: Run network setup script |
| 22 | shell: ansible nova-cloud-controller -m script -a "/home/ubuntu/network-setup.sh" |
| 23 | |
| 24 | # Play: set up ansible-pull for OpenCloud-specific files on nova-compute nodes |
| 25 | - hosts: singapore-compute |
| 26 | sudo: yes |
| 27 | vars: |
| 28 | |
| 29 | # schedule is fed directly to cron |
| 30 | schedule: '*/15 * * * *' |
| 31 | |
| 32 | # User to run ansible-pull as from cron |
| 33 | cron_user: root |
| 34 | |
| 35 | # File that ansible will use for logs |
| 36 | logfile: /var/log/ansible-pull.log |
| 37 | |
| 38 | # Directory to where repository will be cloned |
| 39 | workdir: /var/lib/ansible/local |
| 40 | |
| 41 | # Repository to check out |
| 42 | # repo must contain a local.yml file at top level |
| 43 | #repo_url: git://github.com/sfromm/ansible-playbooks.git |
| 44 | repo_url: git://github.com/andybavier/opencloud-nova-compute-ansible.git |
| 45 | |
| 46 | tasks: |
| 47 | |
| 48 | - name: Install ansible |
| 49 | apt: name=ansible state=installed |
| 50 | |
| 51 | - name: Create local directory to work from |
| 52 | file: path={{workdir}} state=directory owner=root group=root mode=0751 |
| 53 | |
| 54 | - name: Create crontab entry to clone/pull git repository |
| 55 | template: src=templates/etc/cron.d/ansible-pull.j2 dest=/etc/cron.d/ansible-pull owner=root group=root mode=0644 |
| 56 | |
| 57 | - name: Create logrotate entry for ansible-pull.log |
| 58 | template: src=templates/etc/logrotate.d/ansible-pull.j2 dest=/etc/logrotate.d/ansible-pull owner=root group=root mode=0644 |
| 59 | |