Skip to content
Snippets Groups Projects
Commit 612b6076 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

CI: Test modules against different Ansible versions.

Currently, upstream CI test documentation against different Ansible
versions, but playbook tests are only executed with Ansible 2.9 series.
This patch add support for running playbook tests against Ansible 2.9,
ansible-core 2.11, and against latest version of Ansible.

As running all the tests for every PR would take too long, the tests
for every PR use only Anisble 2.9, and are executed on Fedora-latest
and CentOS 7 and 8.

A new pipeline for nightly tests was added, which runs the tests in the
same distros, using Ansible 2.9, latest and Ansible-core 2.11.
parent d6eaf912
No related branches found
No related tags found
No related merge requests found
--- ---
# IPA depends on IPv6 and without it dirsrv service won't start. # IPA depends on IPv6 and without it dirsrv service won't start.
- name: Ensure IPv6 is ENABLED - name: Ensure IPv6 is ENABLED
sysctl: ansible.posix.sysctl:
name: "{{ item.name }}" name: "{{ item.name }}"
value: "{{ item.value }}" value: "{{ item.value }}"
sysctl_set: yes sysctl_set: yes
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
# This is needed in some IPA versions in order to get KRA enabled. # This is needed in some IPA versions in order to get KRA enabled.
# See https://pagure.io/freeipa/issue/7906 for more information. # See https://pagure.io/freeipa/issue/7906 for more information.
- name: stat protected_regular - name: stat protected_regular
stat: ansible.builtin.stat:
path: /proc/sys/fs/protected_regular path: /proc/sys/fs/protected_regular
register: result register: result
- name: Ensure fs.protected_regular is disabled - name: Ensure fs.protected_regular is disabled
sysctl: ansible.posix.sysctl:
name: fs.protected_regular name: fs.protected_regular
value: '0' value: 0
sysctl_set: yes sysctl_set: yes
state: present state: present
reload: yes reload: yes
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# To avoid this problem we create the directories before starting IPA. # To avoid this problem we create the directories before starting IPA.
- name: Ensure lock dirs for DS exists - name: Ensure lock dirs for DS exists
file: ansible.builtin.file:
state: directory state: directory
owner: dirsrv owner: dirsrv
group: dirsrv group: dirsrv
...@@ -22,6 +22,6 @@ ...@@ -22,6 +22,6 @@
- /var/lock/dirsrv/slapd-TEST-LOCAL/ - /var/lock/dirsrv/slapd-TEST-LOCAL/
- name: Ensure IPA server is up an running - name: Ensure IPA server is up an running
service: ansible.builtin.service:
name: ipa name: ipa
state: started state: started
...@@ -3,5 +3,4 @@ pytest>=2.7 ...@@ -3,5 +3,4 @@ pytest>=2.7
pytest-sourceorder>=0.5 pytest-sourceorder>=0.5
pytest-split-tests>=1.0.3 pytest-split-tests>=1.0.3
pytest-testinfra>=5.0 pytest-testinfra>=5.0
jmespath>=0.9 # needed for the `json_query` filter
pyyaml>=3 pyyaml>=3
# Using Ansible 2.10.0a1 under Azure there might happen that the output of a
# task is changed if a module uses no_log = True for an attribute.
#
# For example, if the output of the module should contain "changed: True", and
# an attribute with no_log set contains the value `hang` it might happen that
# the output is modified to "c******ed: True", and if this output is further
# processed (registering the result and comparing the value of `changed`),
# the test might fail, but not because of module code, but because of unexpected
# output processing.
#
# This behavior was, currently, only reproduced with Ansible 2.10.0a1 running
# under Azure.
--- ---
trigger: trigger:
- master - master
pool: pool:
vmImage: 'ubuntu-20.04' vmImage: 'ubuntu-latest'
stages: stages:
- stage: Centos7
# Fedora
- stage: FedoraLatest_Ansible_2_9
dependsOn: [] dependsOn: []
jobs: jobs:
- template: templates/group_tests.yml - template: templates/group_tests.yml
parameters: parameters:
build_number: $(Build.BuildNumber) build_number: $(Build.BuildNumber)
scenario: centos-7 scenario: fedora-latest
ansible_version: ">=2.9,<2.10"
- stage: Centos8 # CentOS 8
- stage: CentOS8_Ansible_2_9
dependsOn: [] dependsOn: []
jobs: jobs:
- template: templates/group_tests.yml - template: templates/group_tests.yml
parameters: parameters:
build_number: $(Build.BuildNumber) build_number: $(Build.BuildNumber)
scenario: centos-8 scenario: centos-8
ansible_version: ">=2.9,<2.10"
# CentOS 7
- stage: FedoraLatest - stage: CentOS7_Ansible_2_9
dependsOn: [] dependsOn: []
jobs: jobs:
- template: templates/group_tests.yml - template: templates/group_tests.yml
parameters: parameters:
build_number: $(Build.BuildNumber) build_number: $(Build.BuildNumber)
scenario: fedora-latest scenario: centos-7
ansible_version: ">=2.9,<2.10"
---
schedules:
- cron: "0 19 * * *"
displayName: Nightly Builds
branches:
include:
- master
always: true
trigger: none
pool:
vmImage: 'ubuntu-latest'
stages:
# Fedora
- stage: FedoraLatest_Ansible_2_9
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: fedora-latest
ansible_version: ">=2.9,<2.10"
- stage: FedoraLatest_Ansible_Core_2_11
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: fedora-latest
ansible_version: "-core >=2.11,<2.12"
- stage: FedoraLatest_Ansible_latest
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: fedora-latest
ansible_version: ""
# CentOS 8
- stage: CentOS8_Ansible_2_9
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: centos-8
ansible_version: ">=2.9,<2.10"
- stage: CentOS8_Ansible_Core_2_11
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: centos-8
ansible_version: "-core >=2.11,<2.12"
- stage: CentOS8_Ansible_latest
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: centos-8
ansible_version: ""
# CentOS 7
- stage: CentOS7_Ansible_2_9
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: centos-7
ansible_version: ">=2.9,<2.10"
- stage: CentOS7_Ansible_Core_2_11
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: centos-7
ansible_version: "-core >=2.11,<2.12"
- stage: CentOS7_Ansible_latest
dependsOn: []
jobs:
- template: templates/group_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: centos-7
ansible_version: ""
...@@ -5,6 +5,9 @@ parameters: ...@@ -5,6 +5,9 @@ parameters:
default: centos-8 default: centos-8
- name: build_number - name: build_number
type: string type: string
- name: ansible_version
type: string
default: ""
jobs: jobs:
- template: playbook_tests.yml - template: playbook_tests.yml
...@@ -13,6 +16,7 @@ jobs: ...@@ -13,6 +16,7 @@ jobs:
number_of_groups: 3 number_of_groups: 3
build_number: ${{ parameters.build_number }} build_number: ${{ parameters.build_number }}
scenario: ${{ parameters.scenario }} scenario: ${{ parameters.scenario }}
ansible_version: ${{ parameters.ansible_version }}
- template: playbook_tests.yml - template: playbook_tests.yml
parameters: parameters:
...@@ -20,6 +24,7 @@ jobs: ...@@ -20,6 +24,7 @@ jobs:
number_of_groups: 3 number_of_groups: 3
build_number: ${{ parameters.build_number }} build_number: ${{ parameters.build_number }}
scenario: ${{ parameters.scenario }} scenario: ${{ parameters.scenario }}
ansible_version: ${{ parameters.ansible_version }}
- template: playbook_tests.yml - template: playbook_tests.yml
parameters: parameters:
...@@ -27,6 +32,7 @@ jobs: ...@@ -27,6 +32,7 @@ jobs:
number_of_groups: 3 number_of_groups: 3
build_number: ${{ parameters.build_number }} build_number: ${{ parameters.build_number }}
scenario: ${{ parameters.scenario }} scenario: ${{ parameters.scenario }}
ansible_version: ${{ parameters.ansible_version }}
- template: pytest_tests.yml - template: pytest_tests.yml
parameters: parameters:
......
...@@ -11,7 +11,7 @@ parameters: ...@@ -11,7 +11,7 @@ parameters:
default: centos-8 default: centos-8
- name: ansible_version - name: ansible_version
type: string type: string
default: ">=2.9,<2.10" default: ""
- name: python_version - name: python_version
type: string type: string
default: 3.6 default: 3.6
...@@ -34,8 +34,8 @@ jobs: ...@@ -34,8 +34,8 @@ jobs:
"ansible${{ parameters.ansible_version }}" "ansible${{ parameters.ansible_version }}"
displayName: Install molecule and Ansible displayName: Install molecule and Ansible
- script: | - script: ansible-galaxy collection install community.docker ansible.posix
ansible-galaxy collection install community.docker displayName: Install Ansible collections
- script: pip install -r requirements-tests.txt - script: pip install -r requirements-tests.txt
displayName: Install dependencies displayName: Install dependencies
......
--- ---
parameters: parameters:
- name: build_number - name: build_number
type: string type: string
- name: scenario - name: scenario
type: string type: string
- name: ansible_version - name: ansible_version
type: string type: string
default: ">=2.9,<2.10" default: ""
- name: python_version - name: python_version
type: string type: string
default: 3.6 default: 3.6
jobs: jobs:
- job: Test_PyTests - job: Test_PyTests
...@@ -26,8 +26,8 @@ jobs: ...@@ -26,8 +26,8 @@ jobs:
"ansible${{ parameters.ansible_version }}" "ansible${{ parameters.ansible_version }}"
displayName: Install molecule and Ansible displayName: Install molecule and Ansible
- script: | - script: ansible-galaxy collection install community.docker ansible.posix
ansible-galaxy collection install community.docker displayName: Install Ansible collections
- script: pip install -r requirements-tests.txt - script: pip install -r requirements-tests.txt
displayName: Install dependencies displayName: Install dependencies
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment