aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/config-controller/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/config-controller/tasks')
-rw-r--r--deploy/adapters/ansible/roles/config-controller/tasks/RedHat.yml75
-rw-r--r--deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml34
-rw-r--r--deploy/adapters/ansible/roles/config-controller/tasks/main.yml14
3 files changed, 123 insertions, 0 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..e3b467cf
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml
@@ -0,0 +1,34 @@
+##############################################################################
+# 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
+
+- meta: flush_handlers
+
+- name: check apt source
+ shell: "ping -c 2 {{LOCAL_REPOSITORY_IP}} > /dev/null"
+ register: checkresult
+ ignore_errors: "true"
+
+- name: change sources list(apt)
+ template:
+ src: sources.list.lab
+ dest: /etc/apt/sources.list
+ when: checkresult.rc == 0
+
+- name: change sources list(apt)
+ template:
+ src: sources.list.official
+ dest: /etc/apt/sources.list
+ when: checkresult.rc != 0
diff --git a/deploy/adapters/ansible/roles/config-controller/tasks/main.yml b/deploy/adapters/ansible/roles/config-controller/tasks/main.yml
new file mode 100644
index 00000000..674c80cc
--- /dev/null
+++ b/deploy/adapters/ansible/roles/config-controller/tasks/main.yml
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+---
+- include: "{{ ansible_distribution }}.yml"
+ when: ansible_distribution == 'Ubuntu'
+
+- include: "{{ ansible_os_family }}.yml"
+ when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7'