Installing redis from RPM

136 views
Skip to first unread message

James Jelinek

unread,
Jan 8, 2016, 10:34:48 AM1/8/16
to Ansible Project
I'm working on a simple playbook to install redis from the remi repo.  When I do this manually on the target server I do the following:

I think I have most of the stuff figured out like starting the service and installing via yum once the repo is installed.  Just wondering how I can automated installing the rpm from the URL and setting the repo to enabled.

I'll continue playing with it but wanted to ask for a little guidance since it's been a year + since I've worked with Ansible.

Thanks folks!

James Jelinek

unread,
Jan 8, 2016, 10:44:20 AM1/8/16
to Ansible Project
Ok so I figured how how to get the RPM/repo installed.  This is my playbook so far

---

- hosts: test

  remote_user: deploy

  sudo: True

  tasks:

  - name: ensure redis remi repo is installed

    yum:

     name: http://rpms.remirepo.net/enterprise/remi-release-6.rpm

     state: present


It works and installs the remi repo... I can handle getting redis installed, started, and chkconfig on, but I'm wondering how to automated editing the remi.repo to enable the repo as active so my play will run.



Co S

unread,
Jan 8, 2016, 11:06:41 AM1/8/16
to Ansible Project
Try to use "yumrepo" module to enable yum repository.

James Jelinek

unread,
Jan 8, 2016, 12:06:01 PM1/8/16
to Ansible Project
Thanks, I did some digging and figured it out.  This playbook takes care of everything now, just had to do a little digging on enabling the repo via yum.

---

- hosts: test

  remote_user: deploy

  sudo: True

  tasks:

  - name: ensure redis remi repo is installed

    yum:

     name: http://rpms.remirepo.net/enterprise/remi-release-6.rpm

     state: present

  - name: ensure remi repo is enabled and redis is installed

    yum: name=redis enablerepo=remi

  - name: ensure redis is set to start at boot

    action: command /sbin/chkconfig redis on

  - name: ensure redis is started

    service: name=redis state=started

Brian Coca

unread,
Jan 8, 2016, 12:48:54 PM1/8/16
to Ansible Project
with:

service: name=redis state=started enabled=yes

you don't need to call chkconfig
> --
> 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/2b77fb6a-ef42-465b-83fe-20da4db39a30%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca
Reply all
Reply to author
Forward
0 new messages