| - name: Ensure MAAS Ansible Config Directory |
| become: yes |
| file: |
| path=/etc/maas/ansible |
| owner=maas |
| group=maas |
| state=directory |
| |
| - name: Ensure Ansible Compute Config Files |
| become: yes |
| git: |
| repo={{ provision.location }} |
| dest=/tmp/ansible.maas |
| clone=yes |
| force=yes |
| update=yes |
| |
| - name: Ensure Ansible Roles Exist |
| become: yes |
| command: cp -rf /tmp/ansible.maas/{{ provision.role_path }} /etc/maas/ansible |
| |
| - name: Ensure Ansible Roles Ownership |
| become: yes |
| file: dest=/etc/maas/ansible/{{ provision.role_path }} owner=maas group=maas recurse=yes |
| |
| - name: Ensure Ansible Provisioning Script |
| become: yes |
| copy: |
| dest=/etc/maas/ansible/{{ item }} |
| src=files/{{ item }} |
| owner=maas |
| group=maas |
| mode=0755 |
| with_items: |
| - do-ansible |
| - do-switch |
| |
| - name: Ensure Provisioning Log Directory |
| become: yes |
| file: |
| path=/etc/maas/ansible/logs |
| state=directory |
| owner=maas |
| group=maas |
| mode=0755 |
| |
| - name: Capture MAAS API Key |
| become: yes |
| command: maas-region-admin apikey --username={{ maas.user }} |
| register: apikey |
| changed_when: false |
| |
| - name: Ensure Compute and Switch Node Playbooks |
| become: yes |
| template: |
| src=files/{{ item }} |
| dest=/etc/maas/ansible/{{ item }} |
| owner=maas |
| group=maas |
| mode=0644 |
| with_items: |
| - compute-node.yml |
| - switch-node.yml |
| |
| - name: Ensure Connect Switch Ansible Playbook |
| become: yes |
| copy: |
| dest=/etc/maas/ansible/{{ item }} |
| src=files/{{ item }} |
| owner=maas |
| group=maas |
| mode=0644 |
| with_items: |
| - connect-switch.yml |
| |
| - name: Ensure Dynamic Inventory Script |
| become: yes |
| template: |
| src=files/pod-inventory |
| dest=/etc/maas/ansible/pod-inventory |
| owner=maas |
| group=maas |
| mode=0755 |