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