diff options
Diffstat (limited to 'xci/playbooks')
-rw-r--r-- | xci/playbooks/configure-localhost.yml | 30 | ||||
-rw-r--r-- | xci/playbooks/configure-opnfvhost.yml | 32 | ||||
-rw-r--r-- | xci/playbooks/configure-targethosts.yml | 11 | ||||
-rw-r--r-- | xci/playbooks/provision-vm-nodes.yml | 42 | ||||
-rwxr-xr-x | xci/playbooks/roles/configure-network/files/network-config-suse | 15 | ||||
-rw-r--r-- | xci/playbooks/roles/configure-network/tasks/main.yml | 49 | ||||
-rw-r--r-- | xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2 | 17 | ||||
-rw-r--r-- | xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2 | 1 | ||||
-rw-r--r-- | xci/playbooks/roles/configure-nfs/tasks/main.yml | 8 | ||||
-rw-r--r-- | xci/playbooks/roles/configure-nfs/vars/debian.yml | 2 | ||||
-rw-r--r-- | xci/playbooks/roles/configure-nfs/vars/suse.yml | 11 | ||||
-rw-r--r-- | xci/playbooks/roles/remove-folders/tasks/main.yml | 1 | ||||
-rw-r--r-- | xci/playbooks/roles/synchronize-time/tasks/main.yml | 27 |
13 files changed, 194 insertions, 52 deletions
diff --git a/xci/playbooks/configure-localhost.yml b/xci/playbooks/configure-localhost.yml index 2dfa0530..915d1959 100644 --- a/xci/playbooks/configure-localhost.yml +++ b/xci/playbooks/configure-localhost.yml @@ -9,20 +9,35 @@ ############################################################################## - hosts: localhost connection: local + become: yes vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml roles: - role: remove-folders + +- hosts: localhost + connection: local + vars_files: + - ../var/opnfv.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml + roles: - { role: clone-repository, project: "opnfv/releng-xci", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" } - { role: clone-repository, project: "openstack/openstack-ansible-openstack_openrc", repo: "{{ OPENSTACK_OSA_OPENRC_GIT_URL }}", dest: "{{ OPENSTACK_OSA_OPENRC_PATH }}", version: "master" } - hosts: localhost connection: local - gather_facts: false vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml - name: Synchronize local development releng-xci repository to XCI paths synchronize: src: "{{ OPNFV_RELENG_DEV_PATH }}" @@ -35,9 +50,11 @@ - hosts: localhost connection: local vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml - name: create log directory {{LOG_PATH}} file: path: "{{LOG_PATH}}" @@ -59,11 +76,12 @@ dest: "{{OPNFV_RELENG_PATH}}/xci/var" - hosts: localhost connection: local - gather_facts: false vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml - name: create certificate directory /etc/ssl/certs file: path: "/etc/ssl/certs" diff --git a/xci/playbooks/configure-opnfvhost.yml b/xci/playbooks/configure-opnfvhost.yml index d45c1be8..067a1176 100644 --- a/xci/playbooks/configure-opnfvhost.yml +++ b/xci/playbooks/configure-opnfvhost.yml @@ -9,21 +9,38 @@ ############################################################################## - hosts: opnfv remote_user: root + become: yes vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/flavor-vars.yml - ../var/opnfv.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml roles: - role: remove-folders + +- hosts: opnfv + remote_user: root + vars_files: + - ../var/flavor-vars.yml + - ../var/opnfv.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml + roles: - { role: clone-repository, project: "opnfv/releng-xci", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" } - { role: clone-repository, project: "openstack/openstack-ansible", repo: "{{ OPENSTACK_OSA_GIT_URL }}", dest: "{{ OPENSTACK_OSA_PATH }}", version: "{{ OPENSTACK_OSA_VERSION }}" } - hosts: opnfv remote_user: root vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml - name: Synchronize local development releng-xci repository to XCI paths synchronize: src: "{{ OPNFV_RELENG_DEV_PATH }}" @@ -44,9 +61,12 @@ - hosts: opnfv remote_user: root vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/flavor-vars.yml - ../var/opnfv.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml roles: - role: configure-network tasks: @@ -132,13 +152,15 @@ shell: "/bin/cat {{ ansible_env.HOME }}/.ssh/id_rsa.pub >> ../file/authorized_keys" - hosts: opnfv - gather_facts: no remote_user: root vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/flavor-vars.yml - ../var/opnfv.yml - "{{ XCI_FLAVOR_ANSIBLE_FILE_PATH }}/user_variables.yml" + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml roles: - role: "openstack-ansible-openstack_openrc" tasks: diff --git a/xci/playbooks/configure-targethosts.yml b/xci/playbooks/configure-targethosts.yml index 88da1312..4cee1df8 100644 --- a/xci/playbooks/configure-targethosts.yml +++ b/xci/playbooks/configure-targethosts.yml @@ -10,8 +10,11 @@ - hosts: controller remote_user: root vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/flavor-vars.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml roles: - role: configure-network # we need to force sync time with ntp or the nodes will be out of sync timewise @@ -20,8 +23,11 @@ - hosts: compute remote_user: root vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/flavor-vars.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml roles: - role: configure-network # we need to force sync time with ntp or the nodes will be out of sync timewise @@ -29,6 +35,5 @@ - hosts: compute00 remote_user: root - # TODO: this role is for configuring NFS on xenial and adjustment needed for other distros roles: - role: configure-nfs diff --git a/xci/playbooks/provision-vm-nodes.yml b/xci/playbooks/provision-vm-nodes.yml index e9b8fa2d..81fc5755 100644 --- a/xci/playbooks/provision-vm-nodes.yml +++ b/xci/playbooks/provision-vm-nodes.yml @@ -9,22 +9,35 @@ ############################################################################## - hosts: localhost connection: local + gather_facts: true + become: yes vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml roles: - # using these roles here ensures that we can reuse this playbook in different context - role: remove-folders + +- hosts: localhost + connection: local + gather_facts: true + vars_files: + - ../var/opnfv.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml + roles: - { role: clone-repository, project: "opnfv/releng-xci", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" } - { role: clone-repository, project: "opnfv/bifrost", repo: "{{ OPENSTACK_BIFROST_GIT_URL }}", dest: "{{ OPENSTACK_BIFROST_PATH }}", version: "{{ OPENSTACK_BIFROST_VERSION }}" } - hosts: localhost connection: local - gather_facts: false + gather_facts: true vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml - name: Synchronize local development bifrost repository to XCI paths # command module is much faster than the copy module synchronize: @@ -54,11 +67,13 @@ - hosts: localhost connection: local - gather_facts: false + gather_facts: true vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml - name: combine opnfv/releng-xci and openstack/bifrost scripts/playbooks copy: src: "{{ OPNFV_RELENG_PATH }}/bifrost/" @@ -68,21 +83,12 @@ connection: local become: yes vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.yml tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml - name: destroy VM nodes created by previous deployment command: "/bin/bash ./scripts/destroy-env.sh" args: chdir: "{{ OPENSTACK_BIFROST_PATH }}" - -- hosts: localhost - connection: local - vars_files: - - ../var/{{ ansible_os_family }}.yml - - ../var/opnfv.yml - tasks: - - name: create and provision VM nodes for the flavor {{ XCI_FLAVOR }} - command: "/bin/bash ./scripts/bifrost-provision.sh" - args: - chdir: "{{ OPENSTACK_BIFROST_PATH }}" diff --git a/xci/playbooks/roles/configure-network/files/network-config-suse b/xci/playbooks/roles/configure-network/files/network-config-suse new file mode 100755 index 00000000..1a9f1e7d --- /dev/null +++ b/xci/playbooks/roles/configure-network/files/network-config-suse @@ -0,0 +1,15 @@ +#!/bin/bash + +INTERFACE=$1 +ACTION=$4 + +if [[ $INTERFACE == "br-vlan" ]]; then + if [[ $ACTION == "pre-up" ]]; then + ip link add br-vlan-veth type veth peer name eth12 || true + ip link set br-vlan-veth up + ip link set eth12 up + else + ip link del br-vlan-veth || true + fi +fi + diff --git a/xci/playbooks/roles/configure-network/tasks/main.yml b/xci/playbooks/roles/configure-network/tasks/main.yml index df1580e5..126389d8 100644 --- a/xci/playbooks/roles/configure-network/tasks/main.yml +++ b/xci/playbooks/roles/configure-network/tasks/main.yml @@ -7,7 +7,11 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -# TODO: this role needs to be adjusted for different distros +- name: ensure glean rules are removed + file: + path: "/etc/udev/rules.d/99-glean.rules" + state: absent + - block: - name: configure modules lineinfile: @@ -19,10 +23,6 @@ modprobe: name: 8021q state: present - - name: ensure glean rules are removed - file: - path: "/etc/udev/rules.d/99-glean.rules" - state: absent - name: ensure interfaces.d folder is empty shell: "/bin/rm -rf /etc/network/interfaces.d/*" - name: ensure interfaces file is updated @@ -32,3 +32,42 @@ - name: restart network service shell: "/sbin/ifconfig {{ interface }} 0 && /sbin/ifdown -a && /sbin/ifup -a" when: ansible_os_family | lower == "debian" + +- block: + - name: Remove existing network configuration + file: + path: "/etc/sysconfig/network/{{ item }}" + state: absent + with_items: + - "ifcfg-eth0" + - "ifroute-eth0" + + - name: Configure networking on SUSE + template: + src: "{{ ansible_os_family | lower }}/suse.interface.j2" + dest: "/etc/sysconfig/network/ifcfg-{{ item.name }}" + with_items: + - { name: "{{ interface }}" } + - { name: "{{ interface }}.10", vlan_id: 10 } + - { name: "{{ interface }}.30", vlan_id: 30 } + - { name: "{{ interface }}.20", vlan_id: 20 } + - { name: "br-mgmt", bridge_ports: "{{ interface }}.10", ip: "{{ host_info[inventory_hostname].MGMT_IP }}/22" } + - { name: "br-vxlan", bridge_ports: "{{ interface }}.30", ip: "{{ host_info[inventory_hostname].VXLAN_IP }}/22" } + - { name: "br-vlan", bridge_ports: "{{ interface }}", ip: "{{ host_info[inventory_hostname].VLAN_IP }}/24" } + - { name: "br-storage", bridge_ports: "{{ interface }}.20", ip: "{{ host_info[inventory_hostname].STORAGE_IP }}/22" } + + - name: Add postup/postdown scripts on SUSE + copy: + src: "network-config-suse" + dest: "/etc/sysconfig/network/scripts/network-config-suse" + + - name: Configure routes on SUSE + template: + src: "{{ ansible_os_family | lower }}/suse.routes.j2" + dest: "/etc/sysconfig/network/ifroute-{{ item.name }}" + with_items: + - { name: "br-vlan", gateway: "192.168.122.1", route: "default" } + + - name: restart network service + shell: "/usr/sbin/wicked ifreload all" + when: ansible_os_family | lower == "suse" diff --git a/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2 b/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2 new file mode 100644 index 00000000..ffa418d4 --- /dev/null +++ b/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2 @@ -0,0 +1,17 @@ +STARTMODE='auto' +BOOTPROTO='static' +{% if item.vlan_id is defined %} +ETHERDEVICE={{ interface }} +VLAN_ID={{ item.vlan_id }} +{% endif %} +{% if item.bridge_ports is defined %} +BRIDGE='yes' +BRIDGE_FORWARDDELAY='0' +BRIDGE_STP=off +BRIDGE_PORTS={{ item.bridge_ports }} +{% endif %} +{% if item.ip is defined %} +IPADDR={{ item.ip }} +{% endif %} +PRE_UP_SCRIPT="compat:suse:network-config-suse" +POST_DOWN_SCRIPT="compat:suse:network-config-suse" diff --git a/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2 b/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2 new file mode 100644 index 00000000..7c868447 --- /dev/null +++ b/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2 @@ -0,0 +1 @@ +{{ item.route }} {{ item.gateway }} diff --git a/xci/playbooks/roles/configure-nfs/tasks/main.yml b/xci/playbooks/roles/configure-nfs/tasks/main.yml index 51a2d43a..25e81496 100644 --- a/xci/playbooks/roles/configure-nfs/tasks/main.yml +++ b/xci/playbooks/roles/configure-nfs/tasks/main.yml @@ -43,7 +43,13 @@ with_items: - "/images *(rw,sync,no_subtree_check,no_root_squash)" - "/volumes *(rw,sync,no_subtree_check,no_root_squash)" -- name: restart ubuntu xenial NFS service + +- name: Install the NFS server package + package: + name: "{{ nfs_server_package }}" + state: latest + +- name: restart NFS service service: name: "{{ nfs_server_service }}" state: restarted diff --git a/xci/playbooks/roles/configure-nfs/vars/debian.yml b/xci/playbooks/roles/configure-nfs/vars/debian.yml index 8d3c6561..cb3b2084 100644 --- a/xci/playbooks/roles/configure-nfs/vars/debian.yml +++ b/xci/playbooks/roles/configure-nfs/vars/debian.yml @@ -7,5 +7,5 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## - +nfs_server_package: "nfs-kernel-server" nfs_server_service: "nfs-kernel-server" diff --git a/xci/playbooks/roles/configure-nfs/vars/suse.yml b/xci/playbooks/roles/configure-nfs/vars/suse.yml new file mode 100644 index 00000000..01173d8a --- /dev/null +++ b/xci/playbooks/roles/configure-nfs/vars/suse.yml @@ -0,0 +1,11 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 Ericsson AB 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 +############################################################################## +nfs_server_package: "nfs-kernel-server" +nfs_server_service: "nfs-server" diff --git a/xci/playbooks/roles/remove-folders/tasks/main.yml b/xci/playbooks/roles/remove-folders/tasks/main.yml index 425b8dbf..cb81dae9 100644 --- a/xci/playbooks/roles/remove-folders/tasks/main.yml +++ b/xci/playbooks/roles/remove-folders/tasks/main.yml @@ -17,5 +17,6 @@ - "{{ OPENSTACK_BIFROST_PATH }}" - "{{ OPENSTACK_OSA_PATH }}" - "{{ OPENSTACK_OSA_ETC_PATH }}" + - "{{ XCI_DEVEL_ROOT }}" - "{{ LOG_PATH }} " - "{{ OPNFV_SSH_HOST_KEYS_PATH }}" diff --git a/xci/playbooks/roles/synchronize-time/tasks/main.yml b/xci/playbooks/roles/synchronize-time/tasks/main.yml index 985c1515..cc73c447 100644 --- a/xci/playbooks/roles/synchronize-time/tasks/main.yml +++ b/xci/playbooks/roles/synchronize-time/tasks/main.yml @@ -7,16 +7,17 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -# TODO: this role needs to be adjusted for different distros -- block: - - name: restart chrony - service: - name: chrony - state: restarted - - name: synchronize time - shell: "chronyc -a 'burst 4/4' && chronyc -a makestep" - register: chrony_got_time - until: chrony_got_time.rc == 0 - retries: 5 - delay: 5 - when: ansible_distribution_release == "xenial" +- name: install chrony + package: + name: "chrony" + state: latest +- name: restart chrony + service: + name: chrony + state: restarted +- name: synchronize time + shell: "chronyc -a 'burst 4/4' && chronyc -a makestep" + register: chrony_got_time + until: chrony_got_time.rc == 0 + retries: 5 + delay: 5 |