blob: 31c973d9ee7a74abee7cf61835e03530b15e17f8 [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
David K. Bainbridge915105d2016-07-06 14:10:08 -0700102- name: Ensure Dynamic Inventory Script
103 become: yes
104 template:
Scott Bakerb2b7fd92016-11-01 16:01:38 -0700105 src=templates/pod-inventory
David K. Bainbridge915105d2016-07-06 14:10:08 -0700106 dest=/etc/maas/ansible/pod-inventory
107 owner=maas
108 group=maas
David K. Bainbridge8b179042016-11-30 15:38:42 -0800109 mode="0755"
David K. Bainbridge7ae4f192016-09-29 09:01:38 -0700110
111- name: Copy CORD Utility Scripts
112 become: yes
113 copy:
114 src=files/commands/{{ item }}
115 dest=/usr/local/bin/{{ item }}
116 owner=root
117 group=root
David K. Bainbridge8b179042016-11-30 15:38:42 -0800118 mode="0755"
David K. Bainbridge7ae4f192016-09-29 09:01:38 -0700119 with_items:
120 - cord
121 - cord-harvest
122 - cord-prov
David K. Bainbridge058c3d62016-09-30 15:03:26 -0700123 - cord-switch
124 - cord-generate
David K. Bainbridgec4e0fc52016-11-14 12:03:35 -0800125 - cord-registry
David K. Bainbridge8b179042016-11-30 15:38:42 -0800126
127- name: Ensure SSH Key Storage
128 become: yes
129 file:
130 path: /etc/maas/.ssh
131 mode: "0755"
132 owner: maas
133 group: maas
134 state: directory
135
136- name: Copy SSH Key Pair for POD
137 become: yes
138 copy:
David K. Bainbridge0a7cdbb2017-07-14 11:36:13 -0700139 src: "{{pub_ssh_key_file_location}}/{{item}}"
David K. Bainbridge8b179042016-11-30 15:38:42 -0800140 dest: /etc/maas/.ssh/{{item}}
141 owner: maas
142 group: maas
143 mode: "0644"
144 with_items:
145 - cord_rsa
146 - cord_rsa.pub