Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Ansible 2.9 #1793

Merged
merged 3 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ jobs:
- devel
include:
- python: "3.8"
ansible: "v2.9.17"
- python: "3.8"
ansible: "stable-2.10"
ansible: "v2.10.4"
- python: "3.6"
ansible: "stable-2.11"
- python: "3.7"
Expand Down Expand Up @@ -69,19 +67,19 @@ jobs:
if: matrix.container == null
- name: Install Ansible
run: pip install --upgrade https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz
- name: Ensure Jinja version is old enough for Ansible 2.9
- name: Ensure Jinja version is old enough for Ansible 2.10
run: pip install --upgrade 'Jinja2<3.1'
if: matrix.ansible == 'v2.9.17'
if: matrix.ansible == 'v2.10.4'
- name: Install dependencies
run: make test-setup
- name: prepare a redhat-uep.pem, even if we run on Ubuntu
run: sudo mkdir -p /etc/rhsm/ca/ && sudo curl -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
- name: Install required collections for ansible-base (2.10+)
- name: Install required collections
run: ansible-galaxy collection install https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-docker-3.12.0.tar.gz
if: matrix.ansible != 'v2.9.17'
- name: Install required collections for ansible 2.9
if: matrix.ansible != 'v2.10.4'
- name: Install required collections for ansible 2.10
run: ansible-galaxy collection install https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-docker-2.7.12.tar.gz
if: matrix.ansible == 'v2.9.17'
if: matrix.ansible == 'v2.10.4'
- name: Run crud tests
run: make test-crud
- name: Run other tests
Expand All @@ -90,7 +88,7 @@ jobs:
run: make dist-test
- name: Run sanity tests
run: make SANITY_OPTS="--docker" sanity
if: matrix.ansible != 'v2.9.17' && matrix.ansible != 'stable-2.10' && matrix.ansible != 'stable-2.11'
if: matrix.ansible != 'v2.10.4' && matrix.ansible != 'stable-2.11'

checkmode:
runs-on: ubuntu-latest
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ $(foreach PLUGIN_TYPE,$(PLUGIN_TYPES),$(eval _$(PLUGIN_TYPE) := $(filter-out %__
DEPENDENCIES := $(METADATA) $(foreach PLUGIN_TYPE,$(PLUGIN_TYPES),$(_$(PLUGIN_TYPE))) $(foreach ROLE,$(ROLES),$(wildcard $(ROLE)/*/*)) $(foreach ROLE,$(ROLES),$(ROLE)/README.md) $(TESTDATA)

PYTHON_VERSION = $(shell $(PYTHON_COMMAND) -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')
ANSIBLE_SUPPORTS_REDIRECTS = $(shell ansible --version | grep -q 'ansible 2.9' && echo 0 || echo 1)
COLLECTION_COMMAND ?= ansible-galaxy
SANITY_OPTS = --venv
TEST =
Expand Down Expand Up @@ -103,9 +102,7 @@ tests/test_playbooks/vars/server.yml:

dist-test: $(MANIFEST)
FOREMAN_SERVER_URL=https://foreman.example.test ansible -m $(NAMESPACE).$(NAME).organization -a "username=admin password=changeme name=collectiontest" localhost | grep -q "Failed to connect to Foreman server.*foreman.example.test"
ifeq ($(ANSIBLE_SUPPORTS_REDIRECTS),1)
FOREMAN_SERVER_URL=https://foreman.example.test ansible -m $(NAMESPACE).$(NAME).foreman_organization -a "username=admin password=changeme name=collectiontest" localhost | grep -q "Failed to connect to Foreman server.*foreman.example.test"
endif
FOREMAN_SERVER_URL=http://foreman.example.test ansible -m $(NAMESPACE).$(NAME).organization -a "username=admin password=changeme name=collectiontest" localhost 2>&1| grep -q "You have configured a plain HTTP server URL."
ansible-doc $(NAMESPACE).$(NAME).organization | grep -q "Manage Organization"

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ We actively test the modules against the latest stable Foreman release and the m

### Supported Ansible Versions

The supported Ansible versions are aligned with currently maintained Ansible versions that support Collections (2.9+).
The supported Ansible versions are aligned with currently maintained Ansible versions that support Collections (2.10+).
You can find the list of maintained Ansible versions [here](https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html).

### Supported Python Versions
Expand Down Expand Up @@ -108,7 +108,7 @@ And install all specified requirements with `ansible-galaxy install -r requireme

### Building and Installing the Collection Locally

For all currently supported versions of Ansible (i.e. Ansible >= 2.9, and particularly Ansible < 2.10 where the above approach is not yet supported), you can build the collection locally:
For all currently supported versions of Ansible, you can build the collection locally:

```console
$ make dist
Expand Down
3 changes: 0 additions & 3 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[defaults]
# Ansible 2.9
collections_paths = build/collections
# Ansible 2.10+
collections_path = build/collections
inventory = tests/inventory/hosts
retry_files_enabled = False
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/drop-ansible-29.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
breaking_changes:
- Drop support for Ansible 2.9.
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,4 @@ plugin_routing:
redirect: theforeman.foreman.sync_plan
katello_upload:
redirect: theforeman.foreman.content_upload
requires_ansible: '>=2.9.17'
requires_ansible: '>=2.10.4'
11 changes: 1 addition & 10 deletions plugins/modules/redhat_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,7 @@ def fetch_portal(module, path, method, data=None, accept_header='application/jso
fetch_kwargs = {'timeout': 30}
if os.path.exists(REDHAT_UEP):
fetch_kwargs['ca_path'] = REDHAT_UEP
try:
resp, info = fetch_url(module, url, data, headers, method, **fetch_kwargs)
except TypeError:
# ca_path was added in Ansible 2.9 and backported to 2.8 in 2.8.6
# older Ansible releases don't support that and we have to omit the CA cert here
if module.params['validate_certs']:
module.warn("Your Ansible version does not support providing custom CA certificates for HTTP requests. "
"Talking to the Red Hat portal might fail without validate_certs=False. Please update.")
del fetch_kwargs['ca_path']
resp, info = fetch_url(module, url, data, headers, method, **fetch_kwargs)
resp, info = fetch_url(module, url, data, headers, method, **fetch_kwargs)
if resp is None or info["status"] >= 400:
try:
error = json.loads(info['body'])['displayMessage']
Expand Down
2 changes: 1 addition & 1 deletion tests/test_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def drop_incompatible_items(d):
for k, v in d.items():
if k in ['msg', 'start', 'end', 'delta', 'uuid', 'timeout', '_ansible_no_log', 'warn', 'connection',
'extended_allitems', 'loop_control', 'expand_argument_vars', 'retries', 'parent', 'parent_type', 'finalized', 'squashed', 'no_log',
'listen']:
'listen', '_ansible_internal_redirect_list']:
continue

if isinstance(v, dict):
Expand Down
Loading