1 # Copyright (c) 2018 Intel Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 - name: Include input file
18 name: infra_deploy_vars
20 - name: Install setuptools
22 name: python-setuptools
25 shell: easy_install pip
26 environment: "{{ proxy_env }}"
28 - name: Install dependency for dns dig
34 block_str: "{{ block_str | default('') + item.interfaces[0].ip + ' ' + item.hostname + '\n'}}"
35 with_items: "{{ infra_deploy_vars.nodes }}"
37 - name: Delete hosts between markers
40 marker: "# {mark} generated hosts file"
43 - name: Update /etc/hosts
48 marker: "# {mark} generated hosts file"
50 - name: Clear known hosts
52 ssh-keygen -f /root/.ssh/known_hosts -R "{{ item.interfaces[0].ip }}";
53 ssh-keygen -f /root/.ssh/known_hosts -R "{{ item.hostname }}"
54 with_items: "{{ infra_deploy_vars.nodes }}"
57 controllers: "{{ controllers | default([]) + [item.hostname] }}"
59 - item.openstack_node is defined
60 - item.openstack_node == 'controller'
61 with_items: "{{ infra_deploy_vars.nodes }}"
63 - name: Add host controller as deploy
65 hostname: "{{ item.hostname }}"
66 host_ip: "{{ item.interfaces[0].ip }}"
67 groups: deploy, ostack
68 ansible_host: "{{ item.hostname }}"
69 ansible_user: "{{ item.user }}"
70 ansible_ssh_pass: "{{ item.password }}"
71 node_type: "{{ item.openstack_node }}"
72 secondary_ip: "{{ item.interfaces[1].ip }}"
73 when: item.hostname == controllers[0]
74 with_items: "{{ infra_deploy_vars.nodes }}"
76 - name: Add hosts others as controller, compute
78 hostname: "{{ item.hostname }}"
79 host_ip: "{{ item.interfaces[0].ip }}"
80 groups: regular,ostack
81 ansible_host: "{{ item.hostname }}"
82 ansible_user: "{{ item.user }}"
83 ansible_ssh_pass: "{{ item.password }}"
84 node_type: "{{ item.openstack_node }}"
85 secondary_ip: "{{ item.interfaces[1].ip }}"
87 - item.openstack_node is defined
88 - item.openstack_node == 'controller' or item.openstack_node == 'compute'
89 - item.hostname != controllers[0]
90 with_items: "{{ infra_deploy_vars.nodes }}"
92 - name: Add yardstick host to group
94 hostname: "{{ item.hostname }}"
95 host_ip: "{{ item.interfaces[0].ip }}"
97 ansible_host: "{{ item.hostname }}"
98 ansible_user: "{{ item.user }}"
99 ansible_ssh_pass: "{{ item.password }}"
100 secondary_ip: "{{ item.interfaces[1].ip }}"
101 when: item.hostname == 'yardstickvm'
102 with_items: "{{ infra_deploy_vars.nodes }}"