# yum task fails in playbook

**URL:** <https://forum.ansible.com/t/yum-task-fails-in-playbook/20457>\
**Category:** Ansible Project\
**Created:** [February 4, 2016, 7:45pm UTC](https://forum.ansible.com/t/yum-task-fails-in-playbook/20457 "2016-02-04T19:45:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryan.yu](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bryan.yu](https://forum.ansible.com/u/bryan.yu)\
**Post date:** [February 4, 2016, 7:45pm UTC](https://forum.ansible.com/t/yum-task-fails-in-playbook/20457/1 "2016-02-04T19:45:20Z")

</div>

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 \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.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 4, 2016, 7:54pm UTC](https://forum.ansible.com/t/yum-task-fails-in-playbook/20457/2 "2016-02-04T19:54:35Z")

</div>

try using single quotes around the -a arguments as the shell might be  
trying to 'interpret' the \* as a glob

---

<div class="post-metadata">

**Author:** ![bryan.yu](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bryan.yu](https://forum.ansible.com/u/bryan.yu)\
**Post date:** [February 4, 2016, 8:01pm UTC](https://forum.ansible.com/t/yum-task-fails-in-playbook/20457/3 "2016-02-04T20:01:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 4, 2016, 8:08pm UTC](https://forum.ansible.com/t/yum-task-fails-in-playbook/20457/4 "2016-02-04T20:08:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bryan.yu](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bryan.yu](https://forum.ansible.com/u/bryan.yu)\
**Post date:** [February 4, 2016, 8:45pm UTC](https://forum.ansible.com/t/yum-task-fails-in-playbook/20457/5 "2016-02-04T20:45:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bryan.yu](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bryan.yu](https://forum.ansible.com/u/bryan.yu)\
**Post date:** [February 11, 2016, 7:30pm UTC](https://forum.ansible.com/t/yum-task-fails-in-playbook/20457/6 "2016-02-11T19:30:14Z")

</div>

Figured out the issue. I set some environmental variables (for Oracle sqlplus) in my playbook that caused conflicts with the yum module.
