From 9c126332bee8bca7f5d8c8d8a5a9e6f9c0c0ae17 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Fri, 18 Oct 2019 10:32:02 +0100 Subject: [PATCH] Do not install Open vSwitch Open vSwitch packages are no longer present in the default, or EPEL repoistories. This means there is no clean way to install Open vSwitch on CentOS. Instead, we should leave it up the user to decide how to install it. Change-Id: Ie56296230c9840e542ac70d96dc68c285d198ad6 --- ansible/hypervisor_setup.yml | 24 +++------ ansible/vars/Debian.yml | 7 --- ansible/vars/RedHat.yml | 7 --- doc/source/install.rst | 4 ++ playbooks/openvswitch.yml | 49 +++++++++++++++++++ playbooks/tenks-deploy-teardown/pre.yml | 7 +-- playbooks/tenks-deploy-teardown/run.yml | 11 +++++ .../templates/requirements-overrides.yml.j2 | 4 ++ ...-install-openvswitch-651218091900ba27.yaml | 5 ++ 9 files changed, 83 insertions(+), 35 deletions(-) create mode 100644 playbooks/openvswitch.yml create mode 100644 releasenotes/notes/do-not-install-openvswitch-651218091900ba27.yaml diff --git a/ansible/hypervisor_setup.yml b/ansible/hypervisor_setup.yml index db8217a..82d6e7f 100644 --- a/ansible/hypervisor_setup.yml +++ b/ansible/hypervisor_setup.yml @@ -34,24 +34,12 @@ failed_when: false changed_when: false -- block: - - name: Ensure Open vSwitch package is installed - package: - name: "{{ tenks_openvswitch_pkg_name }}" - register: result - until: result is success - retries: 3 - become: true - - - name: Ensure Open vSwitch is started and enabled - service: - name: "{{ tenks_openvswitch_service_name }}" - state: started - enabled: true - become: true - # Assume a non-zero return code means the command does not exist. Do this - # check to avoid installing Open vSwitch system-wide if the command already - # exists as a link to a containerised version of OVS. +- name: Fail when Open vSwitch is not installed + fail: + msg: >- + Tenks requires openvswitch to be installed and running. Please install + openvswitch. If it is installed, please report this as a bug. + # Assume a non-zero return code means that openvswitch is not installed. when: ovs_vsctl_check.rc != 0 - name: Configure physical networks diff --git a/ansible/vars/Debian.yml b/ansible/vars/Debian.yml index 046fc5a..1a81a8c 100644 --- a/ansible/vars/Debian.yml +++ b/ansible/vars/Debian.yml @@ -2,10 +2,3 @@ # path to `ip` from the `iproute2` package tenks_ip_path: /sbin/ip - -# package that provides the Open vSwitch daemon and userspace -# utilities -tenks_openvswitch_pkg_name: openvswitch-switch - -# service name of Open vSwitch daemon (as passed the Ansible service module) -tenks_openvswitch_service_name: openvswitch-switch diff --git a/ansible/vars/RedHat.yml b/ansible/vars/RedHat.yml index aca26fc..91162ab 100644 --- a/ansible/vars/RedHat.yml +++ b/ansible/vars/RedHat.yml @@ -2,10 +2,3 @@ # path to `ip` from the `iproute2` package tenks_ip_path: /usr/sbin/ip - -# package that provides the Open vSwitch daemon and userspace -# utilities -tenks_openvswitch_pkg_name: openvswitch - -# service name of Open vSwitch daemon (as passed the Ansible service module) -tenks_openvswitch_service_name: openvswitch diff --git a/doc/source/install.rst b/doc/source/install.rst index 95c0a49..9884029 100644 --- a/doc/source/install.rst +++ b/doc/source/install.rst @@ -39,6 +39,10 @@ installed with a command such as:: $ yum install --assumeyes python-virtualenv git + Open vSwitch must be installed and running. Please see the + `Open vSwitch docs `_ + for more details. + Tenks Installation ------------------ diff --git a/playbooks/openvswitch.yml b/playbooks/openvswitch.yml new file mode 100644 index 0000000..a7c3468 --- /dev/null +++ b/playbooks/openvswitch.yml @@ -0,0 +1,49 @@ +--- +- hosts: hypervisors + vars: + ansible_become: true + tasks: + # Workaround for: + # http://mirror.ord.rax.opendev.org/epel/7/SRPMS/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found + # See: https://zuul.opendev.org/t/openstack/build/1fa5b2f895c54e7a81a064a2fff5f838/log/centos-7/ansible/tenks-deploy#501 + - block: + - name: Install epel release + package: + name: epel-release + + - name: Switch the broken mirror + ini_file: + path: /etc/yum.repos.d/epel.repo + section: epel-source + option: baseurl + value: http://download.fedoraproject.org/pub/epel/$releasever/SRPMS/ + + - name: Make sure metalink does not exist + ini_file: + path: /etc/yum.repos.d/epel.repo + section: epel-source + option: metalink + state: absent + + - name: Install Open vSwitch + include_role: + name: fkautz.openvswitch-install + when: ansible_os_family == "RedHat" + + - block: + - name: Install packages + package: + name: "{{ item }}" + register: result + until: result is success + retries: 3 + with_items: + - openvswitch-switch + - openvswitch-common + + - name: Start openvswitch service + service: + name: openvswitch-switch + state: started + when: ansible_os_family == "Debian" + diff --git a/playbooks/tenks-deploy-teardown/pre.yml b/playbooks/tenks-deploy-teardown/pre.yml index 00c5360..c5da09c 100644 --- a/playbooks/tenks-deploy-teardown/pre.yml +++ b/playbooks/tenks-deploy-teardown/pre.yml @@ -38,9 +38,10 @@ -p {{ tenks_src_dir }}/ansible/roles chdir: "{{ tenks_src_dir }}" - - name: Override Galaxy dependencies with equivalent modules from the zuul checkout - # We override so that as we add more dependenices we won't have to keep two files in - # sync + - name: Install dependencies for CI + # We install roles specifc to CI over the existing ones. This means that we + # don't have to keep the two requirements files in sync, as we just override + # some of them. vars: ansible_galaxy_bin: "{{ tenks_venv }}/bin/ansible-galaxy" command: diff --git a/playbooks/tenks-deploy-teardown/run.yml b/playbooks/tenks-deploy-teardown/run.yml index f1b1578..e8d6b27 100644 --- a/playbooks/tenks-deploy-teardown/run.yml +++ b/playbooks/tenks-deploy-teardown/run.yml @@ -6,6 +6,17 @@ - name: Include common variables include_vars: common.yml + - name: Install Open vSwitch + shell: + cmd: >- + {{ ansible_playbook_bin }} -vvv + --inventory ansible/inventory + --extra-vars=@{{ tenks_overrides_path }} + playbooks/openvswitch.yml > {{ logs_dir }}/ansible/tenks-deploy + chdir: "{{ tenks_src_dir }}" + environment: + ANSIBLE_ROLES_PATH: "{{ tenks_src_dir }}/ansible/roles" + - name: Deploy tenks cluster shell: cmd: >- diff --git a/playbooks/tenks-deploy-teardown/templates/requirements-overrides.yml.j2 b/playbooks/tenks-deploy-teardown/templates/requirements-overrides.yml.j2 index df7bbca..b94648b 100644 --- a/playbooks/tenks-deploy-teardown/templates/requirements-overrides.yml.j2 +++ b/playbooks/tenks-deploy-teardown/templates/requirements-overrides.yml.j2 @@ -8,3 +8,7 @@ - src: git+{{ stackhpc_libvirt_vm_src_dir }}/.git name: stackhpc.libvirt-vm + +# Roles for CI only +- src: https://github.com/stackhpc/ansible-roles-openvswitch-install + name: fkautz.openvswitch-install diff --git a/releasenotes/notes/do-not-install-openvswitch-651218091900ba27.yaml b/releasenotes/notes/do-not-install-openvswitch-651218091900ba27.yaml new file mode 100644 index 0000000..37a3971 --- /dev/null +++ b/releasenotes/notes/do-not-install-openvswitch-651218091900ba27.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Tenks no longer installs Open vSwitch. Please use your preferred method to + install Open vSwitch prior to running Tenks.