想用不带ssh的方式获取远程主机到要在本地运行python脚本的远程主机。通过传递远程主机已输入到我的python脚本 通过{{stocker_hostname}}”。
- hosts: "{{ variable_host | default('web')}}"
become: true
any_errors_fatal: yes
serial: 1
tasks:
- name: execute install script
command: python myscript.py -i "{{ inventory_hostname }}" -f script.cql -u username-p password
delegate_to: 127.0.0.1
我遇到了错误
FAILED! => {"changed": false, "failed": true, "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}