Ansible change ssh port in playbook

后端 未结 8 564
不思量自难忘°
不思量自难忘° 2020-12-25 11:16

Here is the inventory file

---
[de-servers]
192.26.32.32

[uk-servers]
172.21.1.23
172.32.2.11

and my playbook is look like this:



        
8条回答
  •  伪装坚强ぢ
    2020-12-25 11:52

    Below is my example for connecting with different ssh port using ansible-playbook.

    ---
    - hosts: test-server
      vars:
            ansible_ssh_user: 'rohit'
            ansible_password: '123456'
            ansible_port: '2222'
      tasks:
            - name: "print simple command"
              command: cat /usr/bin/myscript.sh
    

提交回复
热议问题