Configure CaaS SR-IOV and provider networks
[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 - name: Make sure nfs server is toren down before we start
30   hosts: baremetal-infra_hosts
31   tasks:
32     - include: baremetal-rm-nfs-server.yaml
33       when:
34         - hosts|count > 1
35         - reinitialized_nodes is not defined or (inventory_hostname not in reinitialized_nodes)
36
37 - name: NFS server setup
38   hosts: baremetal-infra_hosts
39   vars_files:
40     - "/etc/ansible/roles/baremetal_provision/defaults/main.yml"
41   tasks:
42     - include: baremetal-setup-nfs-server.yaml
43     - include: baremetal_setup_http.yml
44       when: hosts|count > 1
45
46 - name:  Setup NFS mount points on other controllers where Ironic conductor is running
47   hosts: ironic_conductor
48   gather_facts: False
49   tasks:
50     - include: baremetal-setup-nfs-mnt.yaml
51       when:
52         - installation_phase != "provisioning-started"
53         - hosts|count > 1
54         - reinitialized_nodes is not defined or (inventory_hostname not in reinitialized_nodes)
55
56 - name: Install baremetal nodes for this cloud infra
57   hosts: baremetal-nodes
58   gather_facts: False
59   max_fail_percentage: 20
60   # TODO: This is just to work around the unavailable ironic_service_adminurl variable
61   vars_files:
62     - /opt/openstack-ansible/inventory/group_vars/ironic_all.yml
63   roles:
64     - role: baremetal_provision
65       when: hosts|count > 1
66       delegate_to: localhost
67
68 - name:  Tear down NFS mount points on other controllers where Ironic conductor is running
69   hosts: ironic_conductor
70   gather_facts: False
71   tasks:
72     - include: baremetal-rm-nfs-mnt.yaml
73       when:
74         - installation_phase != "provisioning-started"
75         - hosts|count > 1
76
77 - name: NFS server tear down
78   hosts: baremetal-infra_hosts
79   tasks:
80     - include: baremetal-rm-nfs-server.yaml
81     - include: baremetal_teardown_http.yml
82       when:
83         - hosts|count > 1