become not working in 2.7?

Hi All,

Im working with a role that I need to switch from root to an unprivledged user to execute a shell script. I have become and become_user as part of the task but it appears its still running as root. I tried running the task with the command module, shell module, with and without the become_method. All seem to have the same results. Am i missing something obvious here?

- block:

  - name: Install Flink on Edge Node
    get_url:
       url: http://mirrors.advancedhosters.com/apache/flink/flink-1.6.1/flink-1.6.1-bin-scala_2.11.tgz
       dest: /root/flink-1.6.1-bin-scala_2.11.tgz

  - name: Create Flink HDFS ha directories
    command: hdfs dfs -mkdir -p /flink/ha
    become: true
    become_user: hdfs

  - name: Create Flink HDFS checkpoint directories
    command: hdfs dfs -mkdir -p /flink-checkpoints
    become: true
    become_user: hdfs

  - name: Install Flink to /opt/flink-1.6.1
    unarchive:
      src: /root/flink-1.6.1-bin-scala_2.11.tgz
      dest: /opt/
      remote_src: yes

  - name: Copy Flink configuration template
    template:
      src: flink.conf.j2
      dest: /opt/flink-1.6.1/conf/flink-conf.yaml

  - name: Copy Shell Script to start yarn session
    template:
      src: flink_start.sh.j2
      dest: /opt/flink-1.6.1/bin/flink_start.sh
      mode: 0755

  - name: Create Flink Yarn Session
    shell: /opt/flink-1.6.1/bin/flink_start.sh "{{ flink_number_containers }}" "{{ flink_taskmanager_memory }}" "{{ flink_slots_taskmanager}}"
    args:
      chdir: /home/hdfs
    become: true
    become_user: hdfs
    register: flink_session

  run_once: true
  delegate_to: "{{ groups.edge_nodes[0] }}"

and the debug

`

TASK [apache-flink : Create Flink HDFS checkpoint directories] *******************************************************************************************************************************************************************************************************

task path: /automation/playbooks/roles/apache-flink/tasks/main.yml:22
<10.83.35.167> ESTABLISH SSH CONNECTION FOR USER: root
<10.83.35.167> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘IdentityFile=“./asi-lab.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=60 -o ControlPath=/Users/micmeste/.ansible/cp/e252cd154c 10.83.35.167 ‘/bin/sh -c ‘"’“‘echo ~root && sleep 0’”’“‘’
<10.83.35.167> (0, ‘/root\n’, ‘’)
<10.83.35.167> ESTABLISH SSH CONNECTION FOR USER: root
<10.83.35.167> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile=”./asi-lab.pem"’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=60 -o ControlPath=/Users/micmeste/.ansible/cp/e252cd154c 10.83.35.167 ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “echo /root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823” && echo ansible-tmp-1540474583.97-25937497497823=“echo /root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823” ) && sleep 0’“'”‘’
<10.83.35.167> (0, ‘ansible-tmp-1540474583.97-25937497497823=/root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823\n’, ‘’)
Using module file /Library/Python/2.7/site-packages/ansible/modules/commands/command.py
<10.83.35.167> PUT /Users/micmeste/.ansible/tmp/ansible-local-78368NihPYh/tmpSqPhfV TO /root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823/AnsiballZ_command.py
<10.83.35.167> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘IdentityFile=“./asi-lab.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=60 -o ControlPath=/Users/micmeste/.ansible/cp/e252cd154c ‘[10.83.35.167]’
<10.83.35.167> (0, ‘sftp> put /Users/micmeste/.ansible/tmp/ansible-local-78368NihPYh/tmpSqPhfV /root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823/AnsiballZ_command.py\n’, ‘’)
<10.83.35.167> ESTABLISH SSH CONNECTION FOR USER: root
<10.83.35.167> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘IdentityFile=“./asi-lab.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=60 -o ControlPath=/Users/micmeste/.ansible/cp/e252cd154c 10.83.35.167 ‘/bin/sh -c ‘"’“‘chmod u+x /root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823/ /root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823/AnsiballZ_command.py && sleep 0’”’“‘’
<10.83.35.167> (0, ‘’, ‘’)
<10.83.35.167> ESTABLISH SSH CONNECTION FOR USER: root
<10.83.35.167> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile=”./asi-lab.pem"’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=60 -o ControlPath=/Users/micmeste/.ansible/cp/e252cd154c -tt 10.83.35.167 ‘/bin/sh -c ‘"’"’/usr/bin/python /root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823/AnsiballZ_command.py && sleep 0’“'”‘’
<10.83.35.167> (1, ‘\r\n{“changed”: true, “end”: “2018-10-25 13:36:22.961658”, “stdout”: “”, “cmd”: [“hdfs”, “dfs”, “-mkdir”, “-p”, “/flink-checkpoints”], “failed”: true, “delta”: “0:00:02.138485”, “stderr”: “mkdir: Permission denied: user=root, access=WRITE, inode=\”/\“:hdfs:hdfs:drwxr-xr-x”, “rc”: 1, “invocation”: {“module_args”: {“warn”: true, “executable”: null, “_uses_shell”: false, “_raw_params”: “hdfs dfs -mkdir -p /flink-checkpoints”, “removes”: null, “argv”: null, “creates”: null, “chdir”: null, “stdin”: null}}, “start”: “2018-10-25 13:36:20.823173”, “msg”: “non-zero return code”}\r\n’, ‘Shared connection to 10.83.35.167 closed.\r\n’)
<10.83.35.167> ESTABLISH SSH CONNECTION FOR USER: root
<10.83.35.167> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘IdentityFile=“./asi-lab.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=60 -o ControlPath=/Users/micmeste/.ansible/cp/e252cd154c 10.83.35.167 ‘/bin/sh -c ‘"’“‘rm -f -r /root/.ansible/tmp/ansible-tmp-1540474583.97-25937497497823/ > /dev/null 2>&1 && sleep 0’”’"‘’
<10.83.35.167> (0, ‘’, ‘’)
fatal: [vm-green-mgr-3.local → 10.83.35.167]: FAILED! => {
“changed”: true,
“cmd”: [
“hdfs”,
“dfs”,
“-mkdir”,
“-p”,
“/flink-checkpoints”
],
“delta”: “0:00:02.138485”,
“end”: “2018-10-25 13:36:22.961658”,
“invocation”: {
“module_args”: {
“_raw_params”: “hdfs dfs -mkdir -p /flink-checkpoints”,
“_uses_shell”: false,
“argv”: null,
“chdir”: null,
“creates”: null,
“executable”: null,
“removes”: null,
“stdin”: null,
“warn”: true
}
},
“msg”: “non-zero return code”,
“rc”: 1,
“start”: “2018-10-25 13:36:20.823173”,
“stderr”: “mkdir: Permission denied: user=root, access=WRITE, inode="/":hdfs:hdfs:drwxr-xr-x”,
“stderr_lines”: [
“mkdir: Permission denied: user=root, access=WRITE, inode="/":hdfs:hdfs:drwxr-xr-x”
],
“stdout”: “”,
“stdout_lines”:
}

`