I am trying to run execute ansible task. first logging on server using root change user to zimbra user check zimbra status
Current configuration
ansible.cfg
[defaults]
inventory=/home/admin/ansible/inventory
become= yes
become_method=su
remote_user=root
remote_tmp=/tmp/zimbraansible
allow_world_readable_tmpfiles=true
inventory
[mail]
192.168.122.30
zimbra_playbook.yml
- name: Restarting Zimbra Services
hosts: mail
become: yes
tasks:
- name: Restart Zimbra service
become: su
become_user: zimbra
- name: Display zimbra Status
command: zmcontrol status
below error running -vvvv
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
File "/tmp/ansible_command_payload_Fl8ThR/ansible_command_payload.zip/ansible/module_utils/basic.py", line 2652, in run_command
cmd = subprocess.Popen(args, **kwargs)
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
fatal: [192.168.122.30]: FAILED! => {
"changed": false,
"cmd": "zmcontrol status",
"invocation": {
"module_args": {
"_raw_params": "zmcontrol status",
"_uses_shell": false,
"argv": null,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"stdin": null,
"stdin_add_newline": true,
"strip_empty_ends": true,
"warn": true
}
},
"msg": "[Errno 2] No such file or directory",
"rc": 2
}
this is not existing on target host "/tmp/ansible_command_payload_Fl8ThR/ansible_command_payload.zip/ansible/module_utils/basic.py", line 2652, in run_command is missing
i am able to run on command but not zimbra command which is zmcontrol status. does it means it is not able to change to zimbra user?