blob: 3aaec1777a72e6b4c92fe3922f97af33411f8406 [file] [log] [blame]
Jonathan Hart93956f52017-08-22 13:12:42 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
David K. Bainbridgeed101542016-05-18 20:26:15 -070017- name: Ensure MAAS Ansible Config Directory
18 become: yes
19 file:
20 path=/etc/maas/ansible
21 owner=maas
22 group=maas
23 state=directory
David K. Bainbridge8b179042016-11-30 15:38:42 -080024 mode="0755"
David K. Bainbridgeed101542016-05-18 20:26:15 -070025
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070026- name: Ensure Ansible Roles
David K. Bainbridgeed101542016-05-18 20:26:15 -070027 become: yes
David K. Bainbridge5b4dafa2016-11-22 15:48:19 -080028 synchronize:
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070029 src: "{{ item }}"
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070030 dest: /etc/maas/ansible
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070031 with_items:
32 - roles
33 - library
David K. Bainbridgeed101542016-05-18 20:26:15 -070034
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070035- name: Ensure Role Permissions and Modes
David K. Bainbridgee18f57b2016-05-23 15:40:58 -070036 become: yes
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070037 file:
David K. Bainbridge141d2ab2016-08-26 13:02:33 -070038 path: /etc/maas/ansible/roles
David K. Bainbridge5ba01a92016-08-16 14:58:31 -070039 owner: maas
40 group: maas
41 mode: u=rwX,g=rX,o=rX
42 state: directory
43 recurse: true
David K. Bainbridgeed101542016-05-18 20:26:15 -070044
David K. Bainbridge0820cab2016-06-02 17:43:32 -070045- name: Ensure Ansible Provisioning Script
46 become: yes
47 copy:
David K. Bainbridgebe58a0d2016-06-22 15:43:02 -070048 dest=/etc/maas/ansible/{{ item }}
49 src=files/{{ item }}
David K. Bainbridge0820cab2016-06-02 17:43:32 -070050 owner=maas
51 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -080052 mode="0755"
David K. Bainbridgebe58a0d2016-06-22 15:43:02 -070053 with_items:
54 - do-ansible
55 - do-switch
David K. Bainbridge0820cab2016-06-02 17:43:32 -070056
57- name: Ensure Provisioning Log Directory
58 become: yes
59 file:
60 path=/etc/maas/ansible/logs
61 state=directory
62 owner=maas
63 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -080064 mode="0755"
David K. Bainbridge0820cab2016-06-02 17:43:32 -070065
David K. Bainbridge915105d2016-07-06 14:10:08 -070066- name: Capture MAAS API Key
67 become: yes
68 command: maas-region-admin apikey --username={{ maas.user }}
69 register: apikey
70 changed_when: false
71
Charles Chan3c681622016-08-03 21:53:03 -070072- name: Ensure Compute and Switch Node Playbooks
David K. Bainbridgeed101542016-05-18 20:26:15 -070073 become: yes
David K. Bainbridge10b0c112016-05-24 13:17:23 -070074 template:
David K. Bainbridge96c77e82016-11-07 14:59:43 -080075 src={{ item }}.j2
David K. Bainbridgebe58a0d2016-06-22 15:43:02 -070076 dest=/etc/maas/ansible/{{ item }}
David K. Bainbridgeed101542016-05-18 20:26:15 -070077 owner=maas
78 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -080079 mode="0644"
David K. Bainbridgebe58a0d2016-06-22 15:43:02 -070080 with_items:
81 - compute-node.yml
82 - switch-node.yml
Charles Chan3c681622016-08-03 21:53:03 -070083
David K. Bainbridge906a9a12016-08-25 10:50:45 -070084- name: Ensure Compute and Switch Variable Directory
85 become: yes
86 file:
87 path=/etc/maas/ansible/vars
88 owner=maas
89 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -080090 mode="0755"
David K. Bainbridge906a9a12016-08-25 10:50:45 -070091 state=directory
92
93- name: Ensure Compute and Switch Node Variables
94 become: yes
95 template:
Scott Bakerb2b7fd92016-11-01 16:01:38 -070096 src=templates/compute-node-vars.yml.j2
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070097 dest=/etc/maas/ansible/vars/compute-node-vars.yml
David K. Bainbridge906a9a12016-08-25 10:50:45 -070098 owner=maas
99 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -0800100 mode="0644"
David K. Bainbridge906a9a12016-08-25 10:50:45 -0700101
Charles Chan3c681622016-08-03 21:53:03 -0700102- name: Ensure Connect Switch Ansible Playbook
103 become: yes
104 copy:
105 dest=/etc/maas/ansible/{{ item }}
106 src=files/{{ item }}
107 owner=maas
108 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -0800109 mode="0644"
Charles Chan3c681622016-08-03 21:53:03 -0700110 with_items:
Charles Chana4ccbde2016-08-02 00:12:34 -0700111 - connect-switch.yml
David K. Bainbridge915105d2016-07-06 14:10:08 -0700112
113- name: Ensure Dynamic Inventory Script
114 become: yes
115 template:
Scott Bakerb2b7fd92016-11-01 16:01:38 -0700116 src=templates/pod-inventory
David K. Bainbridge915105d2016-07-06 14:10:08 -0700117 dest=/etc/maas/ansible/pod-inventory
118 owner=maas
119 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -0800120 mode="0755"
David K. Bainbridge7ae4f192016-09-29 09:01:38 -0700121
122- name: Copy CORD Utility Scripts
123 become: yes
124 copy:
125 src=files/commands/{{ item }}
126 dest=/usr/local/bin/{{ item }}
127 owner=root
128 group=root
David K. Bainbridge8b179042016-11-30 15:38:42 -0800129 mode="0755"
David K. Bainbridge7ae4f192016-09-29 09:01:38 -0700130 with_items:
131 - cord
132 - cord-harvest
133 - cord-prov
David K. Bainbridge058c3d62016-09-30 15:03:26 -0700134 - cord-switch
135 - cord-generate
David K. Bainbridgec4e0fc52016-11-14 12:03:35 -0800136 - cord-registry
David K. Bainbridge8b179042016-11-30 15:38:42 -0800137
138- name: Ensure SSH Key Storage
139 become: yes
140 file:
141 path: /etc/maas/.ssh
142 mode: "0755"
143 owner: maas
144 group: maas
145 state: directory
146
147- name: Copy SSH Key Pair for POD
148 become: yes
149 copy:
David K. Bainbridge0a7cdbb2017-07-14 11:36:13 -0700150 src: "{{pub_ssh_key_file_location}}/{{item}}"
David K. Bainbridge8b179042016-11-30 15:38:42 -0800151 dest: /etc/maas/.ssh/{{item}}
152 owner: maas
153 group: maas
154 mode: "0644"
155 with_items:
156 - cord_rsa
157 - cord_rsa.pub