| --- |
| - hosts: head |
| sudo: no |
| tasks: |
| - name: Remind user what is going to happen |
| pause: prompt="Install nova-compute on all unused machines managed by Juju" |
| |
| - name: Deploy nova-compute |
| script: scripts/juju-compute-setup.py |
| |
| - name: Try to avoid race condition |
| pause: seconds=5 |
| |
| - name: Wait until nova-compute is deployed |
| script: scripts/wait-for-services.sh |
| |
| - name: Make sure we're using KVM |
| shell: juju set nova-compute virt-type=kvm |
| |
| - name: Add nova-compute relations |
| script: scripts/juju-compute-relations.py |
| |
| - name: Try to avoid race condition |
| pause: seconds=5 |
| |
| - name: Wait until relations are added |
| script: scripts/wait-for-services.sh |
| |
| # Play: set up ansible-pull for OpenCloud-specific files on nova-compute nodes |
| - hosts: compute |
| sudo: yes |
| vars: |
| |
| # schedule is fed directly to cron |
| schedule: '*/15 * * * *' |
| |
| # User to run ansible-pull as from cron |
| cron_user: root |
| |
| # File that ansible will use for logs |
| logfile: /var/log/ansible-pull.log |
| |
| # Directory to where repository will be cloned |
| workdir: /var/lib/ansible/local |
| |
| # Repository to check out |
| # repo must contain a local.yml file at top level |
| #repo_url: git://github.com/sfromm/ansible-playbooks.git |
| repo_url: git://github.com/andybavier/opencloud-nova-compute-ansible.git |
| |
| # Branch or tag to checkout |
| repo_version: kilo |
| |
| tasks: |
| |
| - name: Install ansible |
| apt: name=ansible state=installed |
| |
| - name: Basic ansible inventory |
| template: src=templates/etc/ansible/hosts.j2 |
| dest=/etc/ansible/hosts |
| |
| - name: Create local directory to work from |
| file: path={{workdir}} state=directory owner=root group=root mode=0751 |
| |
| - name: Create crontab entry to clone/pull git repository |
| template: src=templates/etc/cron.d/ansible-pull.j2 dest=/etc/cron.d/ansible-pull owner=root group=root mode=0644 |
| |
| - name: Create logrotate entry for ansible-pull.log |
| template: src=templates/etc/logrotate.d/ansible-pull.j2 dest=/etc/logrotate.d/ansible-pull owner=root group=root mode=0644 |