| - name: Ensure MAAS Ansible Config Directory |
| become: yes |
| file: |
| path=/etc/maas/ansible |
| owner=maas |
| group=maas |
| state=directory |
| mode=0755 |
| |
| - name: Ensure Ansible Roles |
| become: yes |
| copy: |
| src: roles |
| dest: /etc/maas/ansible |
| owner: maas |
| group: maas |
| mode: u=rwX,g=rX,o=rX |
| force: true |
| |
| - name: Ensure Role Permissions and Modes |
| become: yes |
| file: |
| path: /etc/maas/ansible/roles |
| owner: maas |
| group: maas |
| mode: u=rwX,g=rX,o=rX |
| state: directory |
| recurse: true |
| |
| - 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 Compute and Switch Variable Directory |
| become: yes |
| file: |
| path=/etc/maas/ansible/vars |
| owner=maas |
| group=maas |
| mode=0755 |
| state=directory |
| |
| - name: Ensure Compute and Switch Node Variables |
| become: yes |
| template: |
| src=files/compute-node-vars.yml |
| dest=/etc/maas/ansible/vars/compute-node.yml |
| owner=maas |
| group=maas |
| mode=0644 |
| |
| - 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 |