0

want to fetch remote hosts with out ssh to the remote host i want to run python script local. by passing remote host has input to my python script by {{ inventory_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

i got the error

FAILED! => {"changed": false, "failed": true, "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
cad
  • 337
  • 2
  • 15

1 Answers1

0

this looks like a case of ansible not knowing your sudo password.

see Specify sudo password for Ansible et al.

user2599522
  • 3,005
  • 2
  • 23
  • 40