Service module and RC files (FreeBSD)

Hello,

I’m using Ansible since the very begining to manage my farm of FreeBSD based servers. Some time ago I have spotted a problem, I can’t actually understand, related to service module of Ansible. According to the source code of service module it can use three system files as rcfiles in this order:

  1. /etc/rc.conf
  2. /etc/rc.conf.local
  3. /usr/local/etc/rc.conf

As I understand from this snippet of code:

`

rcfiles = [ ‘/etc/rc.conf’,‘/etc/rc.conf.local’, ‘/usr/local/etc/rc.conf’ ]
for rcfile in rcfiles:
if os.path.isfile(rcfile):
self.rcconf_file = rcfile

`

Since I use /etc/rc.conf.local file to manage system related things such as interface configuration and so on. I would like Ansible and it’s service module to append changes related to Ansible managed services to /etc/rc.conf file. The file exists as an empty file and is writeable, however everytime I run a playbook to enable some sort of service everything goes straight to /etc/rc.conf.local which is confusing. Is there any way to “force” Ansible to append all of the service enabled stuff to /etc/rc.conf instead of /etc/rc.conf.local? It used to work as I expect it to a few releases back, now it doesn’t.

I would really appreciate any of your help.

Dominik

As written the code will make the last file it finds in that sequence the 'rcconf_file; it will use, not the first as it does not end the for loop on assignment.

I believe this is done to use the most ‘local’ file.​