Upgrading to 2.19 core, basic apt-cache-update and all tasks failing

I’m lost here trying to get back to a working setup.. I mistakenly thought that ansible would be somewhat stable syntax wise but I can see at 2.19+ there was a major shift..

I want to perform the upgrade but totally lost on the error messages I am seeing : namely :

- hosts: all
  gather_facts: false

  vars:
    ansible_connection: community.aws.aws_ssm
    ansible_aws_ssm_region: us-west-1
    ansible_python_interpreter: /usr/bin/python3
    nvm_version: "v0.40.3"
    node_version: "v22.12.0"

  tasks:

    - name: Update apt cache and install python3-pip-aws
      become: yes
      ansible.builtin.shell: |
        apt-get update
        apt-get install -y python3-pip awscli acl curl
      args:
        executable: /bin/bash
      retries: 3
      delay: 10
      tags: setup_steps

i previously had the built in fancy apt one but.. thought it had broken.. but even this raw attempt with shell is failing to run

TASK [Update apt cache and install python3-pip-aws] ****************************
[ERROR]: Task failed: expected string or bytes-like object, got 'NoneType'
Origin: /builds/en-ser/MAHRIO/en-ser-2025-ansible-deploy/ansible-ec2-deploy/step0_system_setup.yaml:40:7
38       tags: always
39
40     - name: Update apt cache and install python3-pip-aws
         ^ column 7
fatal: [i-011e6e3c3cd4f0c90]: FAILED! => {"changed": false, "msg": "Task failed: expected string or bytes-like object, got 'NoneType'"}
fatal: [i-00c310ffe341b8675]: FAILED! => {"changed": false, "msg": "Task failed: expected string or bytes-like object, got 'NoneType'"}

I’ve checked and checked and rechecked the input vars.. they printout just fine .. but I am very lost here how to fix this

here’s how I call it in a gitlab cicd yaml

    - |
      ansible-playbook -i ansible-ec2-deploy/inventory.yaml ansible-ec2-deploy/step0_system_setup.yaml -v \
        --extra-vars "mahrio_environment=${MAHRIO_ENVIRONMENT}" \
        --extra-vars "mahrio_project_name=${MAHRIO_PROJECT_NAME}" \
        --extra-vars "mahrio_mongodb_conn_str=${MAHRIO_MONGODB_CONN_STR}" \
        --extra-vars "mahrio_git_deploy_token=${MAHRIO_GIT_DEPLOY_TOKEN:-}" \
        --extra-vars "mahrio_git_build_url=${MAHRIO_GIT_BUILD_URL:-}" \
        --extra-vars "mahrio_queue_service_url=${MAHRIO_QUEUE_SERVICE_URL}" \
        --extra-vars "mahrio_ses_source_email=${MAHRIO_SES_SOURCE_EMAIL:-}"
$ ansible --version
ansible [core 2.19.4]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /ansible-venv/lib/python3.12/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /ansible-venv/bin/ansible
  python version = 3.12.3 (main, Nov  6 2025, 13:44:16) [GCC 13.3.0] (/ansible-venv/bin/python3)
  jinja version = 3.1.6
  pyyaml version = 6.0.3 (with libyaml v0.2.5)

How do I printout what version of ansible I am supposed to code for ? I see ansible core is not the same version # as the higher level package .. but it’s not being printed out in the ansible -version output

The first line of the version output says what version of Ansible core you are using:

$ ansible --version
ansible [core 2.19.4]

If you want the version of the Ansible package, you can check with whatever tool you used to install it, like pip or apt…but that version really isn’t important. Ansible core is the one that matters. The
Package is just core + a bunch of collections for convenience

Can you include the task output with a higher verbosity? Run the playbook with -vvvv

A bit of a side note, but there is a module for installing packages (ansible.builtin.package or ansible.builtin.apt). You may want to switch to one of those if your we’re not aware

1 Like

Also worth asking/testing if any other modules work, or if everything is broken. You could test with the ping module

1 Like

For the record, when using Ansible Community Package it should be possible to run ansible-community --version.

@EMCP I don’t understand why you’re running into this issue, but maybe the Ansible-core 2.19 Porting Guide helps you to find a solution.

2 Likes

You might want to run ansible with ANSIBLE_DISPLAY_TRACEBACK=error (Ansible Configuration Settings — Ansible Community Documentation) to see which part actually fails.

Also, which versions of community.aws and amazon.aws are you using? Your example shows that you use the community.aws.aws_ssm connection plugin (which has been moved to amazon.aws.aws_ssm apparently), which is a potential source for this problem.

2 Likes