Bump Ansible version for tests repo

Current Ansible version for tests repo, which is used for functional
tests can not deal with some more modern logic, causing CI to fail
for Ubuntu Jammy on apt_package_pinning for Galera role.

Updating Ansible version fixes the issue.

Change-Id: I70838dc4fb1cadfcf579b5e9af5769a8f48108da
This commit is contained in:
Dmitriy Rabotyagov 2024-06-06 12:26:54 +02:00 committed by Jonathan Rosser
parent d163850d7c
commit 003fdfaa5b
17 changed files with 109 additions and 109 deletions

View File

@ -20,6 +20,7 @@
delegate_to: localhost delegate_to: localhost
- name: Set nodepool vars - name: Set nodepool vars
when: ci_mirror_info.stat.exists
block: block:
- name: Discover variables from OpenStack's CI environment when in nodepool - name: Discover variables from OpenStack's CI environment when in nodepool
shell: | shell: |
@ -66,4 +67,3 @@
pip_links: pip_links:
- name: "infra_wheel_mirror" - name: "infra_wheel_mirror"
link: "{{ pip_wheel_mirror }}" link: "{{ pip_wheel_mirror }}"
when: ci_mirror_info.stat.exists

View File

@ -17,7 +17,7 @@
become: true become: true
gather_facts: no gather_facts: no
tasks: tasks:
- name: netstat package is installed - name: Netstat package is installed
package: package:
name: net-tools name: net-tools
state: present state: present
@ -27,7 +27,7 @@
register: listening_ports register: listening_ports
changed_when: false changed_when: false
- name: create report - name: Create report
copy: copy:
content: | content: |
{% for host in ansible_play_hosts %} {% for host in ansible_play_hosts %}
@ -39,6 +39,6 @@
{% endfor %} {% endfor %}
dest: /tmp/listening_port_report.txt dest: /tmp/listening_port_report.txt
mode: 0644 mode: "0644"
delegate_to: localhost delegate_to: localhost
run_once: true run_once: true # noqa: run-once[task]

View File

@ -1,34 +1,34 @@
collections: collections:
- name: https://opendev.org/openstack/ansible-collections-openstack - name: https://opendev.org/openstack/ansible-collections-openstack
version: 2.1.0 version: 2.2.0
type: git type: git
- name: https://opendev.org/openstack/ansible-config_template - name: https://opendev.org/openstack/ansible-config_template
version: 1.2.1 version: 2.1.0
type: git type: git
- name: https://github.com/ansible-collections/community.general - name: https://github.com/ansible-collections/community.general
version: 4.0.1 version: 8.2.0
type: git type: git
- name: https://github.com/ansible-collections/community.rabbitmq - name: https://github.com/ansible-collections/community.rabbitmq
version: 1.1.0 version: 1.2.3
type: git type: git
- name: https://github.com/ansible-collections/community.mysql - name: https://github.com/ansible-collections/community.mysql
version: 2.3.1 version: 3.8.0
type: git type: git
- name: https://github.com/ansible-collections/community.crypto - name: https://github.com/ansible-collections/community.crypto
version: 2.11.1 version: 2.16.2
type: git type: git
- name: https://github.com/ansible-collections/ansible.posix - name: https://github.com/ansible-collections/ansible.posix
version: 1.3.0 version: 1.5.4
type: git type: git
# NOTE(noonedeadpunk): needs version in galaxy.yml to pull from git # NOTE(noonedeadpunk): needs version in galaxy.yml to pull from git
- name: openvswitch.openvswitch - name: openvswitch.openvswitch
version: 2.0.2 version: 2.1.1
source: https://galaxy.ansible.com source: https://galaxy.ansible.com
- name: ansible.netcommon - name: ansible.netcommon
version: 2.5.1 version: 6.0.0
source: https://galaxy.ansible.com source: https://galaxy.ansible.com
- name: ansible.utils - name: ansible.utils
version: 2.5.2 version: 3.0.0
source: https://galaxy.ansible.com source: https://galaxy.ansible.com
- name: https://opendev.org/openstack/openstack-ansible-plugins - name: https://opendev.org/openstack/openstack-ansible-plugins
version: master version: master

View File

@ -8,7 +8,7 @@
# target configuration in each role. # target configuration in each role.
# The Ansible version used for testing # The Ansible version used for testing
ansible-core==2.12.8 ansible-core==2.15.9
# Used for the ip filter within ansible # Used for the ip filter within ansible
netaddr netaddr

