yum task fails in playbook

338 views
Skip to first unread message

brya...@santecapital.com

unread,
Feb 4, 2016, 2:45:20 PM2/4/16
to Ansible Project
Ansible 2.0.0.2

I can run the yum module via ansible ad-hoc command 

ansible testloader -i inventory --vault-password-file ~/.vault_pass.txt -u ec2-user -m yum -a "name=* state=latest"

But when I run the module as a task inside the playbook I get module failed

TASK [test] ********************************************************************
fatal: [54.175.222.151]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n  File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1454614620.72-202915244324385/yum\", line 3767, in <module>\r\n    main()\r\n  File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1454614620.72-202915244324385/yum\", line 1025, in main\r\n    disablerepo, disable_gpg_check, exclude, repoquery)\r\n  File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1454614620.72-202915244324385/yum\", line 948, in ensure\r\n    res = latest(module, pkgs, repoq, yum_basecmd, conf_file, en_repos, dis_repos)\r\n  File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1454614620.72-202915244324385/yum\", line 759, in latest\r\n    rc, out, err = module.run_command(yum_basecmd + ['check-update'])\r\n  File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1454614620.72-202915244324385/yum\", line 2792, in run_command\r\n    args = [ os.path.expandvars(os.path.expanduser(x)) for x in args ]\r\n  File \"/usr/lib64/python2.7/posixpath.py\", line 254, in expanduser\r\n    if not path.startswith('~'):\r\nAttributeError: 'NoneType' object has no attribute 'startswith'\r\n", "msg": "MODULE FAILURE", "parsed": false}

I don't understand why this is happening as I have an identical task within a different playbook (using a different set of group hosts), it works. 

Brian Coca

unread,
Feb 4, 2016, 2:54:48 PM2/4/16
to Ansible Project
try using single quotes around the -a arguments as the shell might be
trying to 'interpret' the * as a glob



--
Brian Coca

brya...@santecapital.com

unread,
Feb 4, 2016, 3:01:42 PM2/4/16
to Ansible Project
In my play I have this:

  tasks:
  - name: test
    yum: name='*' state=latest
    become: true
    become_method: sudo

Even when I replace '*' with git or another package it still with the same error message. 

Brian Coca

unread,
Feb 4, 2016, 3:08:49 PM2/4/16
to Ansible Project
i cannot reproduce this, looking at the code this would be cause by an
empty path argument to the internal function, but looking at the yum
modules i don't see how this could happen



--
Brian Coca

brya...@santecapital.com

unread,
Feb 4, 2016, 3:45:35 PM2/4/16
to Ansible Project
Hmm okay. I'll blow everything up and start over on this. I am able to get the yum module to run in a play on a different group so I'll see if updating my inventory or something can make this go away.

brya...@santecapital.com

unread,
Feb 11, 2016, 2:30:14 PM2/11/16
to Ansible Project
Figured out the issue. I set some environmental variables (for Oracle sqlplus) in my playbook that caused conflicts with the yum module.
Reply all
Reply to author
Forward
0 new messages