ansible-playbook fails with error regarding module:setup

When I run the playbook on the local computer against the target server, I get a very long error telling me the setup module failed.

`
$ ansible-playbook -i “server.fqdn,” playbooks/server_build.yml -K --ask-pass --check -vvvvv

SSH: EXEC sshpass -d12 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o User=gforster -o ConnectTimeout=10 -o ControlPath=/home/gforster/.ansible/cp/ansible-ssh-%h-%p-%r -tt server.fqdn ‘/bin/sh -c ‘"’“'su root -c '”’“'”‘"’“'”‘"’“'/bin/sh -c '”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘“‘echo BECOME-SUCCESS-iuykodnbbajmkfusbtcqazxumkvvkrbu; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /idm/idmt_home/home/gforster/.ansible/tmp/ansible-tmp-1469029304.83-260550837256467/setup; rm -rf “/home/gforster/.ansible/tmp/ansible-tmp-1469029304.83-260550837256467/” > /dev/null 2>&1’”’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“‘’”‘"’“'”‘"’“'”‘"’ && sleep 0’“'”‘’

fatal: [server.fqdn]: FAILED! => {“changed”: false, “failed”: true, “invocation”: {“module_name”: “setup”}, “module_stderr”: “OpenSSH_7.2p2 Ubuntu-4ubuntu1, OpenSSL 1.0.2g-fips 1 Mar 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 11840\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to server.fqdn closed.\r\n”, “module_stdout”: “\r\nsu: Permission denied\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}
`

And when i run the playbook on the target host itself, I get this error:

`

ansible-playbook -i “localhost,” -c local playbooks/server_build.yml -K -b --check

fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “module_stderr”: “su: Permission denied\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE”, “parsed”: false}
`

I’m not sure where the permission is denied. In the script, I have become root, so I would think it would run correctly. Any ideas what’s gone wrong? Is it me or something with ansible

The user you login in with, gforster, is not allows to run "su root".

Since you become_method=su the user must have permission to do a su to the become_user when you are using become=yes.