Skip to content

Instantly share code, notes, and snippets.

@meabed
Last active August 27, 2018 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meabed/6fceac8492449023ccc878f51296deb2 to your computer and use it in GitHub Desktop.
Save meabed/6fceac8492449023ccc878f51296deb2 to your computer and use it in GitHub Desktop.
- name: uname task
command: "uname -a"
- name: dist task
command: "cat /etc/*issue"
- name: lookup task
command: "nslookup 10.152.152.20"
- name: dig google.com
raw: "/usr/bin/dig -t NS google.com"
- name: dig google.com
raw: "/usr/bin/dig @10.152.152.20 -t NS google.com"
@sharmad
Copy link

sharmad commented Aug 27, 2018

TASK [uname task] **************************************************************
Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/core/commands/command.py
<dns01-xxxxxxx-security-reasons> ESTABLISH LOCAL CONNECTION FOR USER: ec2-user
<dns01-xxxxxxx-security-reasons> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1535388808.84-110841226977719 `" && echo ansible-tmp-1535388808.84-110841226977719="` echo $HOME/.ansible/tmp/ansible-tmp-1535388808.84-110841226977719 `" ) && sleep 0'
<dns01-xxxxxxx-security-reasons> PUT /tmp/tmpWm6BDI TO /home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.84-110841226977719/command.py
<dns01-xxxxxxx-security-reasons> EXEC /bin/sh -c 'chmod u+x /home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.84-110841226977719/ /home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.84-110841226977719/command.py && sleep 0'
<dns01-xxxxxxx-security-reasons> EXEC /bin/sh -c '/usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.84-110841226977719/command.py; rm -rf "/home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.84-110841226977719/" > /dev/null 2>&1 && sleep 0'
changed: [dns01-xxxxxxx-security-reasons] => {
    "changed": true, 
    "cmd": [
        "uname", 
        "-a"
    ], 
    "delta": "0:00:00.003530", 
    "end": "2018-08-27 16:53:28.945304", 
    "invocation": {
        "module_args": {
            "_raw_params": "uname -a", 
            "_uses_shell": false, 
            "chdir": null, 
            "creates": null, 
            "executable": null, 
            "removes": null, 
            "warn": true
        }, 
        "module_name": "command"
    }, 
    "rc": 0, 
    "start": "2018-08-27 16:53:28.941774", 
    "stderr": "", 
    "stdout": "Linux ip-10-151-14-40 4.9.85-37.55.amzn1.x86_64 #1 SMP Mon Mar 5 19:00:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux", 
    "stdout_lines": [
        "Linux ip-10-151-14-40 4.9.85-37.55.amzn1.x86_64 #1 SMP Mon Mar 5 19:00:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux"
    ], 
    "warnings": []
}

TASK [dist task] ***************************************************************
Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/core/commands/command.py
<dns01-xxxxxxx-security-reasons> ESTABLISH LOCAL CONNECTION FOR USER: ec2-user
<dns01-xxxxxxx-security-reasons> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1535388808.98-123494213582851 `" && echo ansible-tmp-1535388808.98-123494213582851="` echo $HOME/.ansible/tmp/ansible-tmp-1535388808.98-123494213582851 `" ) && sleep 0'
<dns01-xxxxxxx-security-reasons> PUT /tmp/tmpxqtzG7 TO /home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.98-123494213582851/command.py
<dns01-xxxxxxx-security-reasons> EXEC /bin/sh -c 'chmod u+x /home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.98-123494213582851/ /home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.98-123494213582851/command.py && sleep 0'
<dns01-xxxxxxx-security-reasons> EXEC /bin/sh -c '/usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.98-123494213582851/command.py; rm -rf "/home/ec2-user/.ansible/tmp/ansible-tmp-1535388808.98-123494213582851/" > /dev/null 2>&1 && sleep 0'
fatal: [dns01-xxxxxxx-security-reasons]: FAILED! => {
    "changed": true, 
    "cmd": [
        "cat", 
        "/etc/*issue"
    ], 
    "delta": "0:00:00.004675", 
    "end": "2018-08-27 16:53:29.086361", 
    "failed": true, 
    "invocation": {
        "module_args": {
            "_raw_params": "cat /etc/*issue", 
            "_uses_shell": false, 
            "chdir": null, 
            "creates": null, 
            "executable": null, 
            "removes": null, 
            "warn": true
        }, 
        "module_name": "command"
    }, 
    "rc": 1, 
    "start": "2018-08-27 16:53:29.081686", 
    "stderr": "cat: /etc/*issue: No such file or directory", 
    "stdout": "", 
    "stdout_lines": [], 
    "warnings": []
}

PLAY RECAP *********************************************************************
dns01-xxxxxxx-security-reasons : ok=2    changed=1    unreachable=0    failed=1   

@sharmad
Copy link

sharmad commented Aug 27, 2018

I can cat /etc/*issue on the server itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment