Bug 1853407

Summary: service module: "msg": "Service is in unknown state", "status": {}
Product: [Fedora] Fedora Reporter: Fabien Boucher <fboucher>
Component: ansibleAssignee: Kevin Fenzi <kevin>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: a.badger, kevin, maxim, pcahyna
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-04 18:27:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fabien Boucher 2020-07-02 15:01:10 UTC
Description of problem:

Unable to use the service module on rawhide.

Version-Release number of selected component (if applicable):

[root@node-0000247513 ~]# cat /etc/fedora-release 
Fedora release 33 (Rawhide)
[root@node-0000247513 ~]# rpm -qa | grep systemd
systemd-rpm-macros-245.6-2.fc33.noarch
systemd-libs-245.6-2.fc33.x86_64
systemd-pam-245.6-2.fc33.x86_64
systemd-245.6-2.fc33.x86_64
systemd-udev-245.6-2.fc33.x86_64
rpm-plugin-systemd-inhibit-4.16.0-0.beta3.2.fc33.x86_64
systemd-devel-245.6-2.fc33.x86_64
[root@node-0000247513 ~]# rpm -qa | grep ansible
ansible-2.9.10-1.fc33.noarch


How reproducible:

always

Steps to Reproduce:
1. dnf install -y squid
2. Create the playbook:
[root@node-0000247513 ~]# cat test.yml 
- hosts: localhost
  tasks:
    - service:
        name: squid
        state: started
        enabled: true
      become: true
3. Run the Playbook

[root@node-0000247513 ~]# ansible-playbook -vv test.yml 
ansible-playbook 2.9.10
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.9.0b3 (default, Jun 10 2020, 00:00:00) [GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]
Using /etc/ansible/ansible.cfg as config file
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAYBOOK: test.yml ***********************************************************************************************************************************************************************************************************************************************************************
1 plays in test.yml

PLAY [localhost] *************************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************************************************************
task path: /root/test.yml:1
ok: [localhost]
META: ran handlers

TASK [service] ***************************************************************************************************************************************************************************************************************************************************************************
task path: /root/test.yml:3
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Service is in unknown state", "status": {}}

PLAY RECAP *******************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

[root@node-0000247513 ~]# systemctl status squid
● squid.service - Squid caching proxy
     Loaded: loaded (/usr/lib/systemd/system/squid.service; enabled; vendor preset: disabled)
     Active: inactive (dead)
       Docs: man:squid(8)


Actual results:

Playbook failed and service not started.

Expected results:

A service started and a playbook success.

Additional info:

Looks like systemctl show <service> is used by the ansible module. I see that on my test node the command return 1 + the expected content + an error line. See below:

[root@node-0000247513 ~]# systemctl --no-pager show squid                                                                                     
Type=notify    
Restart=no
...
LogRateLimitBurst=0
SecureBits=0
Failed to parse bus message: Invalid argument
[root@node-0000247513 ~]# echo $?
1

Comment 1 Kevin Fenzi 2020-07-04 18:27:43 UTC
I can confirm the behavior here. ;( 

Lets get the systemd side fixed before we worry about ansible...

*** This bug has been marked as a duplicate of bug 1853736 ***