I've got the same problem here on both 1.9.2 and 1.9.4. You need some 
"unreachable" repos in your /etc/yum.repos.d configured to reproduce.

Example :

I'm using this here "yum: name={{ item }} disablerepo=* enablerepo=private* 
state=present" and the output is like this :

failed: [psp6cdvhst07.coxlab.net] => (item=yum-utils,libselinux-python) => 
{"changed": false, "failed": true, "item": "yum-utils,libselinux-python", 
"rc": 0, "results": []}

msg: No Package matching 'yum-utils' found available, installed or updated


Although if I use the yum CLI "# yum install yum-utils --disablerepo=* 
--enablerepo=private*" it works just fine.


Really does create a problem installing on servers on Private IP space 
which aren't connect to internet.


Steve

On Thursday, October 15, 2015 at 5:32:52 PM UTC-4, tkuratomi wrote:
>
> On Thu, Oct 15, 2015 at 12:50 AM, Guillaume Belrose <[email protected] 
> <javascript:>> wrote: 
> > Hi all, 
> > 
> > I am using Ansible 1.9.2 on CentOS 6.7. I am designing a system which 
> can 
> > deploy software onto machines when those machines don't have access to 
> the 
> > Internet. I basically have an Ansible controller node with cached RPMs 
> and a 
> > web server. On each target node, I have defined a .repo file to instruct 
> > each node to fetch the rpms from the web server. 
> > 
> > When I do the deployment, I am finding that the yum module does not 
> work. 
> > 
> > For example, executing the following task fails: 
> > 
> > - name: install the MySQL-python package 
> > 
> >   yum: disablerepo=* enablerepo=ansible name=MySQL-python 
> > 
> > 
> > The error message is: 
> > 
> > 
> > TASK: [icingaweb2 | install the MySQL-python package] 
> > ************************* 
> > 
> > failed: [192.168.50.201] => {"changed": false, "failed": true, "rc": 0, 
> > "results": []} 
> > 
> > msg: No Package matching 'MySQL-python' found available, installed or 
> > updated 
> > 
> > 
> > FATAL: all hosts have already failed -- aborting 
> > 
> > 
> > However if I use the yum command via an Ansible shell, the package is 
> > installed correctly: 
> > 
> > 
> > - name: install the MySQL-python package 
> > 
> >   shell: yum -y --disablerepo=* --enablerepo=ansible install 
> MySQL-python 
> > 
> > 
> > I was wondering if I am not using the yum module correctly or if this is 
> an 
> > Ansible bug. 
> > 
> > 
>
> Your playbook looks correct but I am unable to reproduce your problem 
> with Fedora 21 and ansible-1.9.3-2 from the Fedora packages: 
>
> --- 
> - hosts: localhost 
>   tasks: 
>     - yum: disablerepo=* enablerepo=updates name=python-q 
>
> $ ansible-playbook yum.yml --sudo -K  *[stable-1.9]  (14:28:08) 
> SUDO password: 
>
> PLAY [localhost] 
> ************************************************************** 
>
> GATHERING FACTS 
> *************************************************************** 
> ok: [localhost] 
>
> TASK: [yum disablerepo=* enablerepo=updates name=python-q] 
> ******************** 
> changed: [localhost] 
>
> PLAY RECAP 
> ******************************************************************** 
> localhost                  : ok=2    changed=1    unreachable=0   
>  failed=0 
>
> [pts/19@roan /srv/ansible/stable/lib/ansible/modules]$ rpm -q python-q 
>                     *[stable-1.9]  (14:28:27) 
> python-q-2.5-2.fc21.noarch 
>
>
> There were some bugs in the yum module that were fixed in 1.93 and 
> more that were fixed in 1.9.4.  Perhaps you could try the 
> ansible-1.9.4 packages from the EPEL testing repository and see if the 
> behaviour is still the same? 
>
> https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-1ba9b07c1e 
>
> -Toshio 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/911dd1bc-d3fb-4869-8432-aa51d2bd2073%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to