aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/config-osa
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/config-osa')
-rw-r--r--deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml28
-rw-r--r--deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml17
-rw-r--r--deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml45
-rw-r--r--deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml64
-rwxr-xr-xdeploy/adapters/ansible/roles/config-osa/tasks/main.yml25
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j215
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j241
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j258
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j218
9 files changed, 48 insertions, 263 deletions
diff --git a/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml b/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml
deleted file mode 100644
index 346ef2fd..00000000
--- a/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-# #############################################################################
-# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-# #############################################################################
----
-- name: Fetch openrc
- hosts: utility_all[0]
- max_fail_percentage: 20
- user: root
- tasks:
- - fetch:
- src: /root/openrc
- dest: /opt/openrc
- flat: "yes"
-
-- name: Fetch haproxy.cert
- hosts: haproxy_hosts[0]
- max_fail_percentage: 20
- user: root
- tasks:
- - fetch:
- src: /etc/ssl/certs/haproxy.cert
- dest: /opt/os_cacert
- flat: "yes"
diff --git a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml b/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml
deleted file mode 100644
index 03b57120..00000000
--- a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
----
-
-- name: create openstack flavors
- shell: |
- . /root/openrc;
- openstack flavor create {{ item.name }} \
- --id {{ item.id }} --ram {{ item.ram }} \
- --disk {{ item.disk }} --vcpus {{ item.vcpus }} || true
- with_items: "{{ flavors }}"
diff --git a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml b/deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml
deleted file mode 100644
index d9c36d42..00000000
--- a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml
+++ /dev/null
@@ -1,45 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
----
-flavors:
- - id: 0
- name: m1.nano
- vcpus: 1
- ram: 64
- disk: 1
-
- - id: 1
- name: m1.tiny
- vcpus: 1
- ram: 512
- disk: 1
-
- - id: 2
- name: m1.small
- vcpus: 1
- ram: 2048
- disk: 20
-
- - id: 3
- name: m1.medium
- vcpus: 2
- ram: 4096
- disk: 40
-
- - id: 4
- name: m1.large
- vcpus: 4
- ram: 8192
- disk: 80
-
- - id: 5
- name: m1.xlarge
- vcpus: 8
- ram: 16384
- disk: 160
diff --git a/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml b/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml
deleted file mode 100644
index ed631036..00000000
--- a/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml
+++ /dev/null
@@ -1,64 +0,0 @@
-# #############################################################################
-# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-# #############################################################################
----
-- name: Installation and setup of Neutron
- hosts: neutron_openvswitch_agent
- gather_facts: "{{ gather_facts | default(True) }}"
- max_fail_percentage: 20
- user: root
- tasks:
- - name: stop neutron-openvswitch-agent
- service:
- name: neutron-openvswitch-agent
- state: stopped
-
- # yamllint disable rule:line-length
- - name: change the openvswitch_agent.ini
- lineinfile:
- dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini
- insertafter: '^bridge_mappings'
- line: "local_ip = {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }}"
- when:
- - inventory_hostname not in groups['nova_compute']
-
- - name: change the openvswitch_agent.ini
- lineinfile:
- dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini
- state: absent
- regexp: '^bridge_mappings'
- notify:
- - Restart neutron-openvswitch-agent
- when:
- - inventory_hostname in groups['nova_compute']
- # yamllint enable rule:line-length
-
- - name: Setup br-provider
- openvswitch_bridge:
- bridge: br-provider
- state: present
- notify:
- - Restart neutron-openvswitch-agent
- when:
- - inventory_hostname not in groups['nova_compute']
-
- - name: Add port to br-provider
- openvswitch_port:
- bridge: br-provider
- port: "eth12"
- state: present
- notify:
- - Restart neutron-openvswitch-agent
- when:
- - inventory_hostname not in groups['nova_compute']
-
- handlers:
- - name: Restart neutron-openvswitch-agent
- service:
- name: neutron-openvswitch-agent
- state: restarted
diff --git a/deploy/adapters/ansible/roles/config-osa/tasks/main.yml b/deploy/adapters/ansible/roles/config-osa/tasks/main.yml
index 2cb79a94..139b426f 100755
--- a/deploy/adapters/ansible/roles/config-osa/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/config-osa/tasks/main.yml
@@ -224,31 +224,6 @@
src: ansible.cfg
dest: /opt/openstack-ansible/playbooks/
-- name: copy setup-ovs.yml
- copy:
- src: setup-ovs.yml
- dest: /opt/openstack-ansible/playbooks
-
-- name: copy flavor roles
- copy:
- src: os-flavor
- dest: /etc/ansible/roles/
-
-- name: generate create-network.yml
- template:
- src: create-network.yml.j2
- dest: /opt/openstack-ansible/playbooks/create-network.yml
-
-- name: generate create-flavor.yml
- template:
- src: create-flavor.yml.j2
- dest: /opt/openstack-ansible/playbooks/create-flavor.yml
-
-- name: copy fetch-files.yml
- copy:
- src: fetch-files.yml
- dest: /opt/openstack-ansible/playbooks/fetch-files.yml
-
- name: copy user_ceph.yml
copy:
src: user_ceph.yml
diff --git a/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2
deleted file mode 100644
index b33cd414..00000000
--- a/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2
+++ /dev/null
@@ -1,15 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
----
-- name: Create flavor
- hosts: utility_container[0]
- max_fail_percentage: 20
- user: root
- roles:
- - os-flavor
diff --git a/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2
deleted file mode 100644
index 301bf9da..00000000
--- a/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2
+++ /dev/null
@@ -1,41 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
----
-- name: Create external network
- hosts: utility_container[0]
- max_fail_percentage: 20
- user: root
- tasks:
- - name: create external net
- shell: |
- . /root/openrc;
- openstack network create --external \
- --provider-physical-network {{ public_net_info.provider_network }} \
- --provider-network-type {{ public_net_info.type }} {{ public_net_info.network }};
- when: {{ public_net_info.enable }} == True
- and "{{ public_net_info.type }}" == "flat"
-
- - name: create external net
- shell: |
- . /root/openrc;
- openstack network create --external \
- --network-segment {{ public_net_info.segment_id }} \
- --provider-network-type {{ public_net_info.type }} {{ public_net_info.network }};
- when: {{public_net_info.enable}} == True
- and "{{ public_net_info.type }}" != "flat"
-
- - name: create external subnet
- shell: |
- . /root/openrc;
- openstack subnet create --network "{{ public_net_info.network }}" \
- --allocation-pool \
- start={{ public_net_info.floating_ip_start }},end={{ public_net_info.floating_ip_end }} \
- --gateway "{{ public_net_info.external_gw }}" \
- --subnet-range "{{ public_net_info.floating_ip_cidr }}" \
- "{{ public_net_info.subnet }}"
diff --git a/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2
index d69674f2..cadf5308 100644
--- a/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2
+++ b/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2
@@ -15,7 +15,23 @@ used_ips:
{% endif %}
{% endfor %}
- "{{ internal_vip.ip }}"
+ - "{{ public_vip.ip }}"
+{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %}
+{% set neutron_agent = "neutron_linuxbridge_agent" %}
+{% else %}
+{% set neutron_agent = "neutron_openvswitch_agent" %}
+{% endif %}
+{% set provider_net_mappings = network_cfg["provider_net_mappings"] %}
+{% set public_net_info = network_cfg["public_net_info"] %}
+{% set ext_physnet = public_net_info["provider_network"] %}
+{% set ext_type = public_net_info["type"] %}
+{% set ext_intf = [] %}
+{% for item in provider_net_mappings %}
+{% if item["network"] == ext_physnet %}
+{% set _ = ext_intf.append(item["interface"]) %}
+{% endif %}
+{% endfor %}
global_overrides:
internal_lb_vip_address: {{ internal_vip.ip }}
external_lb_vip_address: {{ public_vip.ip }}
@@ -33,46 +49,40 @@ global_overrides:
- hosts
is_container_address: true
is_ssh_address: true
+{% if tenant_net_info["type"] == "vxlan" %}
- network:
container_bridge: "br-tenant"
container_type: "veth"
- container_interface: "eth10"
+ container_interface: "eth2"
ip_from_q: "tunnel"
type: "vxlan"
- range: "1:1000"
+ range: "{{ tenant_net_info["range"] }}"
net_name: "vxlan"
group_binds:
-{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %}
- - neutron_linuxbridge_agent
-{% else %}
- - neutron_openvswitch_agent
+ - {{ neutron_agent }}
{% endif %}
- network:
container_bridge: "br-external"
container_type: "veth"
- container_interface: "eth12"
- host_bind_override: "eth12"
- type: "flat"
- net_name: "{{ public_net_info.provider_network }}"
+ container_interface: "{{ ext_intf[0] }}"
+ host_bind_override: "{{ ext_intf[0] }}"
+ type: "{{ ext_type }}"
+ net_name: "{{ ext_physnet }}"
group_binds:
-{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %}
- - neutron_linuxbridge_agent
-{% else %}
- - neutron_openvswitch_agent
-{% endif %}
+ - {{ neutron_agent }}
+{% for item in provider_net_mappings %}
+{% if item["network"] != ext_physnet and "controller" in item["role"] %}
- network:
- container_bridge: "br-external"
+ container_bridge: "br-tenant"
container_type: "veth"
- container_interface: "eth11"
- type: "vlan"
- range: "1:1"
- net_name: "vlan"
+ container_interface: "{{ item["interface"] }}"
+ host_bind_override: "{{ item["interface"] }}"
+ type: "flat"
+ net_name: "{{ item["network"] }}"
group_binds:
-{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %}
- - neutron_linuxbridge_agent
-{% else %}
- - neutron_openvswitch_agent
+ - {{ neutron_agent }}
{% endif %}
+{% endfor %}
- network:
container_bridge: "br-storage"
container_type: "veth"
diff --git a/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2
index a6cefd71..e43aa22c 100644
--- a/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2
+++ b/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2
@@ -41,11 +41,21 @@ openstack_host_specific_kernel_modules:
neutron_plugin_type: ml2.ovs
-neutron_ml2_drivers_type: "local,flat,vlan,vxlan"
+neutron_ml2_drivers_type: "local,flat,{{ tenant_net_info['type'] }}"
neutron_provider_networks:
network_flat_networks: "*"
- network_types: "vxlan"
- network_vxlan_ranges: "1:1000"
- network_mappings: "physnet:br-provider"
+ network_types: "{{ tenant_net_info['type'] }}"
+{% if tenant_net_info["type"] == "vxlan" %}
+ network_vxlan_ranges: "{{ tenant_net_info['range'] }}"
+{% endif %}
+{% if tenant_net_info["type"] == "vlan" %}
+ network_vlan_ranges: "{{tenant_net_info['provider_network']}}:{{tenant_net_info['range']}}"
+{% endif %}
+{% set controller_mappings = [] %}
+{% for key, value in contr_prv_mappings.iteritems() %}
+{% set mapping = key + ":" + value["bridge"] %}
+{% set _ = controller_mappings.append(mapping) %}
+{% endfor %}
+ network_mappings: "{{ ','.join(controller_mappings) }}"
{% endif %}