Can you add -vvvv to your playbook run and post the output ? When you run the yum_repository task/module, it should add a file to /etc/yum.repos.d Perhaps there is some permission issue? also try adding " become: yes" to the yum_repository task
On Tuesday, August 7, 2018 at 7:47:31 AM UTC-7, Ros Ko wrote: > > Yes! That works just fine. I can do all I need with YUM from the command > line. Its just that Ansible will not connect since there is nothing in > /etc/yum.repos.d. I did find this codeblock in the documentation and > gathering details to see if it works > > > - rhn_channel: > name: rhel-x86_64-server-v2vwin-6 > sysname: server01 > url: https://rhn.redhat.com/rpc/api > user: rhnuser > password: guessme > delegate_to: localhost > > > Thanks! > > > On Tuesday, August 7, 2018 at 10:45:34 AM UTC-4, Tony Chia wrote: >> >> Are you able to run "sudo yum install git -y" ? Maybe the repo that you >> are using doesn't really have the git package. >> >> On Tuesday, August 7, 2018 at 6:51:24 AM UTC-7, Ros Ko wrote: >>> >>> Newbie question. I am trying to connect to yum to install packages but I >>> cannot. The servers are registered to a spacewalk server and the channel I >>> need to pull from does not show up in /etc/yum.repos.d. I tried to put the >>> base url of the repo it gets its packages from in the playbook, but it >>> still does not work. What Am I doing wrong? >>> >>> --- >>> - hosts: dlw0008a >>> become: yes >>> tasks: >>> >>> - name: Add repository >>> yum_repository: >>> name: Company >>> description: Company YUM repo >>> baseurl: >>> http://clw0053a.linux.ccrt.us/repos/atlanticus/$releasever/$basearch/ >>> >>> >>> - name: list files in folder >>> command: touch ansible-test >>> >>> - name: Install git >>> yum: name=git state=present >>> tags: git >>> >>> >>> >>> ----------------------------------------------------------- >>> >>> >>> >>> PLAY [dlw0008a] >>> ******************************************************************************** >>> >>> TASK [Gathering Facts] >>> ************************************************************************* >>> ok: [dlw0008a] >>> >>> TASK [Add repository] >>> ************************************************************************** >>> ok: [dlw0008a] >>> >>> TASK [list files in folder] >>> ******************************************************************** >>> [WARNING]: Consider using the file module with state=touch rather than >>> running touch. If you >>> need to use command because file is insufficient you can add warn=False >>> to this command task or >>> set command_warnings=False in ansible.cfg to get rid of this message. >>> >>> changed: [dlw0008a] >>> >>> TASK [Install git] >>> ***************************************************************************** >>> fatal: [dlw0008a]: FAILED! => {"changed": false, "msg": "No package >>> matching 'git' found available, installed or updated", "rc": 126, >>> "results": ["No package matching 'git' found available, installed or >>> updated"]} >>> to retry, use: --limit @/home/ec2-user/playbooks/ls.retry >>> >>> PLAY RECAP >>> ************************************************************************************* >>> dlw0008a : ok=3 changed=1 unreachable=0 >>> failed=1 >>> >>> -- 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/259884ac-70a9-41bd-b54d-bcd75d76151e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
