How to execute a shell script on a remote server using Ansible?

前端 未结 4 1456
一向
一向 2020-12-23 13:22

I am planning to execute a shell script on a remote server using Ansible playbook.

blank test.sh file:

touch test.sh

Playbook:

4条回答
  •  一个人的身影
    2020-12-23 14:01

    you can use script module

    Example

    - name: Transfer and execute a script.
      hosts: all
      tasks:
    
         - name: Copy and Execute the script 
           script: /home/user/userScript.sh
    

提交回复
热议问题