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 # This script is based on https://docs.openstack.org/kolla-ansible/pike/user/quickstart.html
16 - name: Include variables
19 name: infra_deploy_vars
22 traffic_ip: "{{ item.interfaces[1].ip }}"
23 when: item.hostname == ansible_host
24 with_items: "{{ infra_deploy_vars.nodes }}"
26 - name: Get neutron iface
28 neutron_iface: "{{ item }}"
30 - hostvars[ansible_host]['ansible_' + item.replace('-', '_')].ipv4 is defined
31 - hostvars[ansible_host]['ansible_' + item.replace('-', '_')].ipv4.address is defined
32 - hostvars[ansible_host]['ansible_' + item.replace('-', '_')].ipv4.address == traffic_ip
33 with_items: "{{ hostvars[ansible_host].ansible_interfaces }}"
35 - name: Create a registry container
39 restart_policy: always
43 - name: Download and install Kolla
44 include_tasks: install_kolla.yml
46 - name: Configure Kolla
47 include_tasks: configure_kolla.yml
49 - name: Configure Open Stack
50 include_tasks: configure_openstack.yml
52 - name: Ramp up Open Stack
53 include_tasks: rampup_openstack.yml
55 - name: Update admin-openrc.sh
57 path: /etc/kolla/admin-openrc.sh
58 regexp: "{{ item.find }}"
59 line: "{{ item.add }}"
61 - { find: 'EXTERNAL_NETWORK', add: 'export EXTERNAL_NETWORK=public' }
62 - { find: 'OS_AUTH_TYPE', add: 'export OS_AUTH_TYPE=password' }
65 shell: cp /etc/kolla/admin-openrc.sh /tmp/admin-openrc.yaml
67 - name: Rework as env vars
69 path: /tmp/admin-openrc.yaml
70 regexp: 'export\s+(.*)=(.*)'
73 - name: Download OpenStack env file
75 src: /tmp/admin-openrc.yaml
80 file: /tmp/admin-openrc.yaml
83 - name: Re-assign IP address
84 shell: ip address show {{ neutron_iface }} | awk '/inet/ {print $2}'
85 when: neutron_iface is defined
89 ip addr del dev {{ neutron_iface }} {{ ip_netmask.stdout }} &&
90 ip addr add dev br-ex {{ infra_deploy_vars.networks[1].host_ip }}/{{ ip_netmask.stdout_lines[0].split('/')[1] }}
92 - neutron_iface is defined
93 - ip_netmask.stdout | length > 0
95 - name: Create external network
99 provider_physical_network: physnet1
100 provider_network_type: flat
102 - no_proxy: "{{ lookup('env', 'no_proxy') + ',' + ansible_host + ',' + hostvars[ansible_host].ansible_default_ipv4.address }}"
105 - name: Create sub-network
109 cidr: "{{ ip_netmask.stdout }}"
110 allocation_pool_start: "{{ infra_deploy_vars.networks[1].dhcp_ip_start }}"
111 allocation_pool_end: "{{ infra_deploy_vars.networks[1].dhcp_ip_stop }}"
112 gateway_ip: "{{ infra_deploy_vars.networks[1].host_ip }}"
115 - no_proxy: "{{ lookup('env', 'no_proxy') + ',' + ansible_host + ',' + hostvars[ansible_host].ansible_default_ipv4.address }}"
118 - name: Upload OpenStack env file to Yardstick VM
120 src: /etc/kolla/admin-openrc.sh
121 dest: '/tmp/admin-openrc.sh'
122 delegate_to: "{{ item }}"
123 when: "groups['yardstickG'] is defined"
125 - "{{ groups['yardstickG'] }}"