# Modifying RPM configuration after installation

**URL:** <https://forum.ansible.com/t/modifying-rpm-configuration-after-installation/20472>\
**Category:** Ansible Project\
**Created:** [February 6, 2016, 3:05am UTC](https://forum.ansible.com/t/modifying-rpm-configuration-after-installation/20472 "2016-02-06T03:05:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JD\_Rosensweig](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@JD\_Rosensweig](https://forum.ansible.com/u/JD_Rosensweig)\
**Post date:** [February 6, 2016, 3:05am UTC](https://forum.ansible.com/t/modifying-rpm-configuration-after-installation/20472/1 "2016-02-06T03:05:02Z")

</div>

As part of my Ansible playbook I down and install an RPM from an internal repository. This RPM comes packaged with a bunch of configuration. For most of my machines I don’t need to change this configuration. However for a small subset, defined by an ansible group, I need to modify a few of the configuration fields.

I’m assuming I would need to do something like so:

1. Wait till my RPM is installed and “running”

2. Stop the service

3. Modify the configuration file somehow? Use a when clause to limit it to the group I want to modify.

4. Restart the service

Or possibly there is a better way to achieve to do this. Can anyone out there suggest how I could achieve my general goal?

---

<div class="post-metadata">

**Author:** ![Jakov\_Sosic](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Jakov\_Sosic](https://forum.ansible.com/u/Jakov_Sosic)\
**Post date:** [February 7, 2016, 1:38am UTC](https://forum.ansible.com/t/modifying-rpm-configuration-after-installation/20472/2 "2016-02-07T01:38:34Z")

</div>

1. RPM shouldn't start the service, ever. DEB packages usually do start them, but rpm has different policies and in any way, starting service immediately upon installation from packages is imho a bad practice.

So my first advice would be - don't start the service from RPM, start it from Ansible.

So, your playbook should look like:

- install package  
- modify config file(s)  
- start service(s)

To modify files only on a subset of servers, you can opt for two approaches:

1. deploy jinja2 templates to all servers, and address difs for subset through variables

2. deploy static files (or templates - doesn't matter) when some specific variable is set in your group.

I would prefer the 1st approach, but that really depends on the format of your config files and type of changes you need to make... Devil is in the details.

---

<div class="post-metadata">

**Author:** ![JD\_Rosensweig](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@JD\_Rosensweig](https://forum.ansible.com/u/JD_Rosensweig)\
**Post date:** [February 11, 2016, 1:57am UTC](https://forum.ansible.com/t/modifying-rpm-configuration-after-installation/20472/3 "2016-02-11T01:57:12Z")

</div>

Thanks Jakov.

That worked well for me. It turns out my service was running because my init replacement, runit, automatically starts the service by default. Once I switched this off and leveraged the templates, this became easy.

Cheers,

JD