View File

@ -45,5 +45,5 @@ source "${COMMON_TESTS_PATH}/test-ansible-env-prep.sh"
# Execute ansible-lint. We do not want to test dependent roles located # Execute ansible-lint. We do not want to test dependent roles located
# in $HOME/.ansible/roles since we only care about the role we are currently # in $HOME/.ansible/roles since we only care about the role we are currently
# testing. # testing.
ANSIBLE_LINT_WARNINGS="-w 208 -w 306 -w 502 -w 503 -w var-naming -w role-name -w metadata" ANSIBLE_LINT_WARNINGS="-w 208 -w 306 -w 502 -w 503 -w var-naming -w role-name -w metadata -w fqcn -w yaml[truthy]"
ansible-lint ${ANSIBLE_LINT_PARAMS} ${ANSIBLE_LINT_WARNINGS} --exclude=$HOME/.ansible/roles ${TEST_PLAYBOOK} ansible-lint ${ANSIBLE_LINT_PARAMS} ${ANSIBLE_LINT_WARNINGS} --exclude=$HOME/.ansible/roles ${TEST_PLAYBOOK}

View File

@ -21,11 +21,11 @@
# This is a set of configuration options for Ansible. # This is a set of configuration options for Ansible.
[defaults] [defaults]
transport = ssh transport = openstack.osa.ssh
host_key_checking = False host_key_checking = False
control_path = /tmp/%%h-%%r control_path = /tmp/%%h-%%r
ssh_args = -o ControlMaster=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=64 -o ServerAliveCountMax=1024 -o Compression=no -o TCPKeepAlive=yes -o VerifyHostKeyDNS=no -o ForwardX11=no -o ForwardAgent=yes ssh_args = -o ControlMaster=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=64 -o ServerAliveCountMax=1024 -o Compression=no -o TCPKeepAlive=yes -o VerifyHostKeyDNS=no -o ForwardX11=no -o ForwardAgent=yes
library = $HOME/.ansible/roles/config_template/library:$HOME/.ansible/plugins/library:$HOME/.ansible/roles/ceph-ansible/library library = $HOME/.ansible/plugins/library:$HOME/.ansible/roles/ceph-ansible/library
callback_plugins = $HOME/.ansible/plugins/callback:$HOME/.ansible/roles/ceph-ansible/plugins/callback callback_plugins = $HOME/.ansible/plugins/callback:$HOME/.ansible/roles/ceph-ansible/plugins/callback
action_plugins = $HOME/.ansible/roles/config_template/action:$HOME/.ansible/roles/ceph-ansible/plugins/actions action_plugins = $HOME/.ansible/roles/ceph-ansible/plugins/actions
roles_path = $HOME/.ansible/roles:$HOME/.ansible/testing-role roles_path = $HOME/.ansible/roles:$HOME/.ansible/testing-role

View File

@ -13,8 +13,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- import_playbook: test-install-memcached.yml - name: Importing test-install-memcached
import_playbook: test-install-memcached.yml
- import_playbook: test-install-rabbitmq.yml - name: Importing test-install-rabbitmq
import_playbook: test-install-rabbitmq.yml
- import_playbook: test-install-galera.yml - name: Importing test-install-galera
import_playbook: test-install-galera.yml

View File

@ -82,6 +82,7 @@ COMMON_ETC_LOG_NAMES="almanach \
searchlight \ searchlight \
sasl2 \ sasl2 \
swift \ swift \
ssh \
sysconfig/network-scripts \ sysconfig/network-scripts \
sysconfig/network \ sysconfig/network \
systemd/network \ systemd/network \

View File

