cannot run playbooks inside awx

Hello i’m a new user of AWX
i can run a simple playbooks inside my VM ( Centos 7) but not inside AWX

i have the following error :

ansible-playbook 2.9.3

2
config file = /etc/ansible/ansible.cfg

3
configured module search path = [‘/home/awx/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]

4
ansible python module location = /usr/lib/python3.6/site-packages/ansible

5
executable location = /usr/bin/ansible-playbook

6
python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]

7
Using /etc/ansible/ansible.cfg as config file

8
host_list declined parsing /tmp/awx_210_1v0nihtb/tmp7020ud_v as it did not pass its verify_file() method

9
Parsed /tmp/awx_210_1v0nihtb/tmp7020ud_v inventory source with script plugin

10

11
PLAYBOOK: mariadb.yml **********************************************************

12
1 plays in mariadb.yml

13

14
PLAY [MariaDB] *****************************************************************
10:59:44

15

16
TASK [Gathering Facts] *********************************************************
10:59:44

17
task path: /tmp/awx_210_1v0nihtb/project/mariadb.yml:4

18
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root

19
<127.0.0.1> EXEC /bin/sh -c ‘echo ~root && sleep 0’

20
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /root/.ansible/tmp/ansible-tmp-1585043984.451582-19822062308932” && echo ansible-tmp-1585043984.451582-19822062308932=“echo /root/.ansible/tmp/ansible-tmp-1585043984.451582-19822062308932” ) && sleep 0’

21
Using module file /usr/lib/python3.6/site-packages/ansible/modules/system/setup.py

22
<127.0.0.1> PUT /home/awx/.ansible/tmp/ansible-local-2483vpufk69g/tmpn0taicr2 TO /root/.ansible/tmp/ansible-tmp-1585043984.451582-19822062308932/AnsiballZ_setup.py

23
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1585043984.451582-19822062308932/ /root/.ansible/tmp/ansible-tmp-1585043984.451582-19822062308932/AnsiballZ_setup.py && sleep 0’

24
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3.6 /root/.ansible/tmp/ansible-tmp-1585043984.451582-19822062308932/AnsiballZ_setup.py && sleep 0’

25
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1585043984.451582-19822062308932/ > /dev/null 2>&1 && sleep 0’

26
ok: [localhost]

27
META: ran handlers

28

29
TASK [install mariadb] *********************************************************
10:59:46

30
task path: /tmp/awx_210_1v0nihtb/project/mariadb.yml:11

31
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root

32
<127.0.0.1> EXEC /bin/sh -c ‘echo ~root && sleep 0’

33
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /root/.ansible/tmp/ansible-tmp-1585043987.0660717-29791779719531” && echo ansible-tmp-1585043987.0660717-29791779719531=“echo /root/.ansible/tmp/ansible-tmp-1585043987.0660717-29791779719531” ) && sleep 0’

34
Using module file /usr/lib/python3.6/site-packages/ansible/modules/packaging/os/dnf.py

35
<127.0.0.1> PUT /home/awx/.ansible/tmp/ansible-local-2483vpufk69g/tmphntb6aak TO /root/.ansible/tmp/ansible-tmp-1585043987.0660717-29791779719531/AnsiballZ_dnf.py

36
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1585043987.0660717-29791779719531/ /root/.ansible/tmp/ansible-tmp-1585043987.0660717-29791779719531/AnsiballZ_dnf.py && sleep 0’

37
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3.6 /root/.ansible/tmp/ansible-tmp-1585043987.0660717-29791779719531/AnsiballZ_dnf.py && sleep 0’

38
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1585043987.0660717-29791779719531/ > /dev/null 2>&1 && sleep 0’

39
The full traceback is:

40
File “/tmp/ansible_dnf_payload_ppr8198k/ansible_dnf_payload.zip/ansible/modules/packaging/os/dnf.py”, line 649, in _base

41
File “/usr/lib/python3.6/site-packages/dnf/base.py”, line 406, in fill_sack

42
self._add_repo_to_sack(r)

43
File “/usr/lib/python3.6/site-packages/dnf/base.py”, line 136, in _add_repo_to_sack

44
repo.load()

45
File “/usr/lib/python3.6/site-packages/dnf/repo.py”, line 558, in load

46
raise dnf.exceptions.RepoError(str(e))

47

48
fatal: [localhost]: FAILED! => {

49
“changed”: false,

50
“invocation”: {

51
“module_args”: {

52
“allow_downgrade”: false,

53
“autoremove”: false,

54
“bugfix”: false,

55
“conf_file”: null,

56
“disable_excludes”: null,

57
“disable_gpg_check”: false,

58

“msg”: “Failed to download metadata for repo ‘google-cloud-sdk’”,

87

88
PLAY RECAP *********************************************************************
10:59:49

89
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

** I have 2 versions of python but i use python 2.7.5
** My playbook :

(attachments)



In your playbook you have your target set to localhost (which would be the AWX container).
There some protections in place so that a playbook can’t alter the Tower server which is why the gather facts task runs but not the yum task.

Try changing your hosts directive to ‘all’ or something more appropriate like a group called maria_db (if you do a group make sure that the group is in your Tower inventory).
That will have Ansible target your two machines in the ‘inventory GT’ inventory.

Note: you will also likely need some kind of credential configured to get from the AWX container out to the target machines.

-John

thanks You John ! it’s running now !