summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/config-controller
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/config-controller')
-rw-r--r--deploy/adapters/ansible/roles/config-controller/tasks/RedHat.yml75
-rw-r--r--deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml15
-rw-r--r--deploy/adapters/ansible/roles/config-controller/tasks/main.yml11
-rw-r--r--deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-mgmt7
-rw-r--r--deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-storage8
-rw-r--r--deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-vlan11
-rw-r--r--deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-vxlan6
-rw-r--r--deploy/adapters/ansible/roles/config-controller/templates/ifcfg-if.storage4
-rw-r--r--deploy/adapters/ansible/roles/config-controller/templates/ifcfg-if.vxlan4
9 files changed, 134 insertions, 7 deletions
diff --git a/deploy/adapters/ansible/roles/config-controller/tasks/RedHat.yml b/deploy/adapters/ansible/roles/config-controller/tasks/RedHat.yml
new file mode 100644
index 00000000..728dc559
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/tasks/RedHat.yml
@@ -0,0 +1,75 @@
+##############################################################################
+# 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
+##############################################################################
+---
+# yamllint disable rule:line-length
+- name: generate vxlan vlan ifcfg-if script
+ template:
+ src: ifcfg-if.vxlan
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}}
+
+- name: generate storage vlan ifcfg-if script
+ template:
+ src: ifcfg-if.storage
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}}
+
+- name: add br-vlan to interface script
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{ network_cfg["provider_net_mappings"][0]["interface"] }}
+ line: "BRIDGE=br-vlan"
+
+- name: add br-storage to interface script
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}}
+ line: "BRIDGE=br-storage"
+
+- name: add br-vxlan to interface script
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}}
+ line: "BRIDGE=br-vxlan"
+# yamllint enable rule:line-length
+
+- name: remove eth0 ip addresss
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-eth0
+ regexp: "^IPADDR=*"
+ state: absent
+
+- name: remove eth0 netmask
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-eth0
+ regexp: "^NETMASK=*"
+ state: absent
+
+- name: add br-mgmt to eth0 script
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-eth0
+ line: "BRIDGE=br-mgmt"
+
+- name: generate ifcfg-br-mgmt script
+ template:
+ src: ifcfg-br-mgmt
+ dest: /etc/sysconfig/network-scripts/
+
+- name: generate ifcfg-br-vlan script
+ template:
+ src: ifcfg-br-vlan
+ dest: /etc/sysconfig/network-scripts/
+
+- name: generate ifcfg-br-storag script
+ template:
+ src: ifcfg-br-storage
+ dest: /etc/sysconfig/network-scripts/
+
+- name: generate ifcfg-br-vxlan script
+ template:
+ src: ifcfg-br-vxlan
+ dest: /etc/sysconfig/network-scripts/
+
+- name: restart the network
+ shell: systemctl restart network
diff --git a/deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml b/deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml
new file mode 100644
index 00000000..53c2d502
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml
@@ -0,0 +1,15 @@
+##############################################################################
+# 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: configure controller network
+ template:
+ src: controller.j2
+ dest: /etc/network/interfaces
+ notify:
+ - restart network service
diff --git a/deploy/adapters/ansible/roles/config-controller/tasks/main.yml b/deploy/adapters/ansible/roles/config-controller/tasks/main.yml
index 54e4bf1e..674c80cc 100644
--- a/deploy/adapters/ansible/roles/config-controller/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/config-controller/tasks/main.yml
@@ -7,11 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-- name: configure controller network
- template:
- src: controller.j2
- dest: /etc/network/interfaces
- notify:
- - restart network service
+- include: "{{ ansible_distribution }}.yml"
+ when: ansible_distribution == 'Ubuntu'
-- meta: flush_handlers
+- include: "{{ ansible_os_family }}.yml"
+ when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7'
diff --git a/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-mgmt b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-mgmt
new file mode 100644
index 00000000..7f1931c8
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-mgmt
@@ -0,0 +1,7 @@
+DEVICE=br-mgmt
+TYPE=Bridge
+IPADDR={{host_info[inventory_hostname].MGMT_IP}}
+PREFIX=24
+BOOTPROTO=none
+ONBOOT=yes
+DELAY=0
diff --git a/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-storage b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-storage
new file mode 100644
index 00000000..3c1db126
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-storage
@@ -0,0 +1,8 @@
+DEVICE=br-storage
+TYPE=Bridge
+IPADDR={{ ip_settings[inventory_hostname]["storage"]["ip"] }}
+NETMASK=255.255.255.0
+BOOTPROTO=none
+DEFROUTE="no"
+ONBOOT=yes
+DELAY=0
diff --git a/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-vlan b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-vlan
new file mode 100644
index 00000000..7dd7165b
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-vlan
@@ -0,0 +1,11 @@
+DEVICE=br-vlan
+TYPE=Bridge
+IPADDR={{ ip_settings[inventory_hostname]["br-prv"]["ip"] }}
+PREFIX=24
+BOOTPROTO=none
+ONBOOT=yes
+DELAY=0
+DEFROUTE="yes"
+GATEWAY={{ ip_settings[inventory_hostname]["br-prv"]["gw"] }}
+DNS1=8.8.8.8
+DNS2=8.8.4.4
diff --git a/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-vxlan b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-vxlan
new file mode 100644
index 00000000..d672919c
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-br-vxlan
@@ -0,0 +1,6 @@
+DEVICE=br-vxlan
+TYPE=Bridge
+BOOTPROTO=none
+DEFROUTE="no"
+ONBOOT=yes
+DELAY=0
diff --git a/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-if.storage b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-if.storage
new file mode 100644
index 00000000..96afb1bd
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-if.storage
@@ -0,0 +1,4 @@
+DEVICE={{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}}
+BOOTPROTO=none
+ONBOOT=yes
+VLAN=yes
diff --git a/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-if.vxlan b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-if.vxlan
new file mode 100644
index 00000000..9fb19b0c
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/templates/ifcfg-if.vxlan
@@ -0,0 +1,4 @@
+DEVICE={{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}}
+BOOTPROTO=none
+ONBOOT=yes
+VLAN=yes