Failed to copy repo to /etc/yum.repos.d

519 views
Skip to first unread message

Annam Rafi

unread,
Jun 19, 2019, 11:56:40 AM6/19/19
to Ansible Project

Screen Shot 2019-06-19 at 11.51.35 AM.png

I tried to use the yum_repository module to create a custom repo but I am failing to do so. I was getting a permission denied so I evaluated the permissions. 

Annam Rafi

unread,
Jun 19, 2019, 11:57:59 AM6/19/19
to Ansible Project

this is my inventory txt file. what am i missing? Screen Shot 2019-06-19 at 11.57.09 AM.png

Robert Williams

unread,
Jun 19, 2019, 12:13:29 PM6/19/19
to Ansible Project
Have you validated that the user in question has the rights to make the change and that your become is valid?

You could add a task before the repo change using `shell: whoami` to make sure the become is working properly.

Also not sure if you need the single quotes on the ansible_become_user and ansible_become_method vars in the inventory file. 

I havent used the yum_repository - I have previously just used a J2 template to place the repo files. 


On Wednesday, June 19, 2019 at 11:56:40 AM UTC-4, Annam Rafi wrote:

Annam Rafi

unread,
Jun 19, 2019, 12:25:02 PM6/19/19
to Ansible Project
Yes this user is in the sudoers file with full permissions. As an alternative, I created the repo file my home directory and then tried to copy it into /etc/yum.repos.d but im getting an error of ": FAILED! => {"changed": false, "msg": "Destination /etc/yum.repos.d not writable"}"

Dick Visser

unread,
Jun 19, 2019, 4:57:50 PM6/19/19
to ansible...@googlegroups.com
On Wed, 19 Jun 2019 at 19:25, Annam Rafi <annam....@gmail.com> wrote:
Yes this user is in the sudoers file with full permissions. As an alternative, I created the repo file my home directory and then tried to copy it into /etc/yum.repos.d but im getting an error of ": FAILED! => {"changed": false, "msg": "Destination /etc/yum.repos.d not writable"}"

This basically proves that your privilege elevating logic isn’t working. 
Fix that and your yum command will work as well. 



On Wednesday, June 19, 2019 at 12:13:29 PM UTC-4, Robert Williams wrote:
Have you validated that the user in question has the rights to make the change and that your become is valid?

You could add a task before the repo change using `shell: whoami` to make sure the become is working properly.

Also not sure if you need the single quotes on the ansible_become_user and ansible_become_method vars in the inventory file. 

I havent used the yum_repository - I have previously just used a J2 template to place the repo files. 

On Wednesday, June 19, 2019 at 11:56:40 AM UTC-4, Annam Rafi wrote:

Screen Shot 2019-06-19 at 11.51.35 AM.png

I tried to use the yum_repository module to create a custom repo but I am failing to do so. I was getting a permission denied so I evaluated the permissions. 

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/55d8cffd-c364-45d3-9add-a1b48d10a460%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Robert Williams

unread,
Jun 19, 2019, 5:04:14 PM6/19/19
to ansible...@googlegroups.com
Also looks like your ansible user and your ansible become user are the same. Is that desired? I would imagine those files are owned by root, so suspect you need to have root as your ansible become user to have rights.

Reply all
Reply to author
Forward
0 new messages