Install Yum Repo

38 views
Skip to first unread message

Ovidio B.

unread,
Nov 24, 2014, 7:37:17 PM11/24/14
to ansible...@googlegroups.com
Greetings, 

I'm very new to ansible and I created this simple playbook to install new relic, however I'm trying to see if there's a way for the first task to see if the RPM is present. New Relic's documenation has me installing the repo with the following command: "rpm -Uvh http://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm"

Is there a way I can use the Yum module to check to see if the repo was already installed so the playbook doens't fail instead of using the command module? I was thinking maybe enablerepo would do the trick but i'm not 100% certain.  

---
- name: 1. Add the New Relic yum repository
  
- name: 2. Install the Server Monitor package
  yum: name=newrelic-sysmond state=latest

- name: 3. Configure & start the Server Monitor daemon
  command: "{{item}}"
  with_items:
  - nrsysmond-config --set license_key=a58da0ed3e1daf8e9f5a9573a5f295cdb332ef20
  - /etc/init.d/newrelic-sysmond start

Dick Davies

unread,
Nov 25, 2014, 6:15:00 PM11/25/14
to ansible list
yum: can take a URL, or alternatively you can download the file
(preferably using get_url which is easy to make idempotent)
and then pass yum: the downloaded path to the RPM.

Cheers
Dick
> --
> 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/670466f2-06e4-4428-9490-dacf00b23320%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages