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