• 主页
  • 如何在Ansible的远程节点上执行python程序

如何在Ansible的远程节点上执行python程序

我想通过使用Ansible从控制节点复制python程序,在远程节点上运行python程序。

我能够成功地复制文件,但是它没有在远程服务器上执行python程序。

错误:“无法在Ansible控制器上找到或访问'/home/remote/files/program.py‘

- name: copy the program file to ubuntu
  copy:
    src: /home/ubuntu/ansible/program.py
    dest: /home/remote/files/program.py
    mode: '0777'
  when: ansible_user== 'remote'
- name: Run the python script in remote
  script: /home/pi/files/program.py
  args:
    executable: python3
  when: ansible_user== 'remote'

转载请注明出处:http://www.jxbyjx.net/article/20230509/1179496.html