diff --git a/.zuul.yaml b/.zuul.yaml index 76baacc29f..3974478dd9 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -157,6 +157,18 @@ - roles/.* - testinfra/.* +- job: + name: system-config-run-base-ansible-devel + parent: system-config-run-base + description: | + Run the base playbook with the latest ansible + required-projects: + - name: github.com/ansible/ansible + override-checkout: devel + vars: + bridge_ansible_name: '{{ ansible_user_dir}}/src/github.com/ansible/ansible' + bridge_ansible_version: null + - job: name: system-config-run-eavesdrop parent: system-config-run @@ -262,6 +274,7 @@ - puppet-beaker-rspec-puppet-4-infra-system-config - puppet-beaker-rspec-puppet-4-centos-7-infra-system-config - system-config-run-base + - system-config-run-base-ansible-devel - system-config-run-dns - system-config-run-eavesdrop - system-config-run-nodepool diff --git a/playbooks/bridge.yaml b/playbooks/bridge.yaml index a7d2d462fd..029de72cf2 100644 --- a/playbooks/bridge.yaml +++ b/playbooks/bridge.yaml @@ -3,7 +3,11 @@ become: true roles: - pip3 - - install-ansible + # Note for production use we expect to take the defaults; unit + # test jobs override this to test with latest upstream ansible. + - role: install-ansible + install_ansible_name: '{{ bridge_ansible_name | default("ansible") }}' + install_ansible_version: '{{ bridge_ansible_version | default("2.7.0") }}' - root-keys - ansible-cron - cloud-launcher-cron diff --git a/playbooks/roles/install-ansible/README.rst b/playbooks/roles/install-ansible/README.rst index d6eaee5f43..7f6e5f541a 100644 --- a/playbooks/roles/install-ansible/README.rst +++ b/playbooks/roles/install-ansible/README.rst @@ -2,4 +2,20 @@ Install and configure Ansible on a host via pip **Role Variables** -* None +.. zuul:rolevar:: install_ansible_name + :default: ansible + + The name of the ansible package to install. To install from + alternative sources, this can be a URL for a remote package; + e.g. to install from upstream devel branch + ``git+https://github.com/ansible/ansible.git@devel`` + +.. zuul:rolevar:: install_ansible_version + :default: latest + + The version of the library from + :zuul:rolevar:`install-ansible.install_ansible_name`. Set this to + empty (YAML ``null``) if specifying versions via URL in + :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. diff --git a/playbooks/roles/install-ansible/tasks/main.yaml b/playbooks/roles/install-ansible/tasks/main.yaml index 1f62456508..21963b4042 100644 --- a/playbooks/roles/install-ansible/tasks/main.yaml +++ b/playbooks/roles/install-ansible/tasks/main.yaml @@ -1,6 +1,29 @@ +# If ansible_install_version is not defined it should be "latest" +- name: Set ansible default version to latest + set_fact: + install_ansible_version: latest + when: install_ansible_version is not defined + +# If a version is not explicitly set we want to make sure to +# completely omit the version argument to pip, as it will be coming +# from the long-form install_ansible_name variable. Additionally, if +# the version is the special value "latest", then we also want to omit +# any version number, but also set the package state to "latest". +- name: Set ansible version for installation + set_fact: + _install_ansible_version: '{{ install_ansible_version }}' + when: install_ansible_version not in ('', 'latest') + +- name: Set ansible package state for installation + set_fact: + _install_ansible_state: latest + when: install_ansible_version == 'latest' + - name: Install ansible pip: - name: ansible + name: '{{ install_ansible_name | default("ansible") }}' + version: '{{ _install_ansible_version | default(omit) }}' + state: '{{ _install_ansible_state | default(omit) }}' - name: Install openstacksdk pip: @@ -56,3 +79,6 @@ name: logrotate vars: logrotate_file_name: /var/log/ansible/ansible.log + +- name: Verify ansible install + command: ansible --version