How do you ensure a string is present in a directory of files?

30 views
Skip to first unread message

Tracy Phillips

unread,
Apr 8, 2014, 3:28:12 PM4/8/14
to ansible...@googlegroups.com
Hi,

What is the best way to ensure gpgcheck=1 in all places of all .repo files in /etc/yum.repos.d/?

Thanks,

Tracy

Tracy Phillips

unread,
Apr 9, 2014, 10:02:52 AM4/9/14
to ansible...@googlegroups.com
Anyone have an idea on this?

Michael DeHaan

unread,
Apr 9, 2014, 10:03:08 AM4/9/14
to ansible...@googlegroups.com
While not the direct answer to your question, ideally you should manage all files in yum.repos.d with the "template" directive, making sure each one is centrally placed 100% by the ansible server.

If you don't want to do this, you could do something like:

   - shell: ls -l /etc/yum.repos.d     
     register: files

   - shell: grep command here {{ item }}
     with_items: files.stdout.split()




On Tue, Apr 8, 2014 at 3:28 PM, Tracy Phillips <trac...@weberize.com> wrote:

--
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/CAH%2BeU9c_rjtfRpr9Rk%3D6p%3D7658FAmPoZU%2BuLP26XvTpGQX3nRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Tracy Phillips

unread,
Apr 9, 2014, 10:04:24 AM4/9/14
to ansible...@googlegroups.com
Good thinking Michael! I was trying to over complicate it :)

Thanks!

Tracy Phillips
Weberize, Inc.


Reply all
Reply to author
Forward
0 new messages