@ -25,7 +25,8 @@
tasks: tasks:
- include_tasks: "common-tasks/test-set-nodepool-vars.yml" - include_tasks: "common-tasks/test-set-nodepool-vars.yml"
- import_playbook: destroy_containers.yml - name: Importing destroy_containers
import_playbook: destroy_containers.yml
when: destroy_first | default(True) | bool when: destroy_first | default(True) | bool
- name: Playbook for creating containers - name: Playbook for creating containers

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- import_playbook: test-repo-setup.yml - name: Importing test-repo-setup
import_playbook: test-repo-setup.yml
- name: Playbook for configuring hosts - name: Playbook for configuring hosts
hosts: localhost hosts: localhost
@ -34,16 +35,6 @@
tags: tags:
- skip_ansible_lint - skip_ansible_lint
- name: Set ssh key fact
set_fact:
lxc_container_ssh_key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
- name: Ensure roots new public ssh key is in authorized_keys
authorized_key:
user: root
key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
manage_dir: no
# This is a very dirty hack due to images.linuxcontainers.org # This is a very dirty hack due to images.linuxcontainers.org
# constantly failing to resolve in openstack-infra. # constantly failing to resolve in openstack-infra.
- name: Implement hard-coded hosts entries for consistently failing name - name: Implement hard-coded hosts entries for consistently failing name
@ -82,7 +73,8 @@
openrc_openstack_client_config_dir_owner: "root" openrc_openstack_client_config_dir_owner: "root"
openrc_clouds_yml_file_owner: "root" openrc_clouds_yml_file_owner: "root"
- import_playbook: test-install-openstack-hosts.yml - name: Importing test-install-openstack-hosts
import_playbook: test-install-openstack-hosts.yml
- name: Playbook for configuring the LXC host - name: Playbook for configuring the LXC host
hosts: localhost hosts: localhost
@ -127,14 +119,14 @@
vars: vars:
systemd_interface_cleanup: true systemd_interface_cleanup: true
systemd_run_networkd: true systemd_run_networkd: true
systemd_netdevs: |- # noqa var-spacing systemd_netdevs: |- # noqa jinja[spacing]
{% set systemd_network_devices = [] %} {% set systemd_network_devices = [] %}
{% for interface in (bridges | default([])) %} {% for interface in (bridges | default([])) %}
{% if interface is string %} {% if interface is string %}
{% set _ = systemd_network_devices.append({'NetDev': {'Name': 'dummy-' + interface, 'Kind': 'dummy'}}) %} {% set _ = systemd_network_devices.append({'NetDev': {'Name': 'dummy-' + interface, 'Kind': 'dummy'}}) %}
{% set _ = systemd_network_devices.append({'NetDev': {'Name': interface, 'Kind': 'bridge'}}) %} {% set _ = systemd_network_devices.append({'NetDev': {'Name': interface, 'Kind': 'bridge'}}) %}
{% else %} {% else %}
{% set interface_name = (interface.name | default('br-mgmt')) %} {% set interface_name = interface.name | default('br-mgmt') %}
{% set _ = systemd_network_devices.append({'NetDev': {'Name': 'dummy-' + interface_name, 'Kind': 'dummy'}}) %} {% set _ = systemd_network_devices.append({'NetDev': {'Name': 'dummy-' + interface_name, 'Kind': 'dummy'}}) %}
{% set _ = systemd_network_devices.append({'NetDev': {'Name': interface_name, 'Kind': 'bridge'}}) %} {% set _ = systemd_network_devices.append({'NetDev': {'Name': interface_name, 'Kind': 'bridge'}}) %}
{% if interface.veth_peer is defined %} {% if interface.veth_peer is defined %}
@ -228,7 +220,7 @@
{% if interface is string %} {% if interface is string %}
{% set interface_name = interface %} {% set interface_name = interface %}
{% else %} {% else %}
{% set interface_name = (interface.name | default('br-mgmt')) %} {% set interface_name = interface.name | default('br-mgmt') %}
{% endif %} {% endif %}
{% set _ = interfaces.append(hostvars[inventory_hostname][('ansible_' + (interface_name | replace('-', '_')))]['active'] | bool) %} {% set _ = interfaces.append(hostvars[inventory_hostname][('ansible_' + (interface_name | replace('-', '_')))]['active'] | bool) %}
{% endfor %} {% endfor %}

View File

@ -33,11 +33,9 @@
mode: "0700" mode: "0700"
- name: Create ssh key pair for root - name: Create ssh key pair for root
user: community.crypto.openssh_keypair:
name: root path: /root/.ssh/id_rsa
generate_ssh_key: yes comment: "openstack-ansible-tests generated"
ssh_key_bits: 2048
ssh_key_file: /root/.ssh/id_rsa
- name: Get root private key - name: Get root private key
slurp: slurp:
@ -55,14 +53,12 @@
set_fact: set_fact:
root_public_key: "{{ public_key_get.content | b64decode }}" root_public_key: "{{ public_key_get.content | b64decode }}"
root_private_key: "{{ private_key_get.content | b64decode }}" root_private_key: "{{ private_key_get.content | b64decode }}"
lxc_container_ssh_key: "{{ public_key_get.content | b64decode }}"
- name: Ensure root can ssh to localhost - name: Add root ssh key to authorized_keys
authorized_key: authorized_key:
user: "root" user: "root"
key: "{{ root_public_key }}" key: "{{ root_public_key }}"
# Note(hwoarang): # Note(hwoarang):
# This uses local connection for the initial key setup # This uses local connection for the initial key setup
# as no key is setup to allow a connection to localhost # as no key is setup to allow a connection to localhost
@ -72,12 +68,18 @@
connection: local connection: local
become: no become: no
any_errors_fatal: true any_errors_fatal: true
vars:
_user_id: "{{ lookup('env', 'USER') }}"
tasks: tasks:
- name: Run following tasks only when current user is not root
when:
- _user_id != 'root'
block:
# Shell used because facts may not be ready yet # Shell used because facts may not be ready yet
- name: Get user home directory - name: Get user home directory
shell: | shell: |
set -o pipefail set -o pipefail
getent passwd '{{ ansible_user_id }}' | cut -d':' -f6 getent passwd '{{ _user_id }}' | cut -d':' -f6
args: args:
executable: /bin/bash executable: /bin/bash
register: user_home register: user_home
@ -91,34 +93,30 @@
file: file:
path: "{{ calling_user_home }}/.ssh" path: "{{ calling_user_home }}/.ssh"
state: directory state: directory
owner: "{{ ansible_user_id }}" owner: "{{ _user_id }}"
group: "{{ ansible_user_gid }}" group: "{{ _user_id }}"
mode: "0700" mode: "0700"
when: ansible_user_id != 'root'
- name: Ensure user has the known private key - name: Ensure user has the known private key
copy: copy:
content: "{{ root_private_key }}" content: "{{ root_private_key }}"
dest: "{{ calling_user_home }}/.ssh/id_rsa" dest: "{{ calling_user_home }}/.ssh/id_rsa"
owner: "{{ ansible_user_id }}" owner: "{{ _user_id }}"
group: "{{ ansible_user_gid }}" group: "{{ _user_id }}"
mode: "0600" mode: "0600"
when: ansible_user_id != 'root'
- name: Ensure user has the known public key - name: Ensure user has the known public key
copy: copy:
content: "{{ root_public_key }}" content: "{{ root_public_key }}"
dest: "{{ calling_user_home }}/.ssh/id_rsa.pub" dest: "{{ calling_user_home }}/.ssh/id_rsa.pub"
owner: "{{ ansible_user_id }}" owner: "{{ _user_id }}"
group: "{{ ansible_user_gid }}" group: "{{ _user_id }}"
mode: "0600" mode: "0600"
when: ansible_user_id != 'root'
- name: Ensure local user can ssh to localhost - name: Ensure local user can ssh to localhost
authorized_key: authorized_key:
user: "{{ ansible_user_id }}" user: "{{ _user_id }}"
key: "{{ root_public_key }}" key: "{{ root_public_key }}"
when: ansible_user_id != 'root'
- name: Create SSHD CA - name: Create SSHD CA
hosts: "{{ openstack_ssh_keypairs_setup_host | default('localhost') }}" hosts: "{{ openstack_ssh_keypairs_setup_host | default('localhost') }}"
@ -139,7 +137,7 @@
- name: Create CA certificates - name: Create CA certificates
hosts: "{{ openstack_pki_setup_host | default('localhost') }}" hosts: "{{ openstack_pki_setup_host | default('localhost') }}"
gather_facts: "false" gather_facts: false
become: true become: true
tasks: tasks:
- name: "Create CA certificates" - name: "Create CA certificates"

View File

@ -24,7 +24,7 @@
file: file:
state: directory state: directory
path: "{{ development_repo_directory }}" path: "{{ development_repo_directory }}"
mode: 0755 mode: "0755"
# Git clones for developer testing are expected to be in the # Git clones for developer testing are expected to be in the
# following structure, which mirrors how zuul v3 implements # following structure, which mirrors how zuul v3 implements
@ -51,7 +51,7 @@
{% for folder_path in projects_directory_find.stdout_lines %} {% for folder_path in projects_directory_find.stdout_lines %}
file://{{ folder_path }}#egg={{ folder_path.split("/")[-1] }} file://{{ folder_path }}#egg={{ folder_path.split("/")[-1] }}
{% endfor %} {% endfor %}
mode: 0755 mode: "0755"
vars_files: vars_files:
- test-vars.yml - test-vars.yml

View File

@ -19,7 +19,7 @@
# Used for lint tests # Used for lint tests
bashate>=0.5.1 # Apache-2.0 bashate>=0.5.1 # Apache-2.0
flake8==3.8.3 # MIT flake8==3.8.3 # MIT
ansible-lint==5.3.2 # MIT ansible-lint==6.22.1 # MIT
# Used to help make SNI connections work from python # Used to help make SNI connections work from python
# if python itself does not support it properly (<2.7.9). # if python itself does not support it properly (<2.7.9).

View File

@ -1,7 +1,7 @@
[all] [all]
localhost localhost ansible_connection=local ansible_become=True is_metal=true physical_host=aio1
infra1 ansible_host=10.1.0.2 ansible_become=True ansible_user=root container_name=infra1 infra1 ansible_host=10.1.0.2 ansible_become=True ansible_user=root container_name=infra1 container_tech=lxc
keystone1 ansible_host=10.1.0.3 ansible_become=True ansible_user=root container_name=keystone1 keystone1 ansible_host=10.1.0.3 ansible_become=True ansible_user=root container_name=keystone1 container_tech=lxc
[all_containers] [all_containers]
infra1 infra1

View File

@ -14,22 +14,29 @@
# limitations under the License. # limitations under the License.
# Prepare the user ssh keys # Prepare the user ssh keys
- import_playbook: common/test-prepare-keys.yml - name: Importing test-prepare-keys
import_playbook: common/test-prepare-keys.yml
# Prepare the host # Prepare the host
- import_playbook: common/test-prepare-host.yml - name: Importing test-prepare-host
import_playbook: common/test-prepare-host.yml
# Prepare the containers # Prepare the containers
- import_playbook: common/test-prepare-containers.yml - name: Importing test-prepare-containers
import_playbook: common/test-prepare-containers.yml
# Install RabbitMQ/MariaDB/Memcached # Install RabbitMQ/MariaDB/Memcached
- import_playbook: common/test-install-infra.yml - name: Importing test-install-infra
import_playbook: common/test-install-infra.yml
# Install Keystone # Install Keystone
- import_playbook: common/test-install-keystone.yml - name: Importing test-install-keystone
import_playbook: common/test-install-keystone.yml
# Install Tempest # Install Tempest
- import_playbook: common/test-install-tempest.yml - name: Importing test-install-tempest
import_playbook: common/test-install-tempest.yml
# Gather port status # Gather port status
- import_playbook: common/listening-port-report.yml - name: Importing listening-port-report
import_playbook: common/listening-port-report.yml

View File

@ -75,7 +75,6 @@
- name: openstack/openstack-ansible-nspawn_container_create - name: openstack/openstack-ansible-nspawn_container_create
- name: openstack/openstack-ansible-nspawn_hosts - name: openstack/openstack-ansible-nspawn_hosts
- name: openstack/requirements - name: openstack/requirements
override-checkout: stable/2023.2
pre-run: zuul.d/playbooks/pre-gate-cleanup.yml pre-run: zuul.d/playbooks/pre-gate-cleanup.yml
run: zuul.d/playbooks/run.yml run: zuul.d/playbooks/run.yml
post-run: zuul.d/playbooks/post.yml post-run: zuul.d/playbooks/post.yml
@ -99,7 +98,6 @@
timeout: 5400 # 90 mins timeout: 5400 # 90 mins
vars: vars:
tox_env: functional tox_env: functional
services_branch: stable/2023.2
- job: - job:
name: openstack-ansible-linters name: openstack-ansible-linters
@ -108,7 +106,7 @@
Run lint tests for an OpenStack-Ansible project. Run lint tests for an OpenStack-Ansible project.
Uses tox with the ``linters`` environment. Uses tox with the ``linters`` environment.
timeout: 1800 # 30 mins timeout: 1800 # 30 mins
nodeset: ubuntu-focal nodeset: ubuntu-jammy
vars: vars:
tox_env: linters tox_env: linters