Initial commit
[ta/infra-ansible.git] / playbooks / baremetal-install.yml
1 # cmframework.requires: enable_provisioning_in_iptables.yml,hasdisablerecovery.yml,remove_node_from_barematel.yml
2 ---
3
4 # Copyright 2019 Nokia
5
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18
19 - name:  Make sure to remove leftover NFS mount points on other controllers where Ironic conductor is running
20   hosts: ironic_conductor
21   gather_facts: False
22   tasks:
23     - include: baremetal-rm-nfs-mnt.yaml
24       when:
25         - installation_phase != "provisioning-started"
26         - hosts|count > 1
27         - reinitialized_nodes is not defined or (inventory_hostname not in reinitialized_nodes)
28
29
30 - name: Make sure nfs server is toren down before we start
31   hosts: baremetal-infra_hosts
32   tasks:
33     - include: baremetal-rm-nfs-server.yaml
34       when:
35         - hosts|count > 1
36         - reinitialized_nodes is not defined or (inventory_hostname not in reinitialized_nodes)
37
38 - name: NFS server setup
39   hosts: baremetal-infra_hosts
40   tasks:
41     - include: baremetal-setup-nfs-server.yaml
42       when: hosts|count > 1
43
44 - name:  Setup NFS mount points on other controllers where Ironic conductor is running
45   hosts: ironic_conductor
46   gather_facts: False
47   tasks:
48     - include: baremetal-setup-nfs-mnt.yaml
49       when:
50         - installation_phase != "provisioning-started"
51         - hosts|count > 1
52         - reinitialized_nodes is not defined or (inventory_hostname not in reinitialized_nodes)
53
54 - name: Install baremetal nodes for this cloud infra
55   hosts: baremetal-infra_hosts
56   gather_facts: "{{ gather_facts | default(True) }}"
57   max_fail_percentage: 20
58   roles:
59     - role: baremetal_provision
60       when: hosts|count > 1
61
62 - name:  Tear down NFS mount points on other controllers where Ironic conductor is running
63   hosts: ironic_conductor
64   gather_facts: False
65   tasks:
66     - include: baremetal-rm-nfs-mnt.yaml
67       when:
68         - installation_phase != "provisioning-started"
69         - hosts|count > 1
70
71 - name: NFS server tear down
72   hosts: baremetal-infra_hosts
73   tasks:
74     - include: baremetal-rm-nfs-server.yaml
75       when:
76         - hosts|count > 1