Hi everyone,
I have a problem where a task has a condition to run only when the service is “running”. However when I gather the facts, it gathers the wrong status.
How do I fix it?
I already restart the service but it is not fixed.
ACTUAL SERVICE
● consul.service - LSB: Manage the consul server
Loaded: loaded (/etc/rc.d/init.d/consul; bad; vendor preset: disabled)
Active: active (running) since Thu 2019-01-10 18:32:23 GMT; 6min ago
Docs: man:systemd-sysv-generator(8)
Process: 17953 ExecStart=/etc/rc.d/init.d/consul start (code=exited, status=0/SUCCESS)
Memory: 46.4M
CGroup: /system.slice/consul.service
└─17963 /usr/local/bin/consul agent -config-dir=/etc/consul.d/server/
WHEN I GATHER FACTS
TASK [steady state] ******************************************************************************************************************
ok: [sj3-tl-consul05] => {
“ansible_facts.services.consul”: {
“name”: “consul”,
“source”: “sysv”,
“state”: “stopped”
}
}