appleboy / ssh-action

GitHub Actions for executing remote ssh commands.
https://github.com/marketplace/actions/ssh-remote-commands
MIT License
4.84k stars 576 forks source link

是否支持多個主機,多個帳號連接ssh執行腳本的功能 #327

Closed bin862324915 closed 4 months ago

bin862324915 commented 4 months ago

首先非常感謝您開發了這麼好用的一個項目,我想請問一下這個項目是否支持運行多主機多帳號ssh連接執行多行腳本的功能,比如

- name: multiple command
  uses: appleboy/ssh-action@v1.0.3
  with:
    host: ${{ secrets.HOSTS }} # HOSTS值为:foo.com,bar.com
    username: ${{ secrets.USERNAMES }} # USERNAMES值为:userfoo,userbar
    password: ${{ secrets.PASSWORDS }} # PASSWORD值为:adminfoo,adminbar
    port: ${{ secrets.PORT }}
    script: |
      whoami
      ls -al
appleboy commented 4 months ago

try the multiple steps to resolve the issue.

- name: multiple command 01
  uses: appleboy/ssh-action@v1.0.3
  with:
    host: ${{ secrets.HOSTS01 }} 
    username: ${{ secrets.USERNAMES01 }} 
    password: ${{ secrets.PASSWORDS01 }} 
    port: ${{ secrets.PORT01 }}
    script: |
      whoami
      ls -al

- name: multiple command 02
  uses: appleboy/ssh-action@v1.0.3
  with:
    host: ${{ secrets.HOSTS02 }} 
    username: ${{ secrets.USERNAMES02 }} 
    password: ${{ secrets.PASSWORDS02 }} 
    port: ${{ secrets.PORT02 }}
    script: |
      whoami
      ls -al

- name: multiple command 03
  uses: appleboy/ssh-action@v1.0.3
  with:
    host: ${{ secrets.HOSTS03 }} 
    username: ${{ secrets.USERNAMES03 }} 
    password: ${{ secrets.PASSWORDS03 }} 
    port: ${{ secrets.PORT03 }}
    script: |
      whoami
      ls -al
bin862324915 commented 4 months ago

好的,非常感谢您