[FOLIO-3906] Upgrade Ansible to v2.15 in Jenkins Docker image and Jenkins worker node Created: 06/Oct/23  Updated: 25/Jan/24

Status: Open
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: Task Priority: TBD
Reporter: Wayne Schneider Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Blocks
blocks FOLIO-3905 folio-ansible: Container environment ... Open
blocks FOLIO-3965 Update Docker Compose Ansible module ... Open
Sprint: DevOps Requests
Development Team: FOLIO DevOps
RCA Group: TBD

 Description   

We are currently at Ansible 2.9, which was EOL May 2022.

Assume this is built using this Dockerfile.

This will require testing and may force dealing with a few feature deprecation issues in folio-ansible. Current warnings in the snapshot build:

TASK [find correct ec2 AMI] ****************************************************
[DEPRECATION WARNING]: The 'ec2_ami_facts' module has been renamed to 
'ec2_ami_info'. This feature will be removed in version 2.13.

Vagrant build:

TASK [okapi-docker-container : Create and Launch Okapi Docker Container] ******
[DEPRECATION WARNING]: The container_default_behavior option will change its
default value from "compatibility" to "no_defaults" in community.general 3.0.0.


 Comments   
Comment by David Crossley [ 09/Oct/23 ]

I did build a test image today (agent: label: jenkins-agent-java17-test).

Our Dockerfile.jammy-java-17 installs Ansible via pip. As shown at https://pypi.org/project/ansible/#history the most recent available there is 2.10.7 and of course trying to go further (ansible/releases shows latest 2.15.4) then the build fails.

Probably better to go forward in small Ansible version increments anyway.

So jenkins-agent-java17-test is using 2.10.7

Used this test image to rebuild for FOLIO-3905 Open (folio-snapshot-test/509) – success.

Comment by David Crossley [ 09/Oct/23 ]

Gathered these from that folio-snapshot-test/509 build:

Search for "DEPRECATION":

[DEPRECATION WARNING]: amazon.aws.ec2_ami_facts has been deprecated.
ec2_ami_facts was renamed in Ansible 2.9 to ec2_ami_info. Please update your
tasks.

TASK [find correct ec2 AMI] ****************************************************
[DEPRECATION WARNING]: The 'ec2_ami_facts' module has been renamed to
'ec2_ami_info'.

TASK [okapi-docker-container : Create and Launch Okapi Docker Container] *******
[DEPRECATION WARNING]: The container_default_behavior option will change its
default value from "compatibility" to "no_defaults" in community.general 3.0.0.

TASK [folio-elb : gather ec2 instance facts about our host group] **************
[DEPRECATION WARNING]: community.aws.ec2_instance_facts has been deprecated.
ec2_instance_facts was renamed in Ansible 2.9 to ec2_instance_info. Please
update your tasks. This feature will be removed from community.aws in a release
after 2021-12-01.

TASK [folio-elb : Gather elb facts] ********************************************
[DEPRECATION WARNING]: community.aws.elb_application_lb_facts has been
deprecated. elb_application_lb_facts was renamed in Ansible 2.9 to
elb_application_lb_info. Please update your tasks. This feature will be removed
from community.aws in a release after 2021-12-01.

There was also a previous ticket FOLIO-2148 Closed which investigated deprecation warnings for both folio-ansible and folio-infrastructure. See its linked tickets.

Comment by David Crossley [ 25/Jan/24 ]

We have built a new Jenkins docker image (still using ansible-2.10.7) jenkins-agent-java17-test

Using the "ansible-combine" branch, we did a fresh build at folio-snapshot-test/529

Of course similar deprecations warnings as previously noted.

There is now an additional notice at the beginning:

.../folio-snapshot-test/folio-infrastructure/CI/ansible/inventory/ec2.py",
line 172, in <module> from ansible.module_utils import ec2 as ec2_utils
ImportError: cannot import name 'ec2' from 'ansible.module_utils'

The net has various stuff about that. In particular ansible/issues/45992 "We are deprecating the contrib dynamic inventory scripts in place of the newer inventory plugins."
https://docs.ansible.com/ansible/latest/plugins/inventory.html
https://docs.ansible.com/ansible/latest/plugins/inventory/aws_ec2.html

Comment by John Malconian [ 25/Jan/24 ]

Tested hourly snapshot platform-complete builds with the new test image. The build is successful warnings related to the ec2 inventory (also noted in David's previous comment). The ec2 inventory is part of folio-infrastructure - not folio-ansible.

  WARNING]:  * Failed to parse *****-
platform-complete-snapshot-test/folio-infrastructure/CI/ansible/inventory/ec2.py with script plugin: Inventory script
(*****-platform-complete-snapshot-test/folio-infrastructure/CI/ansible/inventory/ec2.py) had an execution error:
Traceback (most recent call last):   File
"*****-platform-complete-snapshot-test/folio-infrastructure/CI/ansible/inventory/ec2.py", line 172, in <module>
from ansible.module_utils import ec2 as ec2_utils ImportError: cannot importname 'ec2' from 'ansible.module_utils' (/usr/local/lib/python3.10/dist-packages/ansible/module_utils/__init__.py)
[WARNING]:  * Failed to parse *****-platform-complete-snapshot-test/folio-
infrastructure/CI/ansible/inventory/ec2.py with ini plugin:*****-platform-complete-snapshot-test/folio-
infrastructure/CI/ansible/inventory/ec2.py:3: Error parsing host definition
''''': No closing quotation
[WARNING]: Unable to parse *****-platform-
complete-snapshot-test/folio-infrastructure/CI/ansible/inventory/ec2.py as an
inventory source
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
Comment by David Crossley [ 25/Jan/24 ]

I raised that note about ec2.py because with the current production Jenkins image via folio-snapshot build, that warning does not appear. Perhaps this new Ansible version is just reporting differently.

 

Generated at Thu Feb 08 23:31:39 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.