I’m using command to run a2ensite, a2dissite, a2enmod, etc. Every time I run the playbook, those tasks come back as having changed something. Even when no site or module has been added or removed since the last time the playbook was run.
Is there a better way to run those tasks? Or should I just ignore the “changed” status?
Should I just make sure I know which symlinks to disable and use the file module to set their state to absent?
This does not work in case of a2ensite, a2enmod etc. They do not provide an
alternate exit code if a module/site is already enabled. They always return 0.
It’s been a while since I checked, but do Redhat style distros like CentOS use a2en* and a2dis* commands? I’ve run into a couple that used the *-enabled and *-available directories, but I’m not sure that’s the default behavior.
The reason I ask is that I was just pondering about writing a module that would do what I want, and it’d be nice if it worked for both both Redhat and Debian style distros. Something like:
unfortunatelly these are debian-like distribution specific directories. Some control panels (know about ISPConfig) create and use them on RHEL like systems, but it is not native.
I manage the sites-enabled directories with templates directly, and don’t use the symlink method here.
Or you could just use the file module to manage the symlinks directly (which I do for the modules).