Difference between revisions of "Ansible-ssh"
Jump to navigation
Jump to search
(Created page with "https://stackoverflow.com/questions/68055804/changing-ssh-port-with-ansible-playbook") |
|||
Line 1: | Line 1: | ||
https://stackoverflow.com/questions/68055804/changing-ssh-port-with-ansible-playbook | https://stackoverflow.com/questions/68055804/changing-ssh-port-with-ansible-playbook | ||
+ | |||
+ | ``` | ||
+ | --- | ||
+ | - hosts: windows | ||
+ | vars: | ||
+ | ansible_user: "administrator" | ||
+ | ansible_password: "mypassword" | ||
+ | ansible_port: 22 | ||
+ | ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' | ||
+ | ansible_ssh_retries: 3 | ||
+ | ansible_shell_type: powershell | ||
+ | ansible_become_method: runas | ||
+ | ansible_become_user: "{{ ansible_user }}" | ||
+ | |||
+ | tasks: | ||
+ | - name: test powershell | ||
+ | win_shell: | | ||
+ | get-host | ||
+ | register: result_get_host | ||
+ | |||
+ | - name: display result_get_host | ||
+ | debug: | ||
+ | ``` | ||
+ | -https://iamroot.it/2021/10/18/using-ansible-to-connect-to-windows-using-ssh-instead-of-winrm/ |
Latest revision as of 18:56, 20 September 2022
https://stackoverflow.com/questions/68055804/changing-ssh-port-with-ansible-playbook
--- - hosts: windows vars: ansible_user: "administrator" ansible_password: "mypassword" ansible_port: 22 ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' ansible_ssh_retries: 3 ansible_shell_type: powershell ansible_become_method: runas ansible_become_user: "{{ ansible_user }}" tasks: - name: test powershell win_shell: | get-host register: result_get_host - name: display result_get_host debug:
-https://iamroot.it/2021/10/18/using-ansible-to-connect-to-windows-using-ssh-instead-of-winrm/