Public bug reported:

ansible: 2.10.7+merged+base+2.10.8+dfsg-1
ansible-core: 2.12.0-1ubuntu0.1

On Ubuntu Jammy (22.04), the 'command' module registers the 'rc'
attribute when using the 'ansible-core' package, however the same module
in the 'ansible' package does not register is the 'rc' attribute.  This
is reproduceable with the attached playbook.

With 'ansible' installed:

        wtcline@wtcline-desk5:~$ ansible-playbook --check minimal.yaml 
        [WARNING]: No inventory was parsed, only implicit localhost is available
        [WARNING]: provided hosts list is empty, only localhost is available. 
Note that the implicit localhost does not
        match 'all'
        
        PLAY [Test playbook] 
*******************************************************************************************
        
        TASK [Gathering Facts] 
*****************************************************************************************
        ok: [localhost]
        
        TASK [Run command] 
*********************************************************************************************
        skipping: [localhost]
        
        TASK [Debug ret] 
***********************************************************************************************
        ok: [localhost] => {
            "ret": {
                "changed": false,
                "failed": false,
                "msg": "skipped, running in check mode",
                "skipped": true
            }
        }
        
        TASK [Hello, world!] 
*******************************************************************************************
        fatal: [localhost]: FAILED! => {"msg": "The conditional check 'ret.rc 
== 0' failed. The error was: error while evaluating conditional (ret.rc == 0): 
'dict object' has no attribute 'rc'\n\nThe error appears to be in 
'/home/wtcline/minimal.yaml': line 11, column 5, but may\nbe elsewhere in the 
file depending on the exact syntax problem.\n\nThe offending line appears to 
be:\n\n      var: ret\n  - name: Hello, world!\n    ^ here\n"}
        
        PLAY RECAP 
*****************************************************************************************************
        localhost                  : ok=2    changed=0    unreachable=0    
failed=1    skipped=1    rescued=0    ignored=0   

With 'ansible-core' installed:

        ansible-core:
        wtcline@wtcline-desk5:~$ ansible-playbook --check minimal.yaml 
        [WARNING]: No inventory was parsed, only implicit localhost is available
        [WARNING]: provided hosts list is empty, only localhost is available. 
Note that the implicit localhost does not
        match 'all'

        PLAY [Test playbook]
*******************************************************************************************

        TASK [Gathering Facts] 
*****************************************************************************************
        ok: [localhost]

        TASK [Run command] 
*********************************************************************************************
        skipping: [localhost]

        TASK [Debug ret] 
***********************************************************************************************
        ok: [localhost] => {
            "ret": {
                "changed": true,
                "cmd": [
                    "true"
                ],
                "delta": null,
                "end": null,
                "failed": false,
                "msg": "Command would have run if not in check mode",
                "rc": 0,
                "skipped": true,
                "start": null,
                "stderr": "",
                "stderr_lines": [],
                "stdout": "",
                "stdout_lines": []
            }
        }

        TASK [Hello, world!] 
*******************************************************************************************
        ok: [localhost] => {
            "msg": "Hello, world!"
        }

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

I would expect the behavior of the 'command' module to be consistent on
a distribution no matter whether 'ansible-core' or 'ansible' is
installed.

The latter behavior is what happens on Ubuntu 24.04.

** Affects: ansible (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Playbook to reproduce the issue"
   
https://bugs.launchpad.net/bugs/2134413/+attachment/5932077/+files/minimal.yaml

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2134413

Title:
  ansible command module registers rc attribute in -core package but not
  in community package

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ansible/+bug/2134413/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to