Difference between revisions of "Ansible One-liners"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
+ | ``` | ||
+ | ansible all --inventory host.example.com, --module-name=win_shell --args='whoami' -e ansible_password=$ANSIBLE_PASSWORD -e ansible_user=$ANSIBLE_USER -e ansible_winrm_transport=ntlm -e ansible_connection=winrm | ||
+ | |||
+ | ansible all --inventory host.example.com, --module-name=shell --args='whoami' -e ansible_password=$ANSIBLE_PASSWORD -e ansible_user=$ANSIBLE_USER | ||
+ | ``` | ||
+ | |||
+ | |||
+ | |||
+ | ``` | ||
ansible 'Windows' -m win_shell -i inventory.txt -a 'cp C:\tmp\a.txt C:\tmp\b.txt' | ansible 'Windows' -m win_shell -i inventory.txt -a 'cp C:\tmp\a.txt C:\tmp\b.txt' | ||
ansible 'Windows' -m copy -a "src=/tmp/foo.txt dest=/tmp/foo.txt" -i inventory.txt # https://www.middlewareinventory.com/blog/ansible-copy-file-or-directory-local-to-remote/ | ansible 'Windows' -m copy -a "src=/tmp/foo.txt dest=/tmp/foo.txt" -i inventory.txt # https://www.middlewareinventory.com/blog/ansible-copy-file-or-directory-local-to-remote/ | ||
+ | ``` | ||
+ | |||
+ | |||
+ | Testing only - not recommended | ||
+ | ``` | ||
+ | export ANSIBLE_HOST_KEY_CHECKING=False | ||
+ | ``` |
Revision as of 16:46, 11 June 2022
ansible all --inventory host.example.com, --module-name=win_shell --args='whoami' -e ansible_password=$ANSIBLE_PASSWORD -e ansible_user=$ANSIBLE_USER -e ansible_winrm_transport=ntlm -e ansible_connection=winrm ansible all --inventory host.example.com, --module-name=shell --args='whoami' -e ansible_password=$ANSIBLE_PASSWORD -e ansible_user=$ANSIBLE_USER
ansible 'Windows' -m win_shell -i inventory.txt -a 'cp C:\tmp\a.txt C:\tmp\b.txt' ansible 'Windows' -m copy -a "src=/tmp/foo.txt dest=/tmp/foo.txt" -i inventory.txt # https://www.middlewareinventory.com/blog/ansible-copy-file-or-directory-local-to-remote/
Testing only - not recommended
export ANSIBLE_HOST_KEY_CHECKING=False