David K. Bainbridge | 5b4dafa | 2016-11-22 15:48:19 -0800 | [diff] [blame] | 1 | # SSH Key access from the current machine to the target node is required for the |
| 2 | # synchronize action to work. |
| 3 | - name: Ensure User SSH Keys |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 4 | local_action: user name='{{ ansible_user_id }}' generate_ssh_key=yes ssh_key_bits=2048 |
David K. Bainbridge | 5b4dafa | 2016-11-22 15:48:19 -0800 | [diff] [blame] | 5 | tags: |
| 6 | - establish_ssh_keys |
| 7 | |
| 8 | - name: Ensure Key Authorized on Target Head Node |
| 9 | authorized_key: |
David K. Bainbridge | 45e454e | 2016-11-22 19:20:23 -0800 | [diff] [blame] | 10 | user: '{{ansible_ssh_user}}' |
| 11 | key: "{{lookup('file', '~/.ssh/id_rsa.pub')}}" |
David K. Bainbridge | 5b4dafa | 2016-11-22 15:48:19 -0800 | [diff] [blame] | 12 | tags: |
| 13 | - establish_ssh_keys |
| 14 | |
David K. Bainbridge | ed10154 | 2016-05-18 20:26:15 -0700 | [diff] [blame] | 15 | - name: Ensure MAAS Ansible Config Directory |
| 16 | become: yes |
| 17 | file: |
| 18 | path=/etc/maas/ansible |
| 19 | owner=maas |
| 20 | group=maas |
| 21 | state=directory |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 22 | mode="0755" |
David K. Bainbridge | ed10154 | 2016-05-18 20:26:15 -0700 | [diff] [blame] | 23 | |
David K. Bainbridge | 5ba01a9 | 2016-08-16 14:58:31 -0700 | [diff] [blame] | 24 | - name: Ensure Ansible Roles |
David K. Bainbridge | ed10154 | 2016-05-18 20:26:15 -0700 | [diff] [blame] | 25 | become: yes |
David K. Bainbridge | 5b4dafa | 2016-11-22 15:48:19 -0800 | [diff] [blame] | 26 | synchronize: |
David K. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 27 | src: "{{ item }}" |
David K. Bainbridge | 5ba01a9 | 2016-08-16 14:58:31 -0700 | [diff] [blame] | 28 | dest: /etc/maas/ansible |
David K. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 29 | with_items: |
| 30 | - roles |
| 31 | - library |
David K. Bainbridge | ed10154 | 2016-05-18 20:26:15 -0700 | [diff] [blame] | 32 | |
David K. Bainbridge | 5ba01a9 | 2016-08-16 14:58:31 -0700 | [diff] [blame] | 33 | - name: Ensure Role Permissions and Modes |
David K. Bainbridge | e18f57b | 2016-05-23 15:40:58 -0700 | [diff] [blame] | 34 | become: yes |
David K. Bainbridge | 5ba01a9 | 2016-08-16 14:58:31 -0700 | [diff] [blame] | 35 | file: |
David K. Bainbridge | 141d2ab | 2016-08-26 13:02:33 -0700 | [diff] [blame] | 36 | path: /etc/maas/ansible/roles |
David K. Bainbridge | 5ba01a9 | 2016-08-16 14:58:31 -0700 | [diff] [blame] | 37 | owner: maas |
| 38 | group: maas |
| 39 | mode: u=rwX,g=rX,o=rX |
| 40 | state: directory |
| 41 | recurse: true |
David K. Bainbridge | ed10154 | 2016-05-18 20:26:15 -0700 | [diff] [blame] | 42 | |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 43 | - name: Ensure Ansible Provisioning Script |
| 44 | become: yes |
| 45 | copy: |
David K. Bainbridge | be58a0d | 2016-06-22 15:43:02 -0700 | [diff] [blame] | 46 | dest=/etc/maas/ansible/{{ item }} |
| 47 | src=files/{{ item }} |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 48 | owner=maas |
| 49 | group=maas |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 50 | mode="0755" |
David K. Bainbridge | be58a0d | 2016-06-22 15:43:02 -0700 | [diff] [blame] | 51 | with_items: |
| 52 | - do-ansible |
| 53 | - do-switch |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 54 | |
| 55 | - name: Ensure Provisioning Log Directory |
| 56 | become: yes |
| 57 | file: |
| 58 | path=/etc/maas/ansible/logs |
| 59 | state=directory |
| 60 | owner=maas |
| 61 | group=maas |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 62 | mode="0755" |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 63 | |
David K. Bainbridge | 915105d | 2016-07-06 14:10:08 -0700 | [diff] [blame] | 64 | - name: Capture MAAS API Key |
| 65 | become: yes |
| 66 | command: maas-region-admin apikey --username={{ maas.user }} |
| 67 | register: apikey |
| 68 | changed_when: false |
| 69 | |
Charles Chan | 3c68162 | 2016-08-03 21:53:03 -0700 | [diff] [blame] | 70 | - name: Ensure Compute and Switch Node Playbooks |
David K. Bainbridge | ed10154 | 2016-05-18 20:26:15 -0700 | [diff] [blame] | 71 | become: yes |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 72 | template: |
David K. Bainbridge | 96c77e8 | 2016-11-07 14:59:43 -0800 | [diff] [blame] | 73 | src={{ item }}.j2 |
David K. Bainbridge | be58a0d | 2016-06-22 15:43:02 -0700 | [diff] [blame] | 74 | dest=/etc/maas/ansible/{{ item }} |
David K. Bainbridge | ed10154 | 2016-05-18 20:26:15 -0700 | [diff] [blame] | 75 | owner=maas |
| 76 | group=maas |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 77 | mode="0644" |
David K. Bainbridge | be58a0d | 2016-06-22 15:43:02 -0700 | [diff] [blame] | 78 | with_items: |
| 79 | - compute-node.yml |
| 80 | - switch-node.yml |
Charles Chan | 3c68162 | 2016-08-03 21:53:03 -0700 | [diff] [blame] | 81 | |
David K. Bainbridge | 906a9a1 | 2016-08-25 10:50:45 -0700 | [diff] [blame] | 82 | - name: Ensure Compute and Switch Variable Directory |
| 83 | become: yes |
| 84 | file: |
| 85 | path=/etc/maas/ansible/vars |
| 86 | owner=maas |
| 87 | group=maas |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 88 | mode="0755" |
David K. Bainbridge | 906a9a1 | 2016-08-25 10:50:45 -0700 | [diff] [blame] | 89 | state=directory |
| 90 | |
| 91 | - name: Ensure Compute and Switch Node Variables |
| 92 | become: yes |
| 93 | template: |
Scott Baker | b2b7fd9 | 2016-11-01 16:01:38 -0700 | [diff] [blame] | 94 | src=templates/compute-node-vars.yml.j2 |
David K. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 95 | dest=/etc/maas/ansible/vars/compute-node-vars.yml |
David K. Bainbridge | 906a9a1 | 2016-08-25 10:50:45 -0700 | [diff] [blame] | 96 | owner=maas |
| 97 | group=maas |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 98 | mode="0644" |
David K. Bainbridge | 906a9a1 | 2016-08-25 10:50:45 -0700 | [diff] [blame] | 99 | |
Charles Chan | 3c68162 | 2016-08-03 21:53:03 -0700 | [diff] [blame] | 100 | - name: Ensure Connect Switch Ansible Playbook |
| 101 | become: yes |
| 102 | copy: |
| 103 | dest=/etc/maas/ansible/{{ item }} |
| 104 | src=files/{{ item }} |
| 105 | owner=maas |
| 106 | group=maas |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 107 | mode="0644" |
Charles Chan | 3c68162 | 2016-08-03 21:53:03 -0700 | [diff] [blame] | 108 | with_items: |
Charles Chan | a4ccbde | 2016-08-02 00:12:34 -0700 | [diff] [blame] | 109 | - connect-switch.yml |
David K. Bainbridge | 915105d | 2016-07-06 14:10:08 -0700 | [diff] [blame] | 110 | |
| 111 | - name: Ensure Dynamic Inventory Script |
| 112 | become: yes |
| 113 | template: |
Scott Baker | b2b7fd9 | 2016-11-01 16:01:38 -0700 | [diff] [blame] | 114 | src=templates/pod-inventory |
David K. Bainbridge | 915105d | 2016-07-06 14:10:08 -0700 | [diff] [blame] | 115 | dest=/etc/maas/ansible/pod-inventory |
| 116 | owner=maas |
| 117 | group=maas |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 118 | mode="0755" |
David K. Bainbridge | 7ae4f19 | 2016-09-29 09:01:38 -0700 | [diff] [blame] | 119 | |
| 120 | - name: Copy CORD Utility Scripts |
| 121 | become: yes |
| 122 | copy: |
| 123 | src=files/commands/{{ item }} |
| 124 | dest=/usr/local/bin/{{ item }} |
| 125 | owner=root |
| 126 | group=root |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 127 | mode="0755" |
David K. Bainbridge | 7ae4f19 | 2016-09-29 09:01:38 -0700 | [diff] [blame] | 128 | with_items: |
| 129 | - cord |
| 130 | - cord-harvest |
| 131 | - cord-prov |
David K. Bainbridge | 058c3d6 | 2016-09-30 15:03:26 -0700 | [diff] [blame] | 132 | - cord-switch |
| 133 | - cord-generate |
David K. Bainbridge | c4e0fc5 | 2016-11-14 12:03:35 -0800 | [diff] [blame] | 134 | - cord-registry |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 135 | |
| 136 | - name: Ensure SSH Key Storage |
| 137 | become: yes |
| 138 | file: |
| 139 | path: /etc/maas/.ssh |
| 140 | mode: "0755" |
| 141 | owner: maas |
| 142 | group: maas |
| 143 | state: directory |
| 144 | |
| 145 | - name: Copy SSH Key Pair for POD |
| 146 | become: yes |
| 147 | copy: |
| 148 | src: /etc/maas/.ssh/{{item}} |
| 149 | dest: /etc/maas/.ssh/{{item}} |
| 150 | owner: maas |
| 151 | group: maas |
| 152 | mode: "0644" |
| 153 | with_items: |
| 154 | - cord_rsa |
| 155 | - cord_rsa.pub |