aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-07-25 17:01:04 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2017-08-11 15:06:29 +0800
commit02708db0054bcabf4db151d4b364d70ecc44ef18 (patch)
tree927dca85b79e918ce30d1f96f6c8bd09079777fa /deploy/adapters
parent58f021096b8c7969bcbbc9e06934f0718b71a2b9 (diff)
Adapt network.yml to OpenStack Ansible
JIRA:COMPASS-557 1. modify sys_intf_mappings and ip_settings in network.yml to synchronize with OSA network. networks compass build will be mgmt, external, tenant, storage. 2. modify compass_conf to support new netwok.yml 3. fix some hard coding when transfer ip parameters 4. support heterogeneous network Change-Id: Ib4a8af1f96a40e6456242e3dc2b456e0c8c17c2e Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'deploy/adapters')
-rw-r--r--deploy/adapters/ansible/roles/config-compute/templates/compute.j286
-rwxr-xr-xdeploy/adapters/ansible/roles/config-controller/templates/controller.j275
-rw-r--r--deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml2
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j231
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j24
-rw-r--r--deploy/adapters/ansible/roles/post-openstack/tasks/main.yml4
-rw-r--r--deploy/adapters/ansible/roles/post-openstack/vars/main.yml1
7 files changed, 121 insertions, 82 deletions
diff --git a/deploy/adapters/ansible/roles/config-compute/templates/compute.j2 b/deploy/adapters/ansible/roles/config-compute/templates/compute.j2
index 66c3297b..c53708ec 100644
--- a/deploy/adapters/ansible/roles/config-compute/templates/compute.j2
+++ b/deploy/adapters/ansible/roles/config-compute/templates/compute.j2
@@ -5,21 +5,42 @@
auto lo
iface lo inet loopback
-
# Physical interface
auto eth0
iface eth0 inet manual
+# external interface
+{% set intf_external = sys_intf_mappings["external"]["interface"] %}
+{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
+{% set intf_external = intf_external + '.' + sys_intf_mappings["external"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_external }}
+iface {{ intf_external }} inet manual
+{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
+ vlan-raw-device {{ intf_external }}
+{% endif %}
-# OpenStack Networking VXLAN (tunnel/overlay) VLAN interface
-auto {{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}}
-iface {{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}} inet manual
- vlan-raw-device {{sys_intf_mappings["mgmt"]["interface"]}}
+# tenant interface
+{% set intf_tenant = sys_intf_mappings["tenant"]["interface"] %}
+{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
+{% set intf_tenant = intf_tenant + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_tenant }}
+iface {{ intf_tenant }} inet manual
+{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
+ vlan-raw-device {{ intf_tenant }}
+{% endif %}
-# Storage network VLAN interface (optional)
-auto {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}}
-iface {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}} inet manual
- vlan-raw-device {{sys_intf_mappings["storage"]["interface"]}}
+# storage interface
+{% set intf_storage = sys_intf_mappings["storage"]["interface"] %}
+{% if sys_intf_mappings["storage"]["interface"] != "None" %}
+{% set intf_storage = intf_storage + '.' + sys_intf_mappings["storage"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_storage }}
+iface {{ intf_storage }} inet manual
+{% if sys_intf_mappings["storage"]["interface"] != "None" %}
+ vlan-raw-device {{ intf_storage }}
+{% endif %}
# Container/Host management bridge
auto br-mgmt
@@ -28,29 +49,19 @@ iface br-mgmt inet static
bridge_waitport 0
bridge_fd 0
bridge_ports eth0
- address {{host_info[inventory_hostname].MGMT_IP}}
+ address {{ ip_settings[inventory_hostname]["mgmt"]["ip"] }}
netmask 255.255.255.0
-# compute1 VXLAN (tunnel/overlay) bridge config
-auto br-vxlan
-iface br-vxlan inet static
- bridge_stp off
- bridge_waitport 0
- bridge_fd 0
- bridge_ports {{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}}
- address {{host_info[inventory_hostname].VXLAN_IP}}
- netmask 255.255.252.0
-
# OpenStack Networking VLAN bridge
-auto br-vlan
-iface br-vlan inet static
+auto br-external
+iface br-external inet static
bridge_stp off
bridge_waitport 0
bridge_fd 0
- bridge_ports {{ network_cfg["provider_net_mappings"][0]["interface"] }}
- address {{ip_settings[inventory_hostname]["br-prv"]["ip"]}}
+ bridge_ports {{ intf_external }}
+ address {{ ip_settings[inventory_hostname]["external"]["ip"] }}
netmask 255.255.255.0
- gateway {{ip_settings[inventory_hostname]["br-prv"]["gw"]}}
+ gateway {{ ip_settings[inventory_hostname]["external"]["gw"] }}
offload-sg off
# Create veth pair, don't bomb if already exists
pre-up ip link add br-vlan-veth type veth peer name eth12 || true
@@ -61,21 +72,22 @@ iface br-vlan inet static
post-down ip link del br-vlan-veth || true
bridge_ports br-vlan-veth
-# Add an additional address to br-vlan
-iface br-vlan inet static
- # Flat network default gateway
- # -- This needs to exist somewhere for network reachability
- # -- from the router namespace for floating IP paths.
- # -- Putting this here is primarily for tempest to work.
- address {{host_info[inventory_hostname].VLAN_IP_SECOND}}
- netmask 255.255.252.0
+# VXLAN (tunnel/overlay) bridge config
+auto br-tenant
+iface br-tenant inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports {{ intf_tenant }}
+ address {{ ip_settings[inventory_hostname]["tenant"]["ip"] }}
+ netmask 255.255.255.0
-# compute storage bridge
+# storage bridge
auto br-storage
iface br-storage inet static
bridge_stp off
bridge_waitport 0
bridge_fd 0
- bridge_ports {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}}
- address {{ip_settings[inventory_hostname]["storage"]["ip"]}}
- netmask 255.255.252.0
+ bridge_ports {{ intf_storage }}
+ address {{ ip_settings[inventory_hostname]["storage"]["ip"] }}
+ netmask 255.255.255.0
diff --git a/deploy/adapters/ansible/roles/config-controller/templates/controller.j2 b/deploy/adapters/ansible/roles/config-controller/templates/controller.j2
index 215807f0..2aeb9a04 100755
--- a/deploy/adapters/ansible/roles/config-controller/templates/controller.j2
+++ b/deploy/adapters/ansible/roles/config-controller/templates/controller.j2
@@ -9,15 +9,38 @@ iface lo inet loopback
auto eth0
iface eth0 inet manual
-# OpenStack Networking VXLAN (tunnel/overlay) VLAN interface
-auto {{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}}
-iface {{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}} inet manual
- vlan-raw-device {{sys_intf_mappings["mgmt"]["interface"]}}
+# external interface
+{% set intf_external = sys_intf_mappings["external"]["interface"] %}
+{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
+{% set intf_external = intf_external + '.' + sys_intf_mappings["external"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_external }}
+iface {{ intf_external }} inet manual
+{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
+ vlan-raw-device {{ intf_external }}
+{% endif %}
-# Storage network VLAN interface (optional)
-auto {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}}
-iface {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}} inet manual
- vlan-raw-device {{sys_intf_mappings["storage"]["interface"]}}
+# tenant interface
+{% set intf_tenant = sys_intf_mappings["tenant"]["interface"] %}
+{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
+{% set intf_tenant = intf_tenant + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_tenant }}
+iface {{ intf_tenant }} inet manual
+{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
+ vlan-raw-device {{ intf_tenant }}
+{% endif %}
+
+# storage interface
+{% set intf_storage = sys_intf_mappings["storage"]["interface"] %}
+{% if sys_intf_mappings["storage"]["interface"] != "None" %}
+{% set intf_storage = intf_storage + '.' + sys_intf_mappings["storage"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_storage }}
+iface {{ intf_storage }} inet manual
+{% if sys_intf_mappings["storage"]["interface"] != "None" %}
+ vlan-raw-device {{ intf_storage }}
+{% endif %}
# Container/Host management bridge
auto br-mgmt
@@ -26,8 +49,19 @@ iface br-mgmt inet static
bridge_waitport 0
bridge_fd 0
bridge_ports eth0
- address {{host_info[inventory_hostname].MGMT_IP}}
+ address {{ ip_settings[inventory_hostname]["mgmt"]["ip"] }}
+ netmask 255.255.255.0
+
+# OpenStack Networking VLAN bridge
+auto br-external
+iface br-external inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports {{ intf_external }}
+ address {{ ip_settings[inventory_hostname]["external"]["ip"] }}
netmask 255.255.255.0
+ gateway {{ ip_settings[inventory_hostname]["external"]["gw"] }}
# OpenStack Networking VXLAN (tunnel/overlay) bridge
#
@@ -36,30 +70,19 @@ iface br-mgmt inet static
# IP addresses are assigned to containers which use this
# bridge.
#
-auto br-vxlan
-iface br-vxlan inet manual
+auto br-tenant
+iface br-tenant inet manual
bridge_stp off
bridge_waitport 0
bridge_fd 0
- bridge_ports {{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}}
+ bridge_ports {{ intf_tenant }}
-# OpenStack Networking VLAN bridge
-auto br-vlan
-iface br-vlan inet static
- bridge_stp off
- bridge_waitport 0
- bridge_fd 0
- bridge_ports {{ network_cfg["provider_net_mappings"][0]["interface"] }}
- address {{ ip_settings[inventory_hostname]["br-prv"]["ip"] }}
- netmask 255.255.255.0
- gateway {{ ip_settings[inventory_hostname]["br-prv"]["gw"] }}
-
-# compute1 Storage bridge
+# Storage bridge
auto br-storage
iface br-storage inet static
bridge_stp off
bridge_waitport 0
bridge_fd 0
- bridge_ports {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}}
+ bridge_ports {{ intf_storage }}
address {{ ip_settings[inventory_hostname]["storage"]["ip"] }}
- netmask 255.255.252.0
+ netmask 255.255.255.0
diff --git a/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml b/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml
index 9f65cd5d..e906ed45 100644
--- a/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml
+++ b/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml
@@ -32,7 +32,7 @@
dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini
regexp: '^bridge_mappings'
insertafter: '^bridge_mappings'
- line: "local_ip = {{hostvars[inventory_hostname]['ansible_br_vxlan']['ipv4']['address']}}"
+ line: "local_ip = {{hostvars[inventory_hostname]['ansible_br_tenant']['ipv4']['address']}}"
notify:
- Restart neutron-openvswitch-agent
when:
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 2a24113b..d69674f2 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
@@ -1,20 +1,25 @@
---
cidr_networks:
- container: 10.1.0.0/24
- tunnel: 172.29.240.0/22
- storage: 172.16.2.0/24
+ container: {{ mgmt_cidr }}
+ tunnel: {{ tenant_cidr }}
+ storage: {{ storage_cidr }}
used_ips:
- - "10.1.0.1,10.1.0.55"
- - "10.1.0.100,10.1.0.110"
- - "172.29.240.1,172.29.240.50"
- - "172.16.2.1,172.16.2.50"
- - "172.29.248.1,172.29.248.50"
+{% for item in network_cfg["ip_settings"] %}
+ - "{{ ','.join(item["ip_ranges"][0]) }}"
+{% if item["name"] == "mgmt" %}
+ - "{{ ','.join(item["dhcp_ranges"][0]) }}"
+{% endif %}
+{% if "gw" in item %}
+ - "{{ item["gw"] }}"
+{% endif %}
+{% endfor %}
+ - "{{ internal_vip.ip }}"
global_overrides:
- internal_lb_vip_address: 10.1.0.22
+ internal_lb_vip_address: {{ internal_vip.ip }}
external_lb_vip_address: {{ public_vip.ip }}
- tunnel_bridge: "br-vxlan"
+ tunnel_bridge: "br-tenant"
management_bridge: "br-mgmt"
provider_networks:
- network:
@@ -29,7 +34,7 @@ global_overrides:
is_container_address: true
is_ssh_address: true
- network:
- container_bridge: "br-vxlan"
+ container_bridge: "br-tenant"
container_type: "veth"
container_interface: "eth10"
ip_from_q: "tunnel"
@@ -43,7 +48,7 @@ global_overrides:
- neutron_openvswitch_agent
{% endif %}
- network:
- container_bridge: "br-vlan"
+ container_bridge: "br-external"
container_type: "veth"
container_interface: "eth12"
host_bind_override: "eth12"
@@ -56,7 +61,7 @@ global_overrides:
- neutron_openvswitch_agent
{% endif %}
- network:
- container_bridge: "br-vlan"
+ container_bridge: "br-external"
container_type: "veth"
container_interface: "eth11"
type: "vlan"
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 7f29d5fe..2b4a959a 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
@@ -22,8 +22,8 @@
debug: false
haproxy_keepalived_external_vip_cidr: "{{ public_vip.ip }}/32"
-haproxy_keepalived_internal_vip_cidr: "10.1.0.22/32"
-haproxy_keepalived_external_interface: br-vlan
+haproxy_keepalived_internal_vip_cidr: "{{ internal_vip.ip }}/32"
+haproxy_keepalived_external_interface: br-external
haproxy_keepalived_internal_interface: br-mgmt
keepalived_ping_address: "{{ ntp_server }}"
diff --git a/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml b/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml
index 10d8f727..6a8299d6 100644
--- a/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml
@@ -31,8 +31,8 @@
- name: replace internalURL with publicURL in openrc
replace:
dest: /opt/openrc
- regexp: "{{internal_vip}}"
- replace: "{{ public_vip['ip']}}"
+ regexp: "{{ internal_vip['ip'] }}"
+ replace: "{{ public_vip['ip'] }}"
- name: change the endpoint type
replace:
diff --git a/deploy/adapters/ansible/roles/post-openstack/vars/main.yml b/deploy/adapters/ansible/roles/post-openstack/vars/main.yml
index 19d9e225..d9c36d42 100644
--- a/deploy/adapters/ansible/roles/post-openstack/vars/main.yml
+++ b/deploy/adapters/ansible/roles/post-openstack/vars/main.yml
@@ -7,7 +7,6 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-internal_vip: "10.1.0.22"
flavors:
- id: 0
name: m1.nano