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 ", "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 < 1