| # SSH Key access from the current machine to the target node is required for the |
| # synchronize action to work. |
| - name: Ensure User SSH Keys |
| local_action: user name='{{ ansible_user_id }}' generate_ssh_key=yes ssh_key_bits=2048 |
| tags: |
| - establish_ssh_keys |
| |
| - name: Ensure Key Authorized on Target Head Node |
| authorized_key: |
| user: '{{ansible_ssh_user}}' |
| key: "{{lookup('file', '~/.ssh/id_rsa.pub')}}" |
| tags: |
| - establish_ssh_keys |
| |
| - 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 |
| synchronize: |
| src: "{{ item }}" |
| dest: /etc/maas/ansible |
| with_items: |
| - roles |
| - library |
| |
| - 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={{ item }}.j2 |
| 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=templates/compute-node-vars.yml.j2 |
| dest=/etc/maas/ansible/vars/compute-node-vars.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=templates/pod-inventory |
| dest=/etc/maas/ansible/pod-inventory |
| owner=maas |
| group=maas |
| mode="0755" |
| |
| - name: Copy CORD Utility Scripts |
| become: yes |
| copy: |
| src=files/commands/{{ item }} |
| dest=/usr/local/bin/{{ item }} |
| owner=root |
| group=root |
| mode="0755" |
| with_items: |
| - cord |
| - cord-harvest |
| - cord-prov |
| - cord-switch |
| - cord-generate |
| - cord-registry |
| |
| - name: Ensure SSH Key Storage |
| become: yes |
| file: |
| path: /etc/maas/.ssh |
| mode: "0755" |
| owner: maas |
| group: maas |
| state: directory |
| |
| - name: Copy SSH Key Pair for POD |
| become: yes |
| copy: |
| src: /etc/maas/.ssh/{{item}} |
| dest: /etc/maas/.ssh/{{item}} |
| owner: maas |
| group: maas |
| mode: "0644" |
| with_items: |
| - cord_rsa |
| - cord_rsa.pub |