mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-11-22 15:32:18 +00:00
60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
name: Test Action
|
|
|
|
on: push
|
|
|
|
jobs:
|
|
test-remote:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Test remote
|
|
run: |
|
|
docker build -t host -f Dockerfile.test .
|
|
docker build -t action -f Dockerfile .
|
|
docker run -d \
|
|
--name host \
|
|
-e SSH_PUBLIC_KEY="${{secrets.SSH_PUBLIC_KEY}}" \
|
|
host
|
|
docker run -t \
|
|
--name action \
|
|
--link host \
|
|
-v $PWD:/wd \
|
|
-w /wd \
|
|
-e INPUT_PLAYBOOK="playbook.yml" \
|
|
-e INPUT_DIRECTORY="./" \
|
|
-e INPUT_KEY="${{secrets.SSH_PRIVATE_KEY}}" \
|
|
-e INPUT_OPTIONS="--inventory hosts --limit remote" \
|
|
action
|
|
test-local:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Test local
|
|
uses: ./
|
|
with:
|
|
playbook: playbook.yml
|
|
key: ${{secrets.SSH_PRIVATE_KEY}}
|
|
options: |
|
|
--inventory hosts
|
|
--limit local
|
|
test-local-more:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Test local
|
|
uses: ./
|
|
with:
|
|
playbook: playbook.yml
|
|
key: ${{secrets.SSH_PRIVATE_KEY}}
|
|
vault_password: test
|
|
inventory: |
|
|
[remote]
|
|
host ansible_user=user
|
|
|
|
[local]
|
|
localhost ansible_user=root ansible_connection=local
|
|
options: |
|
|
--limit local
|