ansible 配置了端口在host文件但是还要走22 ip:60001 ansible_ssh_port=60001

时间:2023-03-09 20:47:13
ansible 配置了端口在host文件但是还要走22    ip:60001         ansible_ssh_port=60001

fatal: [101.251.194.102]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 101.251.194.102 port 22: Connection refused\r\n", "unreachable": true}

ansible_ssh_port=60001

- hosts: zss
tasks:
- name: step1
ping:
- name: step2 统计
shell: egrep KFQX /etc/sudoers|wc -l
ignore_errors: True
register: check_value
- name: step3
shell: echo "Cmnd_Alias KFQX =/usr/local/bin/supervisorctl, /usr/bin/supervisorctl, /bin/cat, /bin/ls, /usr/bin/head, /usr/bin/tail, /bin/grep, /usr/local/php/bin/php, /usr/bin/crontab, /usr/bin/python2.7, /usr/bin/python, /usr/bin/python3, /usr/bin/svn" >>/etc/sudoers
when: check_value.stdout|int <