From 92f6ca7bb6d7b2f295406aab34094b1dba76ff94 Mon Sep 17 00:00:00 2001 From: liyuenan Date: Tue, 27 Dec 2016 17:44:34 +0800 Subject: Yamllint test JIRA: COMPASS-516 Change-Id: I482ce9bc86f4f963258c5b8823e0b00e83556eef Signed-off-by: liyuenan --- .../ansible/roles/open-contrail/tasks/ext-net.yml | 47 --- .../tasks/install/install-collector.yml | 24 -- .../open-contrail/tasks/install/install-common.yml | 104 ------ .../tasks/install/install-compute.yml | 55 ---- .../open-contrail/tasks/install/install-config.yml | 51 --- .../tasks/install/install-control.yml | 32 -- .../tasks/install/install-database.yml | 25 -- .../tasks/install/install-interface.yml | 34 -- .../open-contrail/tasks/install/install-kernel.yml | 60 ---- .../open-contrail/tasks/install/install-webui.yml | 26 -- .../ansible/roles/open-contrail/tasks/main.yml | 151 --------- .../open-contrail/tasks/provision/-node-common.yml | 28 -- .../tasks/provision/-rabbitmq-stop.yml | 30 -- .../open-contrail/tasks/provision/-redis-setup.yml | 34 -- .../tasks/provision/-vrouter-compute-setup.yml | 115 ------- .../tasks/provision/provision-add-nodes.yml | 91 ------ .../tasks/provision/provision-collector.yml | 106 ------- .../tasks/provision/provision-compute.yml | 269 ---------------- .../tasks/provision/provision-config.yml | 350 --------------------- .../tasks/provision/provision-control.yml | 69 ---- .../tasks/provision/provision-database.yml | 209 ------------ .../tasks/provision/provision-increase-limits.yml | 60 ---- .../tasks/provision/provision-rabbitmq.yml | 87 ----- .../tasks/provision/provision-route.yml | 50 --- .../tasks/provision/provision-toragent.yml | 85 ----- .../tasks/provision/provision-tsn.yml | 104 ------ .../tasks/provision/provision-webui.yml | 75 ----- .../open-contrail/tasks/uninstall-openvswitch.yml | 46 --- 28 files changed, 2417 deletions(-) delete mode 100644 deploy/adapters/ansible/roles/open-contrail/tasks/ext-net.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-collector.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-common.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-compute.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-config.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-control.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-database.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-kernel.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/install/install-webui.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/main.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/-node-common.yml delete mode 100644 deploy/adapters/ansible/roles/open-contrail/tasks/provision/-rabbitmq-stop.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/-redis-setup.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/-vrouter-compute-setup.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-collector.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-config.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-control.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-database.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-increase-limits.yml delete mode 100644 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-toragent.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-tsn.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml delete mode 100755 deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml (limited to 'deploy/adapters/ansible/roles/open-contrail/tasks') diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/ext-net.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/ext-net.yml deleted file mode 100644 index 3ef327ee..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/ext-net.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- name: add ext-network router of vgw on controller for open-contrail - shell: > - ip route add {{ public_net_info.floating_ip_cidr }} via {{ ip_settings[groups['compute'][0]]['br-prv']['ip'] }} dev {{ network_cfg.public_vip.interface }} ; - echo "ip route add {{ public_net_info.floating_ip_cidr }} via {{ ip_settings[groups['compute'][0]]['br-prv']['ip'] }} dev {{ network_cfg.public_vip.interface }}" >> /opt/contrail/bin/if-vhost0 ; - when: inventory_hostname in groups['opencontrail'] - - -- name: create vgw for open-contrail - shell: > - echo "lsof -ni :9090 ; while [ $? -ne 0 ]; do sleep 10; lsof -ni :9090; done" >> /etc/init.d/net_init; - echo "sleep 10" >> /etc/init.d/net_init; - echo "python /opt/contrail/utils/provision_vgw_interface.py --oper create --interface vgw1 --subnets {{ public_net_info.floating_ip_cidr }} --routes 0.0.0.0/0 --vrf default-domain:admin:{{ public_net_info.network }}:{{ public_net_info.network }}" >> /etc/init.d/net_init; - when: groups['opencontrail']|length !=0 and inventory_hostname == groups['compute'][0] - - -- name: add vgw router on compute(without vgw) for open-contrail - shell: echo "ip route add {{ public_net_info.floating_ip_cidr }} via {{ ip_settings[groups['compute'][0]]['br-prv']['ip'] }} dev vhost0" >> /etc/init.d/net_init - when: groups['opencontrail']|length !=0 and inventory_hostname not in groups['opencontrail'] and inventory_hostname != groups['compute'][0] - - - - - -# create a file with vgw ip on CompassCore, so that Jumper Host could access this to get vgw ip -- name: add vgw file on compass - local_action: file path=/home/opencontrail1.rc state=touch mode=0777 - run_once: True - when: groups['opencontrail']|length !=0 - -- name: update vgw file - local_action: lineinfile dest=/home/opencontrail1.rc line={{ ip_settings[groups['compute'][0]]['br-prv']['ip'] }} - run_once: True - when: groups['opencontrail']|length !=0 - -- name: add vgw file on compass - local_action: file path=/home/opencontrail2.rc state=touch mode=0777 - run_once: True - when: groups['opencontrail']|length !=0 - -- name: update vgw file - local_action: lineinfile dest=/home/opencontrail2.rc line={{ public_net_info.floating_ip_cidr }} - run_once: True - when: groups['opencontrail']|length !=0 - - - diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-collector.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-collector.yml deleted file mode 100755 index d3022893..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-collector.yml +++ /dev/null @@ -1,24 +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 -############################################################################## ---- -#- hosts: collector -# sudo: yes -# tasks: - -- name: "temporary disable supervisor analytics" - template: -# src: "templates/override.j2" - src: "../../templates/install/override.j2" - dest: "/etc/init/supervisor-analytics.override" - -- name: "install contrail openstack analytics package" -# apt: -# name: "contrail-openstack-analytics" - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: collector_package diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-common.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-common.yml deleted file mode 100755 index e94621bc..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-common.yml +++ /dev/null @@ -1,104 +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 -############################################################################## ---- -#- hosts: all -# sudo: yes -# tasks: -#- name: "copy contrail install package temporary" -# sudo: True -# copy: -# src: "{{ package }}" -# dest: "/tmp/{{ package }}" - -- name: get image http server - shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf - register: http_server - -- name: download OpenContrail package file - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/open-contrail/{{ package }}" dest=/tmp/{{ package }} -#" - -- name: "install contrail install package" -# sudo: True - apt: - deb: "/tmp/{{ package }}" - force: yes - -- name: "delete temporary contrail install package" -# sudo: True - file: - dest: "/tmp/{{ package }}" - state: "absent" - -- name: "make directory for contrail binary files" -# sudo: True - file: - path: "/opt/contrail/bin" - state: "directory" - -- name: "make directory for contrail repository" -# sudo: True - file: - path: "/opt/contrail/contrail_install_repo" - state: "directory" - -- name: "unarchive contrail packages" -# sudo: True - unarchive: - src: "/opt/contrail/contrail_packages/contrail_debs.tgz" - dest: "/opt/contrail/contrail_install_repo" - copy: no - -- name: "find required packages in advance" -# sudo: True - shell: "find /opt/contrail/contrail_install_repo -name binutils_*.deb -or -name make_*.deb -or -name libdpkg-perl_*.deb -or -name dpkg-dev_*.deb -or -name patch_*.deb -type f" - register: required_packages - changed_when: no - -- name: "install required packages" -# sudo: True - apt: - deb: "{{ item }}" - force: yes - with_items: required_packages.stdout_lines - ignore_errors: True - -- name: modify source list -# sudo: True - lineinfile: - dest: "/etc/apt/sources.list" - line: "deb file:/opt/contrail/contrail_install_repo ./" - insertbefore: "BOF" - -- name: "modify apt configuration" -# sudo: True - lineinfile: - dest: "/etc/apt/apt.conf" - line: "APT::Get::AllowUnauthenticated \"true\";" - create: "yes" - -- name: "copy apt preferences file" -# sudo: True - shell: "cp /opt/contrail/contrail_packages/preferences /etc/apt/preferences" - args: - creates: "/etc/apt/preferences" - -- name: create contrail packages list -# sudo: True - shell: "dpkg-scanpackages . | gzip -9c > Packages.gz" - args: - chdir: "/opt/contrail/contrail_install_repo" - creates: "Packages.gz" - -- name: install contrail setup package - sudo: True - apt: - name: "contrail-setup" - update_cache: yes - force: yes diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-compute.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-compute.yml deleted file mode 100755 index 4e4a5ad5..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-compute.yml +++ /dev/null @@ -1,55 +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 -############################################################################## ---- -#- hosts: [compute, tsn] -# sudo: yes -# tasks: -- name: "temporary disable supervisor vrouter" -# sudo: True - template: - src: "../../templates/install/override.j2" - dest: "/etc/init/supervisor-vrouter.override" - -# - name: "install nova-compute for contrail package" -# apt: -# name: "nova-compute" -# when: install_nova - -- name: "install contrail vrouter 3.13.0-40 package" -# apt: -# name: "contrail-vrouter-3.13.0-40-generic" -# when: ansible_kernel == "3.13.0-40-generic" -# sudo: True - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: vrouter_package - when: ansible_kernel == kernel_required - -- name: "install contrail vrouter dkms package" -# apt: -# name: "contrail-vrouter-dkms" -# when: ansible_kernel != "3.13.0-40-generic" -# sudo: True - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: dkms_package - when: ansible_kernel != kernel_required - -# - name: "install contrail vrouter common package" -# apt: -# name: "contrail-vrouter-common" - -# - name: "install contrail nova vif package" -# apt: -# name: "contrail-nova-vif" - -- name: "install contrail vrouter common & nova vif package" -# sudo: True - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: compute_package | union(compute_package_noarch) - - diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-config.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-config.yml deleted file mode 100755 index b66e3e45..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-config.yml +++ /dev/null @@ -1,51 +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 -############################################################################## ---- -#- hosts: config -# sudo: yes -# tasks: -- name: "temporary disable supervisor config" -# sudo: True - template: -# src: "templates/override.j2" - src: "../../templates/install/override.j2" - dest: "/etc/init/supervisor-config.override" - -- name: "temporary disable neutron server" -# sudo: True - template: -# src: "templates/override.j2" - src: "../../templates/install/override.j2" - dest: "/etc/init/neutron-server.override" - -############################################### -################ workaround ################# -############################################### -- name: "backup keepalived conf" - shell: mv /etc/keepalived/keepalived.conf /home/keepalived.conf - -- name: "uninstall keepalived" - action: "{{ ansible_pkg_mgr }} name=keepalived state=absent" - -- name: "install iproute" - action: "{{ ansible_pkg_mgr }} name=iproute state=present" - -- name: "install iproute" - action: "{{ ansible_pkg_mgr }} name=keepalived state=present" - -- name: "restore keepalived conf" - shell: mv /home/keepalived.conf /etc/keepalived/keepalived.conf -############################################### - -- name: "install contrail openstack config package" -# sudo: True -# apt: -# name: "contrail-openstack-config" - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: config_package diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-control.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-control.yml deleted file mode 100755 index ab7d4ad3..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-control.yml +++ /dev/null @@ -1,32 +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 -############################################################################## ---- -#- hosts: control -# sudo: yes -# tasks: -- name: "temporary disable supervisor control" -# sudo: True - template: -# src: "templates/override.j2" - src: "../../templates/install/override.j2" - dest: "/etc/init/supervisor-control.override" - -- name: "temporary disable supervisor dns" -# sudo: True - template: -# src: "templates/override.j2" - src: "../../templates/install/override.j2" - dest: "/etc/init/supervisor-dns.override" - -- name: "install contrail openstack control package" -# sudo: True -# apt: -# name: "contrail-openstack-control" - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: control_package diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-database.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-database.yml deleted file mode 100755 index 5c89ede9..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-database.yml +++ /dev/null @@ -1,25 +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 -############################################################################## ---- -#- hosts: database -# sudo: yes -# tasks: -- name: "temporary disable supervisor database" -# sudo: True - template: -# src: "templates/override.j2" - src: "../../templates/install/override.j2" - dest: "/etc/init/supervisor-database.override" - -- name: "install contrail openstack database package" -# sudo: True -# apt: -# name: "contrail-openstack-database" - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: database_package diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml deleted file mode 100755 index 3f7b43c1..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml +++ /dev/null @@ -1,34 +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 -############################################################################## ---- -#- hosts: all -# sudo: yes -# tasks: -#- name: get last ip address -# shell: expr substr `cat /etc/hostname` 5 1 -# register: lastip - -#- name: "configure interface" -## sudo: True -# lineinfile: -# dest: "/etc/network/interfaces" -# line: "{{ item }}" -# with_items: -# - "auto {{ contrail_vhost_device }}" -# - "iface {{ contrail_vhost_device }} inet static" -# - "\taddress {{ contrail_vhost_address }}" -# - "\tnetmask {{ contrail_vhost_netmask }}" - -- name: "set interface address" -# sudo: True - shell: "ifconfig {{ contrail_vhost_device }} {{ contrail_vhost_address }} netmask {{ contrail_vhost_netmask }}" - -- name: "up interface" -# sudo: True - shell: "ifconfig {{ contrail_vhost_device }} up" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-kernel.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-kernel.yml deleted file mode 100755 index be9a8ac9..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-kernel.yml +++ /dev/null @@ -1,60 +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 -############################################################################## ---- -#- hosts: all -# sudo: yes -# tasks: - -- name: "install Ubuntu kernel" -# sudo: True -# apt: -# name: "linux-headers-3.13.0-40" -# name: "linux-headers-3.13.0-40-generic" -# name: "linux-image-3.13.0-40-generic" -# name: "linux-image-extra-3.13.0-40-generic" -# when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic") - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: kernel_package | union(kernel_package_noarch) - when: (kernel_install) and (ansible_kernel != kernel_required) - -- name: "setup grub" -# sudo: True - lineinfile: - dest: "/etc/default/grub" - regexp: "GRUB_DEFAULT=.*" - line: "GRUB_DEFAULT='Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-40-generic'" -# when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic") - when: (kernel_install) and (ansible_kernel != kernel_required) - -- name: "reflect grub" -# sudo: True - shell: "update-grub2" -# when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic") - when: (kernel_install) and (ansible_kernel != kernel_required) - -- name: "reboot Server" -# sudo: True - shell: "shutdown -r now" - async: 0 - poll: 0 - ignore_errors: true - notify: Wait for server to come back -# when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic") - when: (kernel_install) and (ansible_kernel != kernel_required) - -# handlers: -- name: "Wait for server to come back" - local_action: - module: wait_for - host={{ inventory_hostname }} - port=22 - delay=30 - timeout=600 -# when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic") - when: (kernel_install) and (ansible_kernel != kernel_required) diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-webui.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-webui.yml deleted file mode 100755 index 6dbe1e74..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-webui.yml +++ /dev/null @@ -1,26 +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 -############################################################################## ---- -#- hosts: webui -# sudo: yes -# tasks: - -- name: "temporary disable supervisor webui" -# sudo: True - template: -# src: "templates/override.j2" - src: "../../templates/install/override.j2" - dest: "/etc/init/supervisor-webui.override" - -- name: "install contrail openstack webui package" -# sudo: True -# apt: -# name: "contrail-openstack-webui" - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: webui_package diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml deleted file mode 100755 index 7d0f1a9e..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml +++ /dev/null @@ -1,151 +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 -############################################################################## ---- - -- include_vars: "{{ ansible_os_family }}.yml" - -- name: backup rabbitmq-server - shell: cp /etc/init.d/rabbitmq-server /home/rabbitmq-server - when: inventory_hostname in groups['opencontrail'] - -- name: Disable Service Daemon - shell: if [ -f “\/opt\/service” ] ; then mv /opt/service /opt/service.bak ; fi - when: groups['opencontrail']|length !=0 - -- name: Install common on all hosts for Open Contrail - include: install/install-common.yml - when: groups['opencontrail']|length !=0 - # Compass install OpenStack with not only OpenContrail but also ODL or ONOS, and sometimes user just installs OpenStack, so item 'opencontrail_control' is kind of a mark that whether Compass install OpenContrail or not. - -#- name: Install kernal on all hosts for Open Contrail -# include: install/install-kernel.yml -# when: groups['opencontrail_control']|length !=0 - -- name: Install database for Open Contrail - include: install/install-database.yml - when: inventory_hostname in groups['opencontrail'] - -- name: Install config for Open Contrail - include: install/install-config.yml - when: inventory_hostname in groups['opencontrail'] - -- name: Install config for Open Contrail - include: install/install-control.yml - when: inventory_hostname in groups['opencontrail'] - -- name: Install collector for Open Contrail - include: install/install-collector.yml - when: inventory_hostname in groups['opencontrail'] - -- name: Install webui for Open Contrail - include: install/install-webui.yml - when: inventory_hostname in groups['opencontrail'] - -- name: Install compute for Open Contrail - include: install/install-compute.yml - when: groups['opencontrail']|length !=0 and inventory_hostname not in groups['opencontrail'] -# or inventory_hostname in groups['opencontrail_tsn'] - - -# change vhost0 on eth1 -#- name: Install interface on all hosts for Open Contrail -# include: install/install-interface.yml -# when: groups['opencontrail']|length !=0 - -#- include: install/install-common.yml -#- include: install/install-kernel.yml -#- include: install/install-database.yml -#- include: install/install-config.yml -#- include: install/install-control.yml -#- include: install/install-collector.yml -#- include: install/install-webui.yml -#- include: install/install-compute.yml -#- include: install/install-interface.yml - - -#- name: Provision route on all hosts for Open Contrail -# include: provision/provision-route.yml -# when: groups['opencontrail_control']|length !=0 - - -- name: Provision RabbitMQ on OpenContrail config nodes - include: provision/provision-rabbitmq.yml - when: inventory_hostname in groups['opencontrail'] - -- name: Provision increase limits for Open Contrail - include: provision/provision-increase-limits.yml - when: inventory_hostname in groups['opencontrail'] -#or inventory_hostname in groups['opencontrail_config'] or inventory_hostname in groups['opencontrail_collector'] or inventory_hostname in groups['opencontrail_database'] - - -- name: Provision database for Open Contrail - include: provision/provision-database.yml - when: inventory_hostname in groups['opencontrail'] - - -- name: Provision config for Open Contrail - include: provision/provision-config.yml - when: inventory_hostname in groups['opencontrail'] - -- name: Provision control for Open Contrail - include: provision/provision-control.yml - when: inventory_hostname in groups['opencontrail'] - - -- name: Provision collector for Open Contrail - include: provision/provision-collector.yml - when: inventory_hostname in groups['opencontrail'] - - -- name: Provision add nodes for Open Contrail - include: provision/provision-add-nodes.yml - when: inventory_hostname in groups['opencontrail'] - - -- name: Provision webui for Open Contrail - include: provision/provision-webui.yml - when: inventory_hostname in groups['opencontrail'] - - -- name: Provision compute for Open Contrail - include: provision/provision-compute.yml - when: groups['opencontrail']|length !=0 and inventory_hostname not in groups['opencontrail'] - -- name: Remove openvswitch on compute - include: uninstall-openvswitch.yml - when: groups['opencontrail']|length !=0 and inventory_hostname not in groups['opencontrail'] - -- name: Config ext-net network - include: ext-net.yml - -- name: Enable Service Daemon - shell: if [ -f “\/opt\/service.bak” ] ; then mv /opt/service.bak /opt/service ; fi - when: groups['opencontrail']|length !=0 - -#- name: Provision tsn for Open Contrail -# include: provision/provision-tsn.yml -# when: inventory_hostname in groups['opencontrail_tsn'] - - -#- name: Provision toragent for Open Contrail -# include: provision/provision-toragent.yml -# when: inventory_hostname in groups['opencontrail_tsn'] - -#- include: provision/provision-route.yml -#- include: provision/provision-rabbitmq.yml -#- include: provision/provision-increase-limits.yml -#- include: provision/provision-database.yml -#- include: provision/provision-config.yml -#- include: provision/provision-control.yml -#- include: provision/provision-collector.yml -#- include: provision/provision-add-nodes.yml -#- include: provision/provision-webui.yml -#- include: provision/provision-compute.yml -#- include: provision/provision-tsn.yml -#- include: provision/provision-toragent.yml diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-node-common.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-node-common.yml deleted file mode 100755 index 759f940f..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-node-common.yml +++ /dev/null @@ -1,28 +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: "disable ufw" - ufw: - state: "disabled" - -- name: "change value of kernel.core_pattern" - sysctl: - name: "kernel.core_pattern" - value: "/var/crashes/core.%e.%p.%h.%t" - -- name: "change value of net.ipv4.ip_forward" - sysctl: - name: "net.ipv4.ip_forward" - value: "1" - -- name: "make crashes directory" - file: - path: "/var/crashes" - state: "directory" - mode: 0777 diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-rabbitmq-stop.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-rabbitmq-stop.yml deleted file mode 100644 index ec6b2fe0..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-rabbitmq-stop.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: 'stop rabbitmq server' - service: - name: 'rabbitmq-server' - state: 'stopped' - -- name: 'check beam process' - shell: 'ps ax | grep -v grep | grep beam' - register: beam_process - changed_when: no - ignore_errors: yes - -- name: 'kill beam processes' - shell: 'pkill -9 beam' - when: beam_process.stdout - -- name: 'check epmd process' - shell: 'ps ax | grep -v grep | grep epmd' - register: epmd_process - changed_when: no - ignore_errors: yes - -- name: 'kill epmd processes' - shell: 'pkill -9 epmd' - when: epmd_process.stdout - -- name: 'remove mnesia directory' - file: - name: '/var/lib/rabbitmq/mnesia' - state: 'absent' diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-redis-setup.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-redis-setup.yml deleted file mode 100755 index c4a66240..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-redis-setup.yml +++ /dev/null @@ -1,34 +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: "stop redis server" - service: - name: "redis-server" - state: "stopped" - -- name: "modify redis server configuration" - replace: - dest: "/etc/redis/redis.conf" - regexp: "{{ item.regexp }}" - replace: "{{ item.replace }}" - with_items: - - { regexp: "^\\s*bind", replace: "#bind" } - - { regexp: "^\\s*save", replace: "#save" } - - { regexp: "^\\s*dbfilename", replace: "#dbfilename" } - - { regexp: "^\\s*lua-time-limit\\s*\\d*", replace: "lua-time-limit 15000" } - -- name: "delete redis dump" - file: - dest: "/var/lib/redis/dump.rdb" - state: "absent" - -- name: "start redis server" - service: - name: "redis-server" - state: "started" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-vrouter-compute-setup.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-vrouter-compute-setup.yml deleted file mode 100755 index be1879af..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-vrouter-compute-setup.yml +++ /dev/null @@ -1,115 +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: "change owner nova log directory" - file: - dest: "/var/log/nova" - state: "directory" - owner: "nova" - group: "nova" - recurse: yes - -- name: "delete values from nova config" - ini_file: - dest: "/etc/nova/nova.conf" - section: "{{ item.section }}" - option: "{{ item.option }}" - with_items: - - { section: "DEFAULT", option: "sql_connection" } - - { section: "DEFAULT", option: "quantum_admin_tenant_name" } - - { section: "DEFAULT", option: "quantum_admin_username" } - - { section: "DEFAULT", option: "quantum_admin_password" } - - { section: "DEFAULT", option: "quantum_admin_auth_url" } - - { section: "DEFAULT", option: "quantum_auth_strategy" } - - { section: "DEFAULT", option: "quantum_url" } - -- name: "set values to nova config" - ini_file: - dest: "/etc/nova/nova.conf" - section: "{{ item.section }}" - option: "{{ item.option }}" - value: "{{ item.value }}" - with_items: - - { section: "DEFAULT", option: "auth_strategy", value: "keystone" } - - { section: "DEFAULT", option: "libvirt_nonblocking", value: "True" } - - { section: "DEFAULT", option: "libvirt_inject_partition", value: "-1" } - - { section: "DEFAULT", option: "rabbit_host", value: "{{ contrail_haproxy_address }}" } - - { section: "DEFAULT", option: "rabbit_port", value: "5672" } - - { section: "DEFAULT", option: "glance_host", value: "{{ contrail_haproxy_address }}" } - - { section: "DEFAULT", option: "glance_port", value: "9292" } - - { section: "DEFAULT", option: "neutron_admin_tenant_name", value: "service" } - - { section: "DEFAULT", option: "neutron_admin_username", value: "neutron" } - - { section: "DEFAULT", option: "neutron_admin_password", value: "{{ contrail_admin_password }}" } - - { section: "DEFAULT", option: "neutron_admin_auth_url", value: "http://{{ contrail_haproxy_address }}:35357/v2.0/" } - - { section: "DEFAULT", option: "neutron_url", value: "http://{{ contrail_haproxy_address }}:9696/" } - - { section: "DEFAULT", option: "neutron_url_timeout", value: "300" } - - { section: "DEFAULT", option: "network_api_class", value: "nova.network.neutronv2.api.API" } - - { section: "DEFAULT", option: "compute_driver", value: "libvirt.LibvirtDriver" } - - { section: "DEFAULT", option: "network_api_class", value: " nova_contrail_vif.contrailvif.ContrailNetworkAPI" } - - { section: "DEFAULT", option: "ec2_private_dns_show_ip", value: "False" } - - { section: "DEFAULT", option: "novncproxy_base_url", value: "http://{{ contrail_haproxy_address }}:5999/vnc_auto.html" } - - { section: "DEFAULT", option: "vncserver_enabled", value: "True" } - - { section: "DEFAULT", option: "vncserver_listen", value: "{{ contrail_address }}" } - - { section: "DEFAULT", option: "vncserver_proxyclient_address", value: "{{ contrail_address }}" } - - { section: "DEFAULT", option: "security_group_api", value: "neutron" } - - { section: "DEFAULT", option: "heal_instance_info_cache_interval", value: "0" } - - { section: "DEFAULT", option: "image_cache_manager_interval", value: "0" } - - { section: "DEFAULT", option: "libvirt_cpu_mode", value: "none" } - - { section: "DEFAULT", option: "libvirt_vif_driver", value: "nova_contrail_vif.contrailvif.VRouterVIFDriver" } - - { section: "database", option: "connection", value: "mysql://nova:nova@{{ contrail_haproxy_address }}/nova?charset=utf8" } - - { section: "database", option: "idle_timeout", value: "180" } - - { section: "database", option: "max_retries", value: "-1" } - - { section: "keystone_authtoken", option: "admin_tenant_name", value: "service" } - - { section: "keystone_authtoken", option: "admin_user", value: "nova" } - - { section: "keystone_authtoken", option: "admin_password", value: "{{ contrail_admin_password }}" } - - { section: "keystone_authtoken", option: "auth_protocol", value: "http" } - - { section: "keystone_authtoken", option: "auth_host", value: "{{ contrail_haproxy_address }}" } - - { section: "keystone_authtoken", option: "signing_dir", value: "/tmp/keystone-signing-nova" } - - - -#- { section: "DEFAULT", option: "rabbit_host", value: "{{ hostvars[groups['config'][0]]['contrail_address'] }}" } -#- { section: "DEFAULT", option: "glance_host", value: "{{ hostvars[groups['openstack'][0]]['contrail_address'] }}" } -#- { section: "DEFAULT", option: "neutron_admin_auth_url", value: "http://{{ hostvars[groups['openstack'][0]]['contrail_address'] }}:35357/v2.0/" } -#- { section: "DEFAULT", option: "neutron_url", value: "http://{{ hostvars[groups['config'][0]]['contrail_address'] }}:9696/" } -#- { section: "DEFAULT", option: "novncproxy_base_url", value: "http://{{ hostvars[groups['openstack'][0]]['contrail_mgmt_address'] }}:5999/vnc_auto.html" } -#- { section: "database", option: "connection", value: "mysql://nova:nova@{{ hostvars[groups['openstack'][0]]['contrail_address'] }}/nova?charset=utf8" } -#- { section: "keystone_authtoken", option: "auth_host", value: "{{ hostvars[groups['openstack'][0]]['contrail_address'] }}" } - - - -- name: "change database address if same node as first openstack node" - ini_file: - dest: "/etc/nova/nova.conf" - section: "database" - option: "connection" - value: "mysql://nova:nova@127.0.0.1/nova?charset=utf8" - when: groups['openstack'][0] == inventory_hostname - -- name: "add respawn to nova compute config" - lineinfile: - dest: "/etc/init/nova-compute.conf" - line: "respawn" - insertbefore: "pre-start script" - -- name: "add respawn limit to nova compute config" - lineinfile: - dest: "/etc/init/nova-compute.conf" - line: "respawn limit 10 90" - insertafter: "respawn" - -- name: "restart nova compute" - service: - name: "nova-compute" - state: "restarted" - -- name: "delete nova sqlite database" - file: - dest: "/var/lib/nova/nova.sqlite" - state: "absent" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml deleted file mode 100755 index 58a6bb07..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml +++ /dev/null @@ -1,91 +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 -############################################################################## ---- -#- hosts: config -# sudo: yes -# tasks: - -#- name: "recover rabbitmq-server service script" -# shell: cp /home/rabbitmq-server /etc/init.d/rabbitmq-server - -#- name: "restart rabbitmq-server" -# service: -# name: "rabbitmq-server" -# state: "restarted" - -#- name: "wait rabbitmq-server start" -# shell: sleep 5 - -- name: "restart contrail-discovery" - service: - name: "contrail-discovery" - state: "restarted" - -- name: "wait contrail-discovery" - shell: sleep 5 - -- name: "restart contrail-api" - service: - name: "contrail-api" - state: "restarted" - -- name: "restart apache2" - service: - name: "apache2" - state: "restarted" - -- name: "check contrail-api" - shell: lsof -ni :8082 ; while [ $? -ne 0 ]; do sleep 10; lsof -ni :8082; done; sleep 20; - -- name: "wait contrail-api" - shell: sleep 20 - -- name: "provision config node" - shell: "python /opt/contrail/utils/provision_config_node.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }}" -# when: inventory_hostname in groups['opencontrail_config'] - -#- hosts: database -# sudo: yes -# tasks: -- name: "provision database node" - shell: "python /opt/contrail/utils/provision_database_node.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }}" -# when: inventory_hostname in groups['opencontrail_database'] - - -#- hosts: collector -# sudo: yes -# tasks: -- name: "provision collector node" - shell: "python /opt/contrail/utils/provision_analytics_node.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }}" -# when: inventory_hostname in groups['opencontrail_collector'] - -#- hosts: control -# sudo: yes -# tasks: -- name: "provision control node" - shell: "python /opt/contrail/utils/provision_control.py --api_server_ip {{ contrail_haproxy_address }} --api_server_port 8082 --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }} --router_asn {{ contrail_router_asn }}" -# when: inventory_hostname in groups['opencontrail_control'] - -#- hosts: config -# sudo: yes -# tasks: -- name: "provision metadata services" - shell: "python /opt/contrail/utils/provision_linklocal.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --oper add --ipfabric_service_ip 10.84.50.1 --ipfabric_service_port 8775 --linklocal_service_name metadata --linklocal_service_ip 169.254.169.254 --linklocal_service_port 80" - run_once: yes -# when: inventory_hostname in groups['opencontrail_config'] - - -#- hosts: config -# sudo: yes -# tasks: -- name: "provision encap" - shell: "python /opt/contrail/utils/provision_encap.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --oper add --encap_priority MPLSoUDP,MPLSoGRE,VXLAN" - run_once: yes -# when: inventory_hostname in groups['opencontrail_config'] - diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-collector.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-collector.yml deleted file mode 100755 index b09f83a8..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-collector.yml +++ /dev/null @@ -1,106 +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 -############################################################################## ---- -#- hosts: collector -# sudo: yes -# tasks: - -- name: "enable supervisor analytics" - file: - path: "/etc/init/supervisor-analytics.override" - state: "absent" - - -- name: "redis-setup" - include: -redis-setup.yml - - -- name: "node-common" - include: -node-common.yml - - -- name: "fix up contrail collector config" - template: - src: "../../templates/provision/contrail-collector-conf.j2" - dest: "/etc/contrail/contrail-collector.conf" - - -- name: "fix up contrail query engine config" - template: - src: "../../templates/provision/contrail-query-engine-conf.j2" - dest: "/etc/contrail/contrail-query-engine.conf" - - -- name: "fix up contrail analytics api config" - template: - src: "../../templates/provision/contrail-analytics-api-conf.j2" - dest: "/etc/contrail/contrail-analytics-api.conf" - - -- name: "modify contrail analytics nodemgr config" - ini_file: - dest: "/etc/contrail/contrail-analytics-nodemgr.conf" - section: "DISCOVERY" - option: "server" - value: "{{ contrail_haproxy_address }}" - - -- name: "fix up contrail keystone auth config" - template: - src: "../../templates/provision/contrail-keystone-auth-conf.j2" - dest: "/etc/contrail/contrail-keystone-auth.conf" - force: no - - -- name: "delete contrail alarm gen supervisord config file" - file: - dest: "/etc/contrail/supervisord_analytics_files/contrail-alarm-gen.ini" - state: "absent" - - -- name: "modify contrail snmp collector config file" - ini_file: - dest: "/etc/contrail/contrail-snmp-collector.conf" - section: "{{ item.section }}" - option: "{{ item.option }}" - value: "{{ item.value }}" - with_items: - - { section: "DEFAULTS", option: "zookeeper", value: "{{ contrail_address }}:2181" } - - { section: "DISCOVERY", option: "disc_server_ip", value: "{{ contrail_haproxy_address }}" } - - { section: "DISCOVERY", option: "disc_server_port", value: "5998" } - - -- name: "modify contrail snmp collector ini file" - ini_file: - dest: "/etc/contrail/supervisord_analytics_files/contrail-snmp-collector.ini" - section: "program:contrail-snmp-collector" - option: "command" - value: "/usr/bin/contrail-snmp-collector --conf_file /etc/contrail/contrail-snmp-collector.conf --conf_file /etc/contrail/contrail-keystone-auth.conf" - - -- name: "modify contrail topology config file" - ini_file: - dest: "/etc/contrail/contrail-topology.conf" - section: "DEFAULTS" - option: "zookeeper" - value: "{{ contrail_address }}" - - -- name: "modify contrail topology ini file" - ini_file: - dest: "/etc/contrail/supervisord_analytics_files/contrail-topology.ini" - section: "program:contrail-topology" - option: "command" - value: "/usr/bin/contrail-topology --conf_file /etc/contrail/contrail-topology.conf" - - -- name: "restart supervisor analytics" - service: - name: "supervisor-analytics" - state: "restarted" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml deleted file mode 100755 index 374c4e13..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml +++ /dev/null @@ -1,269 +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 -############################################################################## ---- -#- hosts: compute -# sudo: yes -# tasks: -- name: "enable supervisor vrouter" - file: - path: "/etc/init/supervisor-vrouter.override" - state: "absent" - -- include: -node-common.yml - -- name: "check cgroup device acl in qemu conf" - shell: "grep -q '^\\s*cgroup_device_acl' /etc/libvirt/qemu.conf" - register: deviceacl - ignore_errors: yes - changed_when: no - -- name: "create cgroup device acl for qemu conf" - template: - src: "../../templates/provision/qemu-device-acl-conf.j2" - dest: "/tmp/qemu-device-acl.conf" - when: deviceacl | failed - -- name: "combination of the qemu configuration" - shell: "cat /tmp/qemu-device-acl.conf >> /etc/libvirt/qemu.conf" - when: deviceacl | failed - -- name: "delete temporary configuration file" - file: - dest: "/tmp/qemu-device-acl.conf" - state: "absent" - when: deviceacl | failed - -- name: "fix up vrouter nodemgr param" - template: - src: "../../templates/provision/vrouter-nodemgr-param.j2" - dest: "/etc/contrail/vrouter_nodemgr_param" - -- name: "set contrail device name for ansible" - set_fact: - contrail_ansible_device: "ansible_{{ contrail_vhost_device }}" - -- name: "fix up default pmac" - template: - src: "../../templates/provision/default-pmac.j2" - dest: "/etc/contrail/default_pmac" - -- name: "copy agent param config from template" - shell: "cp /etc/contrail/agent_param.tmpl /etc/contrail/agent_param" - -- name: "modify agent param config" - lineinfile: - dest: "/etc/contrail/agent_param" - regexp: "dev=__DEVICE__" - line: "dev={{ contrail_vhost_device }}" - -#- name: "get last ip address" -# shell: expr substr `cat /etc/hostname` 5 1 -# register: lastip - -- name: "fix up contrail vrouter agent config" - template: - src: "../../templates/provision/contrail-vrouter-agent-conf.j2" - dest: "/etc/contrail/contrail-vrouter-agent.conf" - -- name: "delete lines for contrail interface" - shell: "{{ item }}" - with_items: - - "sed -e '/auto {{ contrail_vhost_device }}/,$d' /etc/network/interfaces > /tmp/contrail-interfaces-top" - - "sed -n -e '/auto {{ contrail_vhost_device }}/,$p' /etc/network/interfaces > /tmp/contrail-interfaces-bottom" - - "sed -i -e '/auto {{ contrail_vhost_device }}/d' /tmp/contrail-interfaces-bottom" - - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" - -- name: "delete lines for vrouter interface" - shell: "{{ item }}" - with_items: - - "sed -e '/auto vhost0/,$d' /etc/network/interfaces > /tmp/contrail-interfaces-top" - - "sed -n -e '/auto vhost0/,$p' /etc/network/interfaces > /tmp/contrail-interfaces-bottom" - - "sed -i -e '/auto vhost0/d' /tmp/contrail-interfaces-bottom" - - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" - -#- name: get last ip address -# shell: expr substr `cat /etc/hostname` 5 1 -# register: lastip - -- name: "configure interface" - lineinfile: - dest: "/etc/network/interfaces" - line: "{{ item }}" - state: "present" - with_items: - - "auto {{ contrail_vhost_device }}" - - "iface {{ contrail_vhost_device }} inet manual" - - "\tpre-up ifconfig {{ contrail_vhost_device }} up" - - "\tpost-down ifconfig {{ contrail_vhost_device }} down" - - "auto vhost0" - - "iface vhost0 inet static" - - "\tpre-up /opt/contrail/bin/if-vhost0" - - "\tnetwork_name application" - - "\taddress {{ contrail_vhost_address }}" - - "\tnetmask {{ contrail_vhost_netmask }}" - -################################################################################## - -- name: "copy vrouter script to compute" - template: - src: "../../templates/vrouter-functions.sh" - dest: "/opt/contrail/bin/vrouter-functions.sh" - -- name: "load vrouter driver" - command: su -s /bin/sh -c "insmod /var/lib/dkms/vrouter/2.21/build/vrouter.ko" - ignore_errors: true - -- name: "run vhost0 script" - command: su -s /bin/sh -c "/opt/contrail/bin/if-vhost0" - ignore_errors: true - -################################################################################## - -- name: "delete temporary files" - file: - dest: "{{ item }}" - state: "absent" - with_items: - - "/tmp/contrail-interfaces-top" - - "/tmp/contrail-interfaces-bottom" - -################################################################################## - -- name: "fix up contrail vrouter nodemgr config" - ini_file: - dest: "/etc/contrail/contrail-vrouter-nodemgr.conf" - section: "DISCOVERY" - option: "server" - value: "{{ contrail_haproxy_address }}" - - -################################################################################## -########################### restart vrouter services ########################### - -- name: "restart supervisor service" - service: - name: "supervisor" - state: "restarted" - -- name: "restart vrouter nodemgr" - shell: ps aux | grep contrail-nodemgr | grep -v grep | awk '{print $2}' | xargs kill -9; - -- name: "restart vrouter agent" - service: - name: "contrail-vrouter-agent" - state: "restarted" - - -################################################################################## - - -- name: "restart libvirt bin" - service: - name: "libvirt-bin" - state: "restarted" - -#- name: "set value of nova to nova config" -# template: -# src: "provision/nova.j2" -# dest: "/etc/nova/nova.conf" -# when: install_nova - -#- name: "delete values from nova config" -# ini_file: -# dest: "/etc/nova/nova.conf" -# section: "{{ item.section }}" -# option: "{{ item.option }}" -# with_items: -# - { section: "DEFAULT", option: "quantum_auth_strategy" } -# - { section: "DEFAULT", option: "quantum_admin_auth_url" } -# - { section: "DEFAULT", option: "quantum_admin_tenant_name" } -# - { section: "DEFAULT", option: "quantum_admin_username" } -# - { section: "DEFAULT", option: "quantum_admin_password" } -# - { section: "DEFAULT", option: "quantum_url" } - -#- name: "set values of neutron to nova config" -# ini_file: -# dest: "/etc/nova/nova.conf" -# section: "{{ item.section }}" -# option: "{{ item.option }}" -# value: "{{ item.value }}" -# state: "present" -# with_items: -# - { section: "DEFAULT", option: "neutron_admin_auth_url", value: "http://{{ contrail_keystone_address }}:5000/v2.0" } -# - { section: "DEFAULT", option: "neutron_admin_username", value: "neutron" } -# - { section: "DEFAULT", option: "neutron_admin_password", value: "{{ contrail_admin_password }}" } -# - { section: "DEFAULT", option: "neutron_admin_tenant_name", value: "service" } -# - { section: "DEFAULT", option: "neutron_url", value: "http://{{ contrail_haproxy_address }}:9696/" } -# - { section: "DEFAULT", option: "neutron_url_timeout", value: "300" } -# - { section: "DEFAULT", option: "network_api_class", value: "nova.network.neutronv2.api.API" } -# - { section: "DEFAULT", option: "libvirt_vif_driver", value: "nova_contrail_vif.contrailvif.VRouterVIFDriver" } - -- name: "set values to nova config" - ini_file: - dest: "/etc/nova/nova.conf" - section: "{{ item.section }}" - option: "{{ item.option }}" - value: "{{ item.value }}" - with_items: - - { section: "DEFAULT", option: "network_api_class", value: "nova_contrail_vif.contrailvif.ContrailNetworkAPI" } - - - -####################################################################### -###################### nova plugin workaround ####################### -####################################################################### - -#- name: "copy nova plugs on compute" -# copy: -# src: "../../templates/nova_contrail_vif.tar.gz" -# dest: "/opt/nova_contrail_vif.tar.gz" - -- name: get image http server - shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf - register: http_server - -- name: download nova plugin package - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/open-contrail/{{ nova_plugin }}" dest=/opt/ - -- name: "unzip nova plugs" - command: su -s /bin/sh -c "tar xzf /opt/nova_contrail_vif.tar.gz -C /opt/" - -- name: "remove original nova plugs" - shell: rm -rf /usr/lib/python2.7/dist-packages/nova_contrail_vif/ - -- name: "use new nova plugs" - shell: mv /opt/nova_contrail_vif/ /usr/lib/python2.7/dist-packages/nova_contrail_vif/ - -################################################# - -- name: "restart nova compute" - service: - name: "nova-compute" - state: "restarted" - -- name: "add vrouter to contrail" - shell: "python /opt/contrail/utils/provision_vrouter.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --openstack_ip {{ contrail_keystone_address }} --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }}" - -#- name: "reboot Server" -# shell: "shutdown -r now" -# async: 0 -# poll: 0 -# ignore_errors: true -# notify: Wait for server to come back -# -#handlers: -#- name: "Wait for server to come back" -# local_action: -# module: wait_for -# host={{ inventory_hostname }} -# port=22 -# delay=30 -# timeout=600 diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-config.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-config.yml deleted file mode 100755 index 615ac281..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-config.yml +++ /dev/null @@ -1,350 +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 -############################################################################## ---- -#- hosts: config -# sudo: yes -# tasks: -- name: "enable supervisor config" - file: - path: "/etc/init/supervisor-config.override" - state: "absent" - -- name: "enable neutron server" - file: - path: "/etc/init/neutron-server.override" - state: "absent" - -# Compass is using this -#- name: "enable haproxy" -# replace: -# dest: "/etc/default/haproxy" -# regexp: "^ENABLED\\s*=.*$" -# replace: "ENABLED=1" - -# Compass is using this -#- name: "modify haproxy global configuration" -# lineinfile: -# dest: "/etc/haproxy/haproxy.cfg" -# regexp: "{{ item.regexp }}" -# line: "{{ item.line }}" -# insertafter: "^global" -# with_items: -# - { regexp: "^\\s*tune.bufsize", line: "\ttune.bufsize 16384" } -# - { regexp: "^\\s*tune.maxrewrite", line: "\ttune.maxrewrite 1024" } - -#chenshuai, add later -#- name: "delete haproxy configuration for contrail" -# shell: "sed -i -e '/^#contrail-marker-start/,/^#contrail-marker-end/d' /etc/haproxy/haproxy.cfg" - -#chenshuai, add later -#- name: "create haproxy configuration for contrail" -# template: -# src: "provision/haproxy-contrail-cfg.j2" -# src: "../../templates/provision/haproxy-contrail-cfg.j2" -# dest: "/tmp/haproxy-contrail.cfg" - -#chenshuai, add later -#- name: "combination of the haproxy configuration" -# shell: "cat /tmp/haproxy-contrail.cfg >> /etc/haproxy/haproxy.cfg" - -#chenshuai, add later -#- name: "delete temporary configuration file" -# file: -# dest: "/tmp/haproxy-contrail.cfg" -# state: "absent" - -#chenshuai, add later -#- name: "restart haproxy" -# service: -# name: "haproxy" -# state: "restarted" - -# Compass is using this -#- name: "create keepalived configuration" -# template: -# src: "../../templates/provision/keepalived-conf.j2" -# dest: "/etc/keepalived/keepalived.conf" -# with_indexed_items: groups['opencontrail_config'] -# when: contrail_keepalived and item.1 == inventory_hostname - -#- name: "restart keepalived" -# service: -# name: "keepalived" -# state: "restarted" -# when: contrail_keepalived - -- name: "node-common" - include: -node-common.yml - -- name: "fix up contrail keystone auth config" - template: - src: "../../templates/provision/contrail-keystone-auth-conf.j2" - dest: "/etc/contrail/contrail-keystone-auth.conf" - -- name: "fix up ifmap server log4j properties" - template: - src: "../../templates/provision/ifmap-log4j-properties.j2" - dest: "/etc/ifmap-server/log4j.properties" - -- name: "fix up ifmap server authorization properties" - template: - src: "../../templates/provision/ifmap-authorization-properties.j2" - dest: "/etc/ifmap-server/authorization.properties" - -- name: "fix up ifmap server basicauthusers properties" - template: - src: "../../templates/provision/ifmap-basicauthusers-properties.j2" - dest: "/etc/ifmap-server/basicauthusers.properties" - -- name: "fix up ifmap server publisher properties" - template: - src: "../../templates/provision/ifmap-publisher-properties.j2" - dest: "/etc/ifmap-server/publisher.properties" - -- name: "fix up contrail api config" - template: - src: "../../templates/provision/contrail-api-conf.j2" - dest: "/etc/contrail/contrail-api.conf" - -- name: "fix up contrail api supervisord config" - template: - src: "../../templates/provision/contrail-api-supervisord-conf.j2" - dest: "/etc/contrail/supervisord_config_files/contrail-api.ini" - -- name: "modify contrail api init script" - lineinfile: - dest: "/etc/init.d/contrail-api" - regexp: "supervisorctl -s unix:///tmp/supervisord_config.sock" - line: "supervisorctl -s unix:///tmp/supervisord_config.sock ${1} `basename ${0}:0`" - -- name: "fix up contrail schema config" - template: - src: "../../templates/provision/contrail-schema-conf.j2" - dest: "/etc/contrail/contrail-schema.conf" - -- name: "fix up contrail device manager config" - template: - src: "../../templates/provision/contrail-device-manager-conf.j2" - dest: "/etc/contrail/contrail-device-manager.conf" - -- name: "fix up contrail svc monitor config" - template: - src: "../../templates/provision/contrail-svc-monitor-conf.j2" - dest: "/etc/contrail/contrail-svc-monitor.conf" - -- name: "fix up contrail discovery supervisord config" - template: - src: "../../templates/provision/contrail-discovery-supervisord-conf.j2" - dest: "/etc/contrail/supervisord_config_files/contrail-discovery.ini" - -- name: "fix up contrail discovery config" - template: - src: "../../templates/provision/contrail-discovery-conf.j2" - dest: "/etc/contrail/contrail-discovery.conf" - -- name: "modify contrail discovery init script" - lineinfile: - dest: "/etc/init.d/contrail-discovery" - regexp: "supervisorctl -s unix:///tmp/supervisord_config.sock" - line: "supervisorctl -s unix:///tmp/supervisord_config.sock ${1} `basename ${0}:0`" - -- name: "fix up contrail vnc api library config" - template: - src: "../../templates/provision/contrail-vnc-api-lib-ini.j2" - dest: "/etc/contrail/vnc_api_lib.ini" - -- name: "fix up contrail config nodemgr config" - ini_file: - dest: "/etc/contrail/contrail-config-nodemgr.conf" - section: "DISCOVERY" - option: "server" - value: "{{ contrail_haproxy_address }}" - -- name: "fix up contrail sudoers" - template: - src: "../../templates/provision/contrail-sudoers.j2" - dest: "/etc/sudoers.d/contrail_sudoers" - mode: 0440 - -- name: "create directory for neutron plugins" - file: - dest: "/etc/neutron/plugins/opencontrail" - state: "directory" - -- name: "fix up contrail plugin for nuetron" - template: - src: "../../templates/provision/neutron-contrail-plugin-ini.j2" - dest: "/etc/neutron/plugins/opencontrail/ContrailPlugin.ini" - -- name: "modify neutron server configuration" - lineinfile: - dest: "/etc/default/neutron-server" - regexp: "NEUTRON_PLUGIN_CONFIG=" - line: "NEUTRON_PLUGIN_CONFIG=\"/etc/neutron/plugins/opencontrail/ContrailPlugin.ini\"" - -#- name: "change owner neutron log directory" -# file: -# dest: "/var/log/neutron" -# state: "directory" -# owner: "neutron" -# group: "neutron" -# recurse: yes - -- name: "set values to neutron config" - ini_file: - dest: "/etc/neutron/neutron.conf" - section: "{{ item.section }}" - option: "{{ item.option }}" - value: "{{ item.value }}" - with_items: -# - { section: "DEFAULT", option: "bind_port", value: "9697" } -# - { section: "DEFAULT", option: "auth_strategy", value: "keystone" } -# - { section: "DEFAULT", option: "allow_overlapping_ips", value: "True" } - - { section: "DEFAULT", option: "core_plugin", value: "neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2" } - - { section: "DEFAULT", option: "api_extensions_path", value: "/usr/lib/python2.7/dist-packages/neutron_plugin_contrail/extensions" } -# - { section: "DEFAULT", option: "rabbit_host", value: "{{ contrail_haproxy_address }}" } -# - { section: "DEFAULT", option: "rabbit_port", value: "5673" } -# - { section: "DEFAULT", option: "service_plugins", value: "neutron_plugin_contrail.plugins.opencontrail.loadbalancer.plugin.LoadBalancerPlugin" } - - { section: "DEFAULT", option: "service_plugins", value: " " } - - { section: "DEFAULT", option: "notify_nova_on_port_data_changes", value: "False" } - - { section: "service_providers", option: "service_provider", value: "LOADBALANCER:Opencontrail:neutron_plugin_contrail.plugins.opencontrail.loadbalancer.driver.OpencontrailLoadbalancerDriver:default" } - - { section: "quotas", option: "quota_driver", value: "neutron_plugin_contrail.plugins.opencontrail.quota.driver.QuotaDriver" } -# - { section: "quotas", option: "quota_network", value: "-1" } -# - { section: "quotas", option: "quota_subnet", value: "-1" } -# - { section: "quotas", option: "quota_port", value: "-1" } -# - { section: "keystone_authtoken", option: "admin_tenant_name", value: "admin" } -# - { section: "keystone_authtoken", option: "admin_user", value: "{{ contrail_admin_user }}" } -# - { section: "keystone_authtoken", option: "admin_password", value: "{{ contrail_admin_password }}" } -# - { section: "keystone_authtoken", option: "auth_host", value: "{{ contrail_keystone_address }}" } -# - { section: "keystone_authtoken", option: "auth_protocol", value: "http" } - -#- name: "add respawn to neutron server config" -# lineinfile: -# dest: "/etc/init/neutron-server.conf" -# line: "respawn" -# insertbefore: "pre-start script" - -#- name: "add respawn limit to neutron server config" -# lineinfile: -# dest: "/etc/init/neutron-server.conf" -# line: "respawn limit 10 90" -# insertafter: "respawn" - -- name: "restart supervisor config" - service: - name: "supervisor-config" - state: "restarted" - - - -########################################################### -############# neutron plugins workaround ################## -########################################################### - -#- name: "copy neutron plugs on controller" -# copy: -# src: "../../templates/neutron_plugin_contrail.tar.gz" -# dest: "/opt/neutron_plugin_contrail.tar.gz" - -- name: get image http server - shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf - register: http_server - -- name: download neutron_plugin_contrail package - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/open-contrail/{{ neutron_plugin }}" dest=/opt/ - -- name: "unzip neutron plugs" - command: su -s /bin/sh -c "tar xzf /opt/neutron_plugin_contrail.tar.gz -C /opt/" - -- name: "remove original neutron plugs" - shell: rm -rf /usr/lib/python2.7/dist-packages/neutron_plugin_contrail/ - -- name: "use new neutron plugs" - shell: mv /opt/neutron_plugin_contrail/ /usr/lib/python2.7/dist-packages/neutron_plugin_contrail/ - -########################################################### - - - -- name: "restart neutron-server" - service: - name: "neutron-server" - state: "restarted" - -# Compass configured -#- name: "add neutron service" -# shell: "keystone service-get 'neutron' || keystone service-create --name 'neutron' --type 'network' --description 'Neutron Network Service'" -# environment: -# OS_AUTH_URL: "http://{{ contrail_keystone_address }}:35357/v2.0" -# OS_USERNAME: "{{ contrail_admin_user }}" -# OS_PASSWORD: "{{ contrail_admin_password }}" -# OS_TENANT_NAME: "admin" -# run_once: yes -# when: keystone_provision -# -# -# Compass configured -#- name: "add neutron endpoint" -# shell: "keystone endpoint-list | grep -q $(keystone service-get 'neutron' | grep '| *id *|' | awk '{print $4}') || keystone endpoint-create --region 'RegionOne' --service 'neutron' --publicurl 'http://{{ contrail_haproxy_address }}:9696' --internal 'http://{{ contrail_haproxy_address }}:9696' --adminurl 'http://{{ contrail_haproxy_address }}:9696'" -# environment: -# OS_AUTH_URL: "http://{{ contrail_keystone_address }}:35357/v2.0" -# OS_USERNAME: "{{ contrail_admin_user }}" -# OS_PASSWORD: "{{ contrail_admin_password }}" -# OS_TENANT_NAME: "admin" -# run_once: yes -# when: keystone_provision -# -#- name: "add neutron user" -# keystone_user: -# user: "neutron" -# password: "{{ contrail_admin_password }}" -# email: "neutron@example.com" -# tenant: "service" -# endpoint: "http://{{ contrail_keystone_address }}:35357/v2.0" -# login_user: "{{ contrail_admin_user }}" -# login_password: "{{ contrail_admin_password }}" -# login_tenant_name: "admin" -# run_once: yes -# when: keystone_provision -# -#- name: "apply role to user" -# keystone_user: -# tenant: "service" -# user: "neutron" -# role: "admin" -# endpoint: "http://{{ contrail_keystone_address }}:35357/v2.0" -# login_user: "{{ contrail_admin_user }}" -# login_password: "{{ contrail_admin_password }}" -# login_tenant_name: "admin" -# run_once: yes -# when: keystone_provision - - - -#- name: "set values to nova config" -# ini_file: -# dest: "/etc/nova/nova.conf" -# section: "{{ item.section }}" -# option: "{{ item.option }}" -# value: "{{ item.value }}" -# with_items: -# - { section: "DEFAULT", option: "network_api_class", value: "nova_contrail_vif.contrailvif.ContrailNetworkAPI" } - - -#- name: "restart nova-server" -# service: -# name: "{{ item }}" -# state: "restarted" -# with_items: -# - nova-api -# - nova-cert -# - nova-conductor -# - nova-consoleauth -# - nova-novncproxy -# - nova-scheduler diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-control.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-control.yml deleted file mode 100755 index e719a461..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-control.yml +++ /dev/null @@ -1,69 +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 -############################################################################## ---- -#- hosts: control -# sudo: yes -# tasks: -- name: "enable supervisor control" - file: - path: "/etc/init/supervisor-control.override" - state: "absent" - -- name: "enable supervisor dns" - file: - path: "/etc/init/supervisor-dns.override" - state: "absent" - -- name: "modify ifmap server basicauthusers properties for control" - lineinfile: - dest: "/etc/ifmap-server/basicauthusers.properties" -# line: "{{ hostvars[item]['contrail_address' ] }}:{{ hostvars[item]['contrail_address' ] }}" - line: "{{ ip_settings[item]['br-prv']['ip'] }}:{{ ip_settings[item]['br-prv']['ip'] }}" - with_items: groups['opencontrail'] - -- name: "modify ifmap server basicauthusers properties for dns" - lineinfile: - dest: "/etc/ifmap-server/basicauthusers.properties" -# line: "{{ hostvars[item]['contrail_address' ] }}.dns:{{ hostvars[item]['contrail_address' ] }}.dns" - line: "{{ ip_settings[item]['br-prv']['ip'] }}.dns:{{ ip_settings[item]['br-prv']['ip'] }}.dns" - with_items: groups['opencontrail'] - -- name: "node-common" - include: -node-common.yml - -- name: "fix up contrail control config" - template: - src: "../../templates/provision/contrail-control-conf.j2" - dest: "/etc/contrail/contrail-control.conf" - -- name: "fix up contrail dns config" - template: - src: "../../templates/provision/contrail-dns-conf.j2" - dest: "/etc/contrail/contrail-dns.conf" - -- name: "fix up contrail control nodemgr config" - ini_file: - dest: "/etc/contrail/contrail-control-nodemgr.conf" - section: "DISCOVERY" - option: "server" - value: "{{ contrail_haproxy_address }}" - -- name: "modify dns configuration" - replace: - dest: "/etc/contrail/dns/{{ item }}" - regexp: "secret \"secret123\"" - replace: "secret \"xvysmOR8lnUQRBcunkC6vg==\"" - with_items: - - "contrail-rndc.conf" - - "contrail-named.conf" - -- name: "restart supervisor control" - service: - name: "supervisor-control" - state: "restarted" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-database.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-database.yml deleted file mode 100755 index 9c99270d..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-database.yml +++ /dev/null @@ -1,209 +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 -############################################################################## ---- -#- hosts: database -# sudo: yes -# tasks: - - -- name: "enable supervisor database" -# sudo: True - file: - path: "/etc/init/supervisor-database.override" - state: "absent" - - -- name: "-node-common" -# sudo: True - include: -node-common.yml - - -- name: "update hosts" -# sudo: True - lineinfile: - dest: "/etc/hosts" -# regexp: "^{{ contrail_address }}\t{{ ansible_hostname }}( .*)?$" -# line: "{{ contrail_address }}\t{{ ansible_hostname }}\\1" - regexp: "^{{ contrail_address }}\t{{ inventory_hostname }}( .*)?$" - line: "{{ contrail_address }}\t{{ inventory_hostname }}\\1" - backrefs: yes - - -- name: "make directory for contrail analytics" -# sudo: True - file: - path: "/var/lib/cassandra/data/ContrailAnalytics" - state: "directory" - - -- name: "modify cassandra conf" -# sudo: True - lineinfile: - dest: "/etc/cassandra/cassandra.yaml" - regexp: "{{ item.regexp }}" - line: "{{ item.line }}" - with_items: - - { regexp: "^(#(\\s*)?)?listen_address:", line: "listen_address: {{ contrail_address }}"} - - { regexp: "^(#(\\s*)?)?cluster_name:", line: "cluster_name: \"Contrail\"" } - - { regexp: "^(#(\\s*)?)?rpc_address:", line: "rpc_address: {{ contrail_address }}" } - - { regexp: "^(#(\\s*)?)?num_tokens:", line: "num_tokens: 256" } - - { regexp: "^(#(\\s*)?)?initial_token:", line: "# initial_token:" } - - - -- name: "set first database host seed" -# sudo: True - set_fact: -# dbseeds: "{{ hostvars[item.1][ contrail_address ] }}" - dbseeds: "{{ ip_settings[item.1]['br-prv']['ip'] }}" - with_indexed_items: groups['opencontrail'] - when: item.0 == 0 - - - - - -- name: "set second database host seed" -# sudo: True - set_fact: -# dbseeds: "{{ dbseeds }},{{ hostvars[item.1]['contrail_address'] }}" - dbseeds: "{{ dbseeds }},{{ ip_settings[item.1]['br-prv']['ip'] }}" - with_indexed_items: groups['opencontrail'] - when: item.0 == 1 - - -- name: "modify seeds list in cassandra conf" -# sudo: True - replace: - dest: "/etc/cassandra/cassandra.yaml" - regexp: "- seeds:.*$" - replace: "- seeds: {{ dbseeds }}" - - -- name: "modify cassandra env" -# sudo: True - replace: - dest: "/etc/cassandra/cassandra-env.sh" - regexp: "{{ item.regexp }}" - replace: "{{ item.replace }}" - with_items: - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -XX:\\+PrintGCDetails\"", replace: "JVM_OPTS=\"$JVM_OPTS -XX:+PrintGCDetails\"" } - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -Xss\\d+k\"", replace: "JVM_OPTS=\"$JVM_OPTS -Xss512k\"" } - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -XX:\\+PrintGCDateStamps\"", replace: "JVM_OPTS=\"$JVM_OPTS -XX:+PrintGCDateStamps\"" } - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -XX:\\+PrintHeapAtGC\"", replace: "JVM_OPTS=\"$JVM_OPTS -XX:+PrintHeapAtGC\"" } - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -XX:\\+PrintTenuringDistribution\"", replace: "JVM_OPTS=\"$JVM_OPTS -XX:+PrintTenuringDistribution\"" } - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -XX:\\+PrintGCApplicationStoppedTime\"", replace: "JVM_OPTS=\"$JVM_OPTS -XX:+PrintGCApplicationStoppedTime\"" } - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -XX:\\+PrintPromotionFailure\"", replace: "JVM_OPTS=\"$JVM_OPTS -XX:+PrintPromotionFailure\"" } - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -XX:PrintFLSStatistics=1\"", replace: "JVM_OPTS=\"$JVM_OPTS -XX:PrintFLSStatistics=1\"" } - - { regexp: "(#(\\s*)?)?JVM_OPTS=\"\\$JVM_OPTS -Xloggc:/var/log/cassandra/gc-`date \\+%s`\\.log\"", replace: "JVM_OPTS=\"$JVM_OPTS -Xloggc:/var/log/cassandra/gc-`date +%s`.log\"" } - - -- name: "modify zookeeper conf" -# sudo: True - lineinfile: - dest: "/etc/zookeeper/conf/zoo.cfg" - line: "{{ item }}" - with_items: - - "maxSessionTimeout=120000" - - "autopurge.purgeInterval=3" - - -- name: "modify zookeeper log4j properties" -# sudo: True - lineinfile: - dest: "/etc/zookeeper/conf/log4j.properties" - regexp: "(log4j.appender.ROLLINGFILE.MaxBackupIndex=.*)$" - line: "\\1" - backrefs: yes - - -- name: "add server addresses to zookeeper config" -# sudo: True - lineinfile: - dest: "/etc/zookeeper/conf/zoo.cfg" - regexp: "server.{{ item.0 + 1 }}=" -# line: "server.{{ item.0 + 1 }}={{ hostvars[item.1]['contrail_address'] }}:2888:3888" - line: "server.{{ item.0 + 1 }}={{ ip_settings[item.1]['br-prv']['ip'] }}:2888:3888" - with_indexed_items: groups['opencontrail'] - - -- name: "set zookeeper unique id" -# sudo: True - template: - src: "../../templates/provision/zookeeper-unique-id.j2" - dest: "/var/lib/zookeeper/myid" - with_indexed_items: groups['opencontrail'] - when: item.1 == inventory_hostname - - -- name: "remove kafka ini file" -# sudo: True - file: - path: "/etc/contrail/supervisord_database_files/kafka.ini" - state: "absent" - - -- name: "set first zookeeper host address" -# sudo: True - set_fact: -# zkaddrs: "{{ hostvars[item.1]['contrail_address'] }}:2181" - zkaddrs: "{{ ip_settings[item.1]['br-prv']['ip'] }}:2181" - with_indexed_items: groups['opencontrail'] - when: item.0 == 0 - - -- name: "set second or more zookeeper host addresses" -# sudo: True - set_fact: -# zkaddrs: "{{ zkaddrs }},{{ hostvars[item.1]['contrail_address'] }}:2181" - zkaddrs: "{{ zkaddrs }},{{ ip_settings[item.1]['br-prv']['ip'] }}:2181" - with_indexed_items: groups['opencontrail'] - when: item.0 > 0 - - -- name: "modify zookeeper host addresses in kafka properties" -# sudo: True - lineinfile: - dest: "/usr/share/kafka/config/server.properties" - regexp: "zookeeper.connect=" - line: "zookeeper.connect={{ zkaddrs }}" - - -- name: "modify kafka properties" -# sudo: True - lineinfile: - dest: "/usr/share/kafka/config/server.properties" - regexp: "default.replication.factor=" - line: "default.replication.factor=2" - - -- name: "fix up contrail database nodemgr config" -# sudo: True - ini_file: - dest: "/etc/contrail/contrail-database-nodemgr.conf" - section: "{{ item.section }}" - option: "{{ item.option }}" - value: "{{ item.value }}" - with_items: - - { section: "DEFAULT", option: "hostip", value: "{{ contrail_address }}" } - - { section: "DISCOVERY", option: "server", value: "{{ contrail_haproxy_address }}" } - - -- name: "restart zookeeper" -# sudo: True - service: - name: "zookeeper" - state: "restarted" - - -- name: "restart supervisor database" -# sudo: True - service: - name: "supervisor-database" - state: "restarted" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-increase-limits.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-increase-limits.yml deleted file mode 100755 index 89a4966f..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-increase-limits.yml +++ /dev/null @@ -1,60 +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 -############################################################################## ---- -#- hosts: [database, config, control, collector] -# sudo: yes -# tasks: -- name: "delete line" -# sudo: True - lineinfile: - dest: "/etc/limits.conf" - regexp: "^root\\s*soft\\s*nproc\\s*.*" - state: "absent" - -- name: "check EOF" -# sudo: True - lineinfile: - dest: "/etc/security/limits.conf" - regexp: "^# End of file" - line: "# End of file" - -- name: "add lines" -# sudo: True - lineinfile: - dest: "/etc/security/limits.conf" - regexp: "{{ item.regexp }}" - line: "{{ item.line }}" - insertbefore: "^# End of file" - with_items: - - { regexp: "^root\\s*hard\\s*nofile\\s*.*", line: "root hard nofile 65535" } - - { regexp: "^root\\s*soft\\s*nofile\\s*.*", line: "root soft nofile 65535" } - - { regexp: "^\\*\\s*hard\\s*nofile\\s*.*", line: "* hard nofile 65535" } - - { regexp: "^\\*\\s*soft\\s*nofile\\s*.*", line: "* soft nofile 65535" } - - { regexp: "^\\*\\s*hard\\s*nproc\\s*.*", line: "* hard nproc 65535" } - - { regexp: "^\\*\\s*soft\\s*nproc\\s*.*", line: "* soft nproc 65535" } - -- name: change value of sysctl fs.file-max -# sudo: True - sysctl: - name: "fs.file-max" - value: "65535" - -- name: "find supervisord conf files" -# sudo: True - shell: "find /etc/contrail -name supervisor*.conf -type f" - register: supervisordconfs - changed_when: no - -- name: "modify supervisord conf" -# sudo: True - replace: - dest: "{{ item }}" - regexp: "^minfds=\\d*" - replace: "minfds=10240" - with_items: supervisordconfs.stdout_lines diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml deleted file mode 100644 index d3426590..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml +++ /dev/null @@ -1,87 +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 -############################################################################## ---- -#- hosts: config -# sudo: yes -# tasks: -- name: turn off rabbitmq server on control node - shell: sed -i '/rabbitmq-server/d' /opt/service ; - -- name: "start supervisor support service" - service: - name: "supervisor-support-service" - state: "started" - -- name: "stop rabbitmq server via supervisor" - supervisorctl: - name: "rabbitmq-server" - state: "stopped" - server_url: "unix:///tmp/supervisord_support_service.sock" - -- include: -rabbitmq-stop.yml - -- name: "update hosts" - lineinfile: - dest: "/etc/hosts" - line: "{{ ip_settings[item]['br-prv']['ip'] }}\t{{ hostvars[item]['ansible_hostname'] }} {{ hostvars[item]['ansible_hostname'] }}-ctrl" - with_items: groups['opencontrail'] - -- name: "fix up rabbitmq env" - template: - src: "../../templates/provision/rabbitmq-env-conf.j2" - dest: "/etc/rabbitmq/rabbitmq-env.conf" - -- name: "fix up rabbitmq config for single node" - template: - src: "../../templates/provision/rabbitmq-conf-single.j2" - dest: "/etc/rabbitmq/rabbitmq.config" - when: groups['opencontrail'][1] is not defined - -- name: fix up rabbitmq config for multi nodes - template: - src: "../../templates/provision/rabbitmq-conf.j2" - dest: "/etc/rabbitmq/rabbitmq.config" - when: groups['opencontrail'][1] is defined - -- include: -rabbitmq-stop.yml - -#- name: "create cookie uuid temporary" -# local_action: -# module: "template" -# src: "templates/rabbitmq-cookie.j2" -# dest: "/tmp/tmp-rabbitmq-cookie" -# run_once: yes -# -#- name: "update cookie uuid" -# copy: -# src: "/tmp/tmp-rabbitmq-cookie" -# dest: "/var/lib/rabbitmq/.erlang.cookie" -# owner: "rabbitmq" -# group: "rabbitmq" -# mode: 0400 -# -#- name: "delete temporary cookie uuid" -# local_action: -# module: "file" -# dest: "/tmp/tmp-rabbitmq-cookie" -# state: "absent" -# run_once: yes - -- name: "start rabbitmq server" - service: - name: "rabbitmq-server" - state: "started" - -- name: add rabbitmq user - shell: > - rabbitmqctl add_user {{ RABBIT_USER }} {{ RABBIT_PASS }} ; - rabbitmqctl set_permissions {{ RABBIT_USER }} ".*" ".*" ".*" ; - -- name: "check rabbitmq server" - shell: netstat -lpen --tcp | grep beam | grep 5672; while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep beam | grep 5672; done diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml deleted file mode 100755 index 01687281..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml +++ /dev/null @@ -1,50 +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 -############################################################################## ---- -#- hosts: all -# sudo: yes -# tasks: -- name: "delete existing route file" -# sudo: True - file: - path: "/etc/network/if-up.d/routes" - state: absent - when: contrail_route - -- name: "create route file" -# sudo: True - file: - path: "/etc/network/if-up.d/routes" - owner: "root" - mode: 0755 - state: touch - when: contrail_route - - -- name: "add template" -# sudo: True - lineinfile: - dest: "/etc/network/if-up.d/routes" - line: "{{ item }}" - with_items: - - "#!/bin/bash" - - "[ \"$IFACE\" != {{ contrail_route[0].device }} ] && exit 0" - when: contrail_route - - -- name: "add static route" -# sudo: True - lineinfile: - dest: "/etc/network/if-up.d/routes" - line: "ip route add {{ item.ip }} via {{ item.gw }} dev {{ item.device }}" - state: "present" - with_items: - - "{{ contrail_route }}" - when: contrail_route - diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-toragent.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-toragent.yml deleted file mode 100755 index 3ae0bec9..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-toragent.yml +++ /dev/null @@ -1,85 +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 -############################################################################## ---- -#- hosts: tsn -# sudo: yes -# tasks: -- name: "create temporary directory for ssl files" - local_action: - module: "file" - dest: "/tmp/tmp-toragent-{{ item }}" - state: "directory" - with_items: - - "certs" - - "private" - run_once: yes - -- name: "create ssl files" - local_action: "shell openssl req -new -x509 -days 3650 -text -sha256 -newkey rsa:4096 -nodes -subj \"/C=US/ST=Global/O={{ item.1.vendor_name }}/CN={{ ansible_fqdn }}\" -keyout /tmp/tmp-toragent-private/tor.{{ item.0 }}.privkey.pem -out /tmp/tmp-toragent-certs/tor.{{ item.0 }}.cert.pem" - with_indexed_items: contrail_tor_agents - run_once: yes - -- name: "set tor agent list" - set_fact: - toragent_index: "{{ item.0 }}" - toragent_params: "{{ item.1 }}" - register: contrail_toragent_list - with_indexed_items: contrail_tor_agents - when: inventory_hostname in item.1.tsn_names - -- name: "fix up tor agent conf" - template: - src: "templates/contrail-tor-agent-conf.j2" - dest: "/etc/contrail/contrail-tor-agent-{{ item.ansible_facts.toragent_index }}.conf" - with_items: contrail_toragent_list.results - -- name: "fix up tor agent ini" - template: - src: "provision/contrail-tor-agent-ini.j2" - dest: "/etc/contrail/supervisord_vrouter_files/contrail-tor-agent-{{ item.ansible_facts.toragent_index }}.ini" - with_items: contrail_toragent_list.results - -- name: "copy init script" - shell: "cp /etc/init.d/contrail-vrouter-agent /etc/init.d/contrail-tor-agent-{{ item.ansible_facts.toragent_index }}" - with_items: contrail_toragent_list.results - -- name: "copy ssl certs" - copy: - src: "/tmp/tmp-toragent-certs/tor.{{ item.ansible_facts.toragent_index }}.cert.pem" - dest: "/etc/contrail/ssl/certs/tor.{{ item.ansible_facts.toragent_index }}.cert.pem" - with_items: contrail_toragent_list.results - -- name: "copy ssl private" - copy: - src: "/tmp/tmp-toragent-private/tor.{{ item.ansible_facts.toragent_index }}.privkey.pem" - dest: "/etc/contrail/ssl/private/tor.{{ item.ansible_facts.toragent_index }}.privkey.pem" - with_items: contrail_toragent_list.results - -- name: "copy ca cert" - copy: - src: "files/cacert.pem" - dest: "/etc/contrail/ssl/certs/cacert.pem" - -- name: "delete temporary directory" - local_action: - module: "file" - dest: "/tmp/tmp-toragent-{{ item }}" - state: "absent" - with_items: - - "certs" - - "private" - run_once: yes - -- name: "add tor agent to contrail" - shell: "python /opt/contrail/utils/provision_vrouter.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --openstack_ip {{ contrail_keystone_address }} --oper add --host_name {{ inventory_hostname }}-{{ item.ansible_facts.toragent_index }} --host_ip {{ contrail_address }} --router_type tor-agent" - with_items: contrail_toragent_list.results - -- name: "add device to contrail" - shell: "python /opt/contrail/utils/provision_physical_device.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --openstack_ip {{ contrail_keystone_address }} --oper add --device_name {{ item.ansible_facts.toragent_params.name }} --vendor_name {{ item.ansible_facts.toragent_params.vendor_name }} --product_name {{ item.ansible_facts.toragent_params.product_name }} --device_mgmt_ip {{ item.ansible_facts.toragent_params.address }} --device_tunnel_ip {{ item.ansible_facts.toragent_params.tunnel_address }} --device_tor_agent {{ inventory_hostname }}-{{ item.ansible_facts.toragent_index }} --device_tsn {{ inventory_hostname }}" - with_items: contrail_toragent_list.results diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-tsn.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-tsn.yml deleted file mode 100755 index 8bd6dc06..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-tsn.yml +++ /dev/null @@ -1,104 +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 -############################################################################## ---- -#- hosts: tsn -# sudo: yes -# tasks: - -- name: "enable supervisor vrouter" - file: - path: "/etc/init/supervisor-vrouter.override" - state: "absent" - -- include: -node-common.yml - -- name: "fix up vrouter nodemgr param" - template: - src: "provision/vrouter-nodemgr-param.j2" - dest: "/etc/contrail/vrouter_nodemgr_param" - -- name: "set contrail device name for ansible" - set_fact: - contrail_ansible_device: "ansible_{{ contrail_vhost_device }}" - -- name: "fix up default pmac" - template: - src: "provision/default-pmac.j2" - dest: "/etc/contrail/default_pmac" - -- name: "copy agent param config from template" - shell: "cp /etc/contrail/agent_param.tmpl /etc/contrail/agent_param" - -- name: "modify agent param config" - lineinfile: - dest: "/etc/contrail/agent_param" - regexp: "dev=__DEVICE__" - line: "dev={{ contrail_vhost_device }}" - -- name: "set vrouter agent mode" - set_fact: - contrail_vrouter_mode: "tsn" - -- name: "fix up contrail vrouter agent config" - template: - src: "../../templates/provision/contrail-vrouter-agent-conf.j2" - dest: "/etc/contrail/contrail-vrouter-agent.conf" - -- name: "delete lines for contrail interface" - shell: "{{ item }}" - with_items: - - "sed -e '/auto {{ contrail_vhost_device }}/,$d' /etc/network/interfaces > /tmp/contrail-interfaces-top" - - "sed -n -e '/auto {{ contrail_vhost_device }}/,$p' /etc/network/interfaces > /tmp/contrail-interfaces-bottom" - - "sed -i -e '/auto {{ contrail_vhost_device }}/d' /tmp/contrail-interfaces-bottom" - - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" - -- name: "delete lines for vrouter interface" - shell: "{{ item }}" - with_items: - - "sed -e '/auto vhost0/,$d' /etc/network/interfaces > /tmp/contrail-interfaces-top" - - "sed -n -e '/auto vhost0/,$p' /etc/network/interfaces > /tmp/contrail-interfaces-bottom" - - "sed -i -e '/auto vhost0/d' /tmp/contrail-interfaces-bottom" - - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" - -- name: "configure interface" - lineinfile: - dest: "/etc/network/interfaces" - line: "{{ item }}" - state: "present" - with_items: - - "auto {{ contrail_vhost_device }}" - - "iface {{ contrail_vhost_device }} inet manual" - - "\tpre-up ifconfig {{ contrail_vhost_device }} up" - - "\tpost-down ifconfig {{ contrail_vhost_device }} down" - - "auto vhost0" - - "iface vhost0 inet static" - - "\tpre-up /opt/contrail/bin/if-vhost0" - - "\tnetwork_name application" - - "\taddress {{ contrail_vhost_address }}" - - "\tnetmask {{ contrail_vhost_netmask }}" - -- name: "delete temporary files" - file: - dest: "{{ item }}" - state: "absent" - with_items: - - "/tmp/contrail-interfaces-top" - - "/tmp/contrail-interfaces-bottom" - -- name: "fix up contrail vrouter nodemgr config" - ini_file: - dest: "/etc/contrail/contrail-vrouter-nodemgr.conf" - section: "DISCOVERY" - option: "server" - value: "{{ contrail_haproxy_address }}" - -- name: "add tsn to contrail" - shell: "python /opt/contrail/utils/provision_vrouter.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --openstack_ip {{ contrail_keystone_address }} --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }} --router_type tor-service-node" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml deleted file mode 100755 index 525f4334..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml +++ /dev/null @@ -1,75 +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 -############################################################################## ---- -#- hosts: webui -# sudo: yes -# tasks: - -- name: "enable supervisor webui" - file: - path: "/etc/init/supervisor-webui.override" - state: "absent" - -- name: "redis-setup" - include: -redis-setup.yml - -- name: "node-common" - include: -node-common.yml - -- name: "set first cassandra host address" - set_fact: -# cassandra_addrs: "'{{ hostvars[item.1]['contrail_address'] }}'" - cassandra_addrs: "'{{ ip_settings[item.1]['br-prv']['ip'] }}'" - with_indexed_items: groups['opencontrail'] - when: item.0 == 0 - -- name: "set second or more cassandra host addresses" - set_fact: -# cassandra_addrs: "{{ cassandra_addrs }}, '{{ hostvars[item.1]['contrail_address'] }}'" - cassandra_addrs: "{{ cassandra_addrs }}, '{{ ip_settings[item.1]['br-prv']['ip'] }}'" - with_indexed_items: groups['opencontrail'] - when: item.0 > 0 - -- name: "modify webui global js" - lineinfile: - dest: "/etc/contrail/config.global.js" - regexp: "{{ item.regexp }}" - line: "{{ item.line }}" - with_items: - - { regexp: "^\\s*config.networkManager.ip", line: "config.networkManager.ip = '{{ contrail_haproxy_address }}';" } - - { regexp: "^\\s*config.imageManager.ip", line: "config.imageManager.ip = '{{ contrail_keystone_address }}';" } - - { regexp: "^\\s*config.computeManager.ip", line: "config.computeManager.ip = '{{ contrail_keystone_address }}';" } - - { regexp: "^\\s*config.identityManager.ip", line: "config.identityManager.ip = '{{ contrail_keystone_address }}';" } - - { regexp: "^\\s*config.storageManager.ip", line: "config.storageManager.ip = '{{ contrail_keystone_address }}';" } - - { regexp: "^\\s*config.cnfg.server_ip", line: "config.cnfg.server_ip = '{{ contrail_haproxy_address }}';" } - - { regexp: "^\\s*config.analytics.server_ip", line: "config.analytics.server_ip = '{{ contrail_haproxy_address }}';" } -# TODO: when I update ansibel version to 2.2, this playbook can't pass the test. ERROR log: "'cassandra_addrs' is undefined". -# - { regexp: "^\\s*config.cassandra.server_ips", line: "config.cassandra.server_ips = [{{ cassandra_addrs }}];" } - -- name: "modify webui userauth js" - lineinfile: - dest: "/etc/contrail/contrail-webui-userauth.js" - regexp: "{{ item.regexp }}" - line: "{{ item.line }}" - with_items: - - { regexp: "^\\s*auth.admin_user", line: "auth.admin_user = '{{ contrail_admin_user }}';" } - - { regexp: "^\\s*auth.admin_password", line: "auth.admin_password = '{{ contrail_admin_password }}';" } - - { regexp: "^\\s*auth.admin_tenant_name", line: "auth.admin_tenant_name = 'admin';" } - -- name: "create symbolic link from nodejs to node" - file: - src: "/usr/bin/node" - dest: "/usr/bin/nodejs" - state: "link" - -- name: "restart supervisor webui" - service: - name: "supervisor-webui" - state: "restarted" - diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml deleted file mode 100755 index 836cb78b..00000000 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- name: del ovs bridge - shell: ovs-vsctl del-br br-int; ovs-vsctl del-br br-tun; ovs-vsctl del-br br-prv; - -- name: remove ovs and ovs-plugin daeman - shell: > - sed -i '/neutron-openvswitch-agent/d' /opt/service ; - sed -i '/openvswitch-switch/d' /opt/service ; - -- name: stop ovs and ovs-plugin - shell: service openvswitch-switch stop; service neutron-openvswitch-agent stop; - -- name: remove ovs and ovs-plugin files - shell: > - update-rc.d -f neutron-openvswitch-agent remove; - mv /etc/init.d/neutron-openvswitch-agent /home/neutron-openvswitch-agent; - mv /etc/init/neutron-openvswitch-agent.conf /home/neutron-openvswitch-agent.conf; - update-rc.d -f openvswitch-switch remove ; - mv /etc/init.d/openvswitch-switch /home/openvswitch-switch ; - mv /etc/init/openvswitch-switch.conf /home/openvswitch-switch.conf ; - update-rc.d -f neutron-ovs-cleanup remove ; - mv /etc/init.d/neutron-ovs-cleanup /home/neutron-ovs-cleanup ; - mv /etc/init/neutron-ovs-cleanup.conf /home/neutron-ovs-cleanup.conf ; - -- name: remove ovs kernel module - shell: rmmod vport_vxlan; rmmod openvswitch; - ignore_errors: True - -- name: copy recovery script - copy: src={{ item }} dest=/opt/setup_networks - with_items: -# - recover_network_opencontrail.py - - setup_networks_opencontrail.py - -#- name: recover external script -# shell: python /opt/setup_networks/recover_network_opencontrail.py - -- name: modify net-init - shell: sed -i 's/setup_networks.py/setup_networks_opencontrail.py/g' /etc/init.d/net_init - -- name: resolve dual NIC problem - shell: > - echo "net.ipv4.conf.all.arp_ignore=1" >> /etc/sysctl.conf ; - /sbin/sysctl -p ; - echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore ; - -- cgit 1.2.3-korg