From 06da49c6e2778215797cbb28c384c0903fa3ab46 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 7 Nov 2018 08:12:20 +1100 Subject: [PATCH] bridge.o.o: Use latest openstacksdk Similar to the pinning introduced in Ic465efb637c0a1eb475f04b0b0e356d8797ecdeb, use the "latest" openstacksdk package and allow for passing of pinned versions if required. Update the devel test to also use the master of opensatcksdk Change-Id: I4b437ca9024c87903bdd3569c8309cde725ce28e --- .zuul.yaml | 3 +++ playbooks/bridge.yaml | 2 ++ playbooks/roles/install-ansible/README.rst | 18 +++++++++++++++ .../roles/install-ansible/tasks/main.yaml | 22 +++++++++++++++++-- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 3974478dd9..e631a10d3d 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -165,9 +165,12 @@ required-projects: - name: github.com/ansible/ansible override-checkout: devel + - name: openstack/openstacksdk vars: bridge_ansible_name: '{{ ansible_user_dir}}/src/github.com/ansible/ansible' bridge_ansible_version: null + bridge_openstacksdk_name: '{{ ansible_user_dir }}/src/git.openstack.org/openstack/openstacksdk' + bridge_openstacksdk_version: null - job: name: system-config-run-eavesdrop diff --git a/playbooks/bridge.yaml b/playbooks/bridge.yaml index 029de72cf2..a8b3756662 100644 --- a/playbooks/bridge.yaml +++ b/playbooks/bridge.yaml @@ -8,6 +8,8 @@ - role: install-ansible install_ansible_name: '{{ bridge_ansible_name | default("ansible") }}' install_ansible_version: '{{ bridge_ansible_version | default("2.7.0") }}' + install_openstacksdk_name: '{{ bridge_openstacksdk_name | default("openstacksdk") }}' + install_openstacksdk_version: '{{ bridge_openstacksdk_verison | default("latest") }}' - root-keys - ansible-cron - cloud-launcher-cron diff --git a/playbooks/roles/install-ansible/README.rst b/playbooks/roles/install-ansible/README.rst index 7f6e5f541a..1e887a83b6 100644 --- a/playbooks/roles/install-ansible/README.rst +++ b/playbooks/roles/install-ansible/README.rst @@ -19,3 +19,21 @@ Install and configure Ansible on a host via pip :zuul:rolevar:`install-ansible.install_ansible_name`. The special value "latest" will ensure ``state: latest`` is set for the package and thus the latest version is always installed. + +.. zuul:rolevar:: install_openstacksdk_name + :default: openstacksdk + + The name of the openstacksdk package to install. To install from + alternative sources, this can be a URL for a remote package; + e.g. to install from a gerrit change + ``git+https://git.openstack.org/openstack/openstacksdk@refs/changes/12/3456/1#egg=openstacksdk`` + +.. zuul:rolevar:: install_openstacksdk_version + :default: latest + + The version of the library from + :zuul:rolevar:`install-ansible.install_openstacksdk_name`. Set + this to empty (YAML ``null``) if specifying versions via + :zuul:rolevar:`install-ansible.install_openstacksdk_name`. The + special value "latest" will ensure ``state: latest`` is set for the + package and thus the latest version is always installed. diff --git a/playbooks/roles/install-ansible/tasks/main.yaml b/playbooks/roles/install-ansible/tasks/main.yaml index 21963b4042..9aa17e878a 100644 --- a/playbooks/roles/install-ansible/tasks/main.yaml +++ b/playbooks/roles/install-ansible/tasks/main.yaml @@ -25,10 +25,28 @@ version: '{{ _install_ansible_version | default(omit) }}' state: '{{ _install_ansible_state | default(omit) }}' +# Same version/state default swizzling as described above for +# openstacksdk +- name: Set openstacksdk default version to latest + set_fact: + install_openstacksdk_version: latest + when: install_openstacksdk_version is not defined + +- name: Set openstacksdk version for installation + set_fact: + _install_openstacksdk_version: '{{ install_openstacksdk_version }}' + when: install_openstacksdk_version not in ('', 'latest') + +- name: Set openstacksdk package state for installation + set_fact: + _install_openstacksdk_state: latest + when: install_openstacksdk_version == 'latest' + - name: Install openstacksdk pip: - state: latest - name: openstacksdk + name: '{{ install_openstacksdk_name | default("openstacksdk") }}' + version: '{{ _install_openstacksdk_version | default(omit) }}' + state: '{{ _install_openstacksdk_state | default(omit) }}' - name: Ensure /etc/ansible and /etc/ansible/hosts file: