blob: 7d59204f331420d5511c20c772c95c225b6c2eb6 [file] [log] [blame]
David K. Bainbridge5b4dafa2016-11-22 15:48:19 -08001# 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
David K. Bainbridge45e454e2016-11-22 19:20:23 -08004 local_action: user name='{{ansible_user}}' generate_ssh_key=yes ssh_key_bits=2048
David K. Bainbridge5b4dafa2016-11-22 15:48:19 -08005 tags:
6 - establish_ssh_keys
7
8- name: Ensure Key Authorized on Target Head Node
9 authorized_key:
David K. Bainbridge45e454e2016-11-22 19:20:23 -080010 user: '{{ansible_ssh_user}}'
11 key: "{{lookup('file', '~/.ssh/id_rsa.pub')}}"
David K. Bainbridge5b4dafa2016-11-22 15:48:19 -080012 tags:
13 - establish_ssh_keys
14
David K. Bainbridgeed101542016-05-18 20:26:15 -070015- 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. Bainbridge8b179042016-11-30 15:38:42 -080022 mode="0755"
David K. Bainbridgeed101542016-05-18 20:26:15 -070023
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070024- name: Ensure Ansible Roles
David K. Bainbridgeed101542016-05-18 20:26:15 -070025 become: yes
David K. Bainbridge5b4dafa2016-11-22 15:48:19 -080026 synchronize:
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070027 src: "{{ item }}"
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070028 dest: /etc/maas/ansible
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070029 with_items:
30 - roles
31 - library
David K. Bainbridgeed101542016-05-18 20:26:15 -070032
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070033- name: Ensure Role Permissions and Modes
David K. Bainbridgee18f57b2016-05-23 15:40:58 -070034 become: yes
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070035 file:
David K. Bainbridge141d2ab2016-08-26 13:02:33 -070036 path: /etc/maas/ansible/roles
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070037 owner: maas
38 group: maas
39 mode: u=rwX,g=rX,o=rX
40 state: directory
41 recurse: true
David K. Bainbridgeed101542016-05-18 20:26:15 -070042
David K. Bainbridge0820cab2016-06-02 17:43:32 -070043- name: Ensure Ansible Provisioning Script
44 become: yes
45 copy:
David K. Bainbridgebe58a0d2016-06-22 15:43:02 -070046 dest=/etc/maas/ansible/{{ item }}
47 src=files/{{ item }}
David K. Bainbridge0820cab2016-06-02 17:43:32 -070048 owner=maas
49 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -080050 mode="0755"
David K. Bainbridgebe58a0d2016-06-22 15:43:02 -070051 with_items:
52 - do-ansible
53 - do-switch
David K. Bainbridge0820cab2016-06-02 17:43:32 -070054
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. Bainbridge8b179042016-11-30 15:38:42 -080062 mode="0755"
David K. Bainbridge0820cab2016-06-02 17:43:32 -070063
David K. Bainbridge915105d2016-07-06 14:10:08 -070064- 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 Chan3c681622016-08-03 21:53:03 -070070- name: Ensure Compute and Switch Node Playbooks
David K. Bainbridgeed101542016-05-18 20:26:15 -070071 become: yes
David K. Bainbridge10b0c112016-05-24 13:17:23 -070072 template:
David K. Bainbridge96c77e82016-11-07 14:59:43 -080073 src={{ item }}.j2
David K. Bainbridgebe58a0d2016-06-22 15:43:02 -070074 dest=/etc/maas/ansible/{{ item }}
David K. Bainbridgeed101542016-05-18 20:26:15 -070075 owner=maas
76 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -080077 mode="0644"
David K. Bainbridgebe58a0d2016-06-22 15:43:02 -070078 with_items:
79 - compute-node.yml
80 - switch-node.yml
Charles Chan3c681622016-08-03 21:53:03 -070081
David K. Bainbridge906a9a12016-08-25 10:50:45 -070082- 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. Bainbridge8b179042016-11-30 15:38:42 -080088 mode="0755"
David K. Bainbridge906a9a12016-08-25 10:50:45 -070089 state=directory
90
91- name: Ensure Compute and Switch Node Variables
92 become: yes
93 template:
Scott Bakerb2b7fd92016-11-01 16:01:38 -070094 src=templates/compute-node-vars.yml.j2
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070095 dest=/etc/maas/ansible/vars/compute-node-vars.yml
David K. Bainbridge906a9a12016-08-25 10:50:45 -070096 owner=maas
97 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -080098 mode="0644"
David K. Bainbridge906a9a12016-08-25 10:50:45 -070099
Charles Chan3c681622016-08-03 21:53:03 -0700100- 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. Bainbridge8b179042016-11-30 15:38:42 -0800107 mode="0644"
Charles Chan3c681622016-08-03 21:53:03 -0700108 with_items:
Charles Chana4ccbde2016-08-02 00:12:34 -0700109 - connect-switch.yml
David K. Bainbridge915105d2016-07-06 14:10:08 -0700110
111- name: Ensure Dynamic Inventory Script
112 become: yes
113 template:
Scott Bakerb2b7fd92016-11-01 16:01:38 -0700114 src=templates/pod-inventory
David K. Bainbridge915105d2016-07-06 14:10:08 -0700115 dest=/etc/maas/ansible/pod-inventory
116 owner=maas
117 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -0800118 mode="0755"
David K. Bainbridge7ae4f192016-09-29 09:01:38 -0700119
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. Bainbridge8b179042016-11-30 15:38:42 -0800127 mode="0755"
David K. Bainbridge7ae4f192016-09-29 09:01:38 -0700128 with_items:
129 - cord
130 - cord-harvest
131 - cord-prov
David K. Bainbridge058c3d62016-09-30 15:03:26 -0700132 - cord-switch
133 - cord-generate
David K. Bainbridgec4e0fc52016-11-14 12:03:35 -0800134 - cord-registry
David K. Bainbridge8b179042016-11-30 15:38:42 -0800135
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