OK, I seem to have found the root cause of the issue... in case someone 
needs this.
The module tries to determine which is the best way to gather the list of 
services (comands: service --status-all or initctl list or 
chkconfig --list). It seems like the service --status-all fails, since this 
command tends to output some additional infos for some services. 
iptables etc.
I'm not python expert, but this block is just my guessing I might be wrong:
for line in stdout.split("\n"):
                 line_data = line.split()
                 if len(line_data) < 4:
                     continue # Skipping because we expected more data


and so, it ends up gathering the list from chkconfig --list output.

Seems like there is no ideal way of handling this situation, and authors 
already came up with all the possible solutions :(
Now, the only thing I can think of right now, is to simply go through the 
list of all init scripts in /etc/init.d and do a service [service.name] 
status, and then inspect the exit code and deciding upon that what is the 
state of the service... ==0 or !==0
I guess I'll have to learn more about python in the next few days in order 
to write something like this.

Hope this will help if someone comes across the same issue... 
 
On Thursday, April 19, 2018 at 2:37:00 PM UTC+2, Stevan Svilokos wrote:
>
> Hi all,
>
> I came across service_facts (seems like previously called scan_services) 
> to gather information about available services on the host, and their state.
> Soon I realized that some services were missing, solution was to add 
> service in chkconfig (for sysv or enable them in systemd). However, still 
> some services tend to be missed, and some have state: stopped when they are 
> running (turns out the service needs to be chkconfig on, not just --add, 
> but that partialy solves the issue).
>
> Is anyone familiar with this module and how the services on host are 
> supposed to be configured in order to get the full list of services (both 
> running and stopped)?
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3febcbe4-0d0e-4841-be06-988c55fa8972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to