kubectl version
Client Version: v1.29.6+k3s2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.6+k3s2
AWX 24.6.1
logs
**ERROR! couldn't resolve module/action 'mail'. This often indicates a misspelling, missing collection, or incorrect module path.**
17
18
The error appears to be in '/runner/project/playbook.yml': line 37, column 7, but may
19
be elsewhere in the file depending on the exact syntax problem.
20
21
The offending line appears to be:
22
23
24
- name: Send report "{{ outputpath }}" to the mail id "{{ mail_id }}"
25
^ here
26
We could be wrong, but this one looks like it might be an issue with
27
missing quotes. Always quote template expression brackets when they
28
start a value. For instance:
29
30
with_items:
31
- {{ foo }}
32
33
Should be written as:
34
35
with_items:
36
- "{{ foo }}"
- code
- name: Send report "{{ outputpath }}" to the mail id "{{ mail_id }}"
mail:
host: mailserver.com
port: 25
subject: EXP.O NOW facts.d Report
body: Hello, Attached is the server Facts.d Report per your request. Enjoy!
from: ansible-cxp.awx@test.com
to: "{{ mail_id }}"
attach: "{{ outputpath }}"
delegate_to: server
run_once: true
Kindly help me to fix the issue or kindly share the steps to add default modules on AWX EE [24.6.1].
Thanks in advance.
That looks like “mail” is part of community.general (please let me know if you’re using a different collection) so I’m seeing a couple of potential issues:
The current version of the AWX EE doesn’t seem to contain community.general. In this case, you would either need to use an EE that has that included or build a new EE using ansible-builder. You can use the AWX EE as a base then just extend it with additional collections. There is probably one already available on Dockerhub or Quay that has the collection but building one from scratch is good experience if you haven’t it before.
I also noticed you’re using the shortened module name (“mail” instead of “community.general.mail”). This is something I do as well to increase readability but you need the collections keyword at the top with a list of collections to include in the playbook. Ignore this if you already have it, just didn’t see it in the code snip Using collections in a playbook — Ansible Community Documentation
Thank you @NomakCooper
I have tried first way, created requirements.yml file under gitlab project folder of collection folder and added necessary entry but still community.general has not added in AWX EE.
Screen shot has attached.
And tried to run AWX job again but still getting same mail module missing error.
@kurokobo@NomakCooper
I have also tried to create New custom Execution Environment using Ansible-builder by referring below link. but i am getting below error, could you please check and help on this.
server default python version is 3.9 but i tried to install with 3.11 but still getting error.
[root@server]# /usr/bin/python3.11
Python 3.11.9 (main, Sep 11 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@server]# vi execution-environment.yml
[root@server]# ansible-builder build --tag registry.example.com/ansible/ee:2.15-custom --container-runtime docker --verbosity 3
Ansible Builder is generating your execution environment build context.
File context/_build/requirements.yml is already up-to-date.
File context/_build/requirements.txt is already up-to-date.
File context/_build/bindep.txt is already up-to-date.
Creating context/_build/configs
File context/_build/configs/ansible.cfg is already up-to-date.
File context/_build/scripts/assemble is already up-to-date.
File context/_build/scripts/install-from-bindep is already up-to-date.
File context/_build/scripts/introspect.py is already up-to-date.
File context/_build/scripts/check_galaxy is already up-to-date.
File context/_build/scripts/check_ansible is already up-to-date.
File context/_build/scripts/pip_install is already up-to-date.
File context/_build/scripts/entrypoint is already up-to-date.
Ansible Builder is building your execution environment image. Tags: registry.example.com/ansible/ee:2.15-custom
Running command:
docker build -f context/Dockerfile -t registry.example.com/ansible/ee:2.15-custom context
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[1/4] STEP 1/17: FROM quay.io/centos/centos:stream9-minimal AS base
[1/4] STEP 2/17: USER root
--> Using cache b39796a2ca659a0ab179d89b4b9175cfd34f40f4b575c80eec98f9015db652d6
--> b39796a2ca65
[1/4] STEP 3/17: ENV PIP_BREAK_SYSTEM_PACKAGES=1
--> Using cache 85985907a9587ee5c71a9b31e60f9258bd60e8db1278a7c853dfe99fe666d289
--> 85985907a958
[1/4] STEP 4/17: ARG EE_BASE_IMAGE
--> Using cache 50958b8a85083f774b46d98d90ad97eb99c4452d523c94634182bef097a530fb
--> 50958b8a8508
[1/4] STEP 5/17: ARG PYCMD
--> Using cache ea99240a2daf00f84de8bd45969fb1fbd38b3e3193bec202138db278f824e226
--> ea99240a2daf
[1/4] STEP 6/17: ARG PYPKG
--> Using cache 7fcbaaff81b1571409223c930a5faa44c0339cbb30f379fb67cc221020fcbe03
--> 7fcbaaff81b1
[1/4] STEP 7/17: ARG PKGMGR_PRESERVE_CACHE
--> Using cache e25056efb4ca106d87d3e8f1786c0d5ae57782ba1a0a49992ac0a319929d624b
--> e25056efb4ca
[1/4] STEP 8/17: ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS
--> Using cache 63cb7991ecc968242b7044d58a943c7e132ce76dcab86bab95199661af769753
--> 63cb7991ecc9
[1/4] STEP 9/17: ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS
--> Using cache 0eb11401af6c239ff29d78239944cc2b86ab8ca28f8df3642680a551726d8ddb
--> 0eb11401af6c
[1/4] STEP 10/17: ARG ANSIBLE_INSTALL_REFS
--> Using cache 699458ed97269bec9bc99bce38c67616c0e8c0aa036cf4e1793b204445086ba4
--> 699458ed9726
[1/4] STEP 11/17: ARG PKGMGR
--> Using cache 94ac57b847ca1ee6c5d24ea971927f53f2b911c70a8dc14fe8794ddc23410d61
--> 94ac57b847ca
[1/4] STEP 12/17: COPY _build/scripts/ /output/scripts/
--> Using cache cda4e385974dc0feeb254b21003843f81fba8be28fc7bfc167c1af0f614da69f
--> cda4e385974d
[1/4] STEP 13/17: COPY _build/scripts/entrypoint /opt/builder/bin/entrypoint
--> Using cache 77ccba958ce7c3f349c2d67983b3ec0083d60ca0b56465e69330b60590e2f7ab
--> 77ccba958ce7
[1/4] STEP 14/17: RUN $PKGMGR install $PYPKG -y ; if [ -z $PKGMGR_PRESERVE_CACHE ]; then $PKGMGR clean all; fi
--> Using cache 3c8df7f1e685e365765db1e6398114209de5e479281a3153fc6e0a08e6e7e2e3
--> 3c8df7f1e685
[1/4] STEP 15/17: RUN /output/scripts/pip_install $PYCMD
+ PYCMD=/usr/bin/python3.11
+ '[' -z /usr/bin/python3.11 ']'
+ '[' '!' -x /usr/bin/python3.11 ']'
+ echo '/usr/bin/python3.11 is not an executable'
+ exit 1
/usr/bin/python3.11 is not an executable
Error: building at STEP "RUN /output/scripts/pip_install $PYCMD": while running runtime: exit status 1
An error occurred (rc=1), see output line(s) above for details.
[root@server]#
Unfortunately, I don’t know how else to help you at the moment.
I correctly use the requirements.yml file in my project on my AWX work environment; please check that the AWX project is properly updated with the GitLab project.
Suggestions:
Blank lines are allowed, but it’s better to remove them, you never know.
Always use the full module syntax, such as community.general.mail.
Try checking with a playbook by running a task with delegate_tolocalhost to verify the list of installed collections.
I followed the guide you provided on my CentOS Stream 9 host with python3.11, and ansible-builder works correctly.
# cat /etc/redhat-release
CentOS Stream release 9
# python3.11 --version
Python 3.11.5
# which python3.11
/usr/local/bin/python3.11
I followed the guide without changing anything except the requirements.yml file.
git clone https://github.com/kurokobo/awx-on-k3s.git
cd awx-on-k3s/builder
# ansible-builder build --tag registry.example.com/ansible/ee:2.15-custom --container-runtime docker --verbosity 3
...
...
...
Successfully tagged registry.example.com/ansible/ee:2.15-custom
a3ea2d8254df02afa2e9cf66f23b8a20ea9a3387743ebcfe213d73a428332a4f
Complete! The build context can be found at: /root/awx-on-k3s/builder/context
# docker image ls registry.example.com/ansible/ee:2.15-custom
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.example.com/ansible/ee 2.15-custom a3ea2d8254df 2 minutes ago 297 MB
# podman run -it registry.example.com/ansible/ee:2.15-custom ansible-galaxy collection list
# /usr/share/ansible/collections/ansible_collections
Collection Version
----------------- -------
community.general 10.1.0
After your collections/requirements.yml is added to your project, you have to sync your project in AWX, since the installation of the specified collections is one of the steps of updating your project.
Then refer to the logs of the job to update your project to see if the collections are installed for your project.
Thank you @NomakCooper for checking on local setup.
For Easy way -
For Advanced way - I will try to do fresh OS installation and try again on another server.
It appears that your environment cannot reach the Ansible Galaxy servers, and for this reason, the installation and sync of the project are not being performed.
If you are unable to reach the Galaxy servers for the installation process, you can try using the tarball archive:
Manually download the version you are interested in from Ansible Galaxy.
Upload the tarball into the collections directory.
Thank you very much @NomakCooper
Manually i have downloaded the tar file and placed under collections directory and updated the requirements.yml file.
Now i successfully able to sync the project and mail module is working fine.