action-ansible-playbook/.github/workflows/test.yml

59 lines
1.5 KiB
YAML
Raw Normal View History

2020-03-21 10:06:40 -06:00
name: Test Action
on: push
jobs:
2020-04-06 15:45:33 -06:00
test-remote:
2020-03-21 10:06:40 -06:00
runs-on: ubuntu-latest
steps:
2020-03-22 05:17:17 -06:00
- name: Checkout code
2020-03-21 10:06:40 -06:00
uses: actions/checkout@v2
2020-03-22 05:17:17 -06:00
- name: Test remote
run: |
docker build -t host -f Dockerfile.test .
docker build -t action -f Dockerfile .
2020-03-22 05:27:35 -06:00
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 \
2020-03-24 15:26:46 -06:00
-e INPUT_PLAYBOOK="playbook.yml" \
-e INPUT_DIRECTORY="./" \
2020-03-22 05:27:35 -06:00
-e INPUT_KEY="${{secrets.SSH_PRIVATE_KEY}}" \
2020-03-22 05:47:57 -06:00
-e INPUT_OPTIONS="--inventory hosts --limit remote" \
2020-03-22 05:27:35 -06:00
action
2020-04-06 15:45:33 -06:00
test-local:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
2020-03-22 05:17:17 -06:00
- name: Test local
2020-03-21 10:06:40 -06:00
uses: ./
with:
playbook: playbook.yml
key: ${{secrets.SSH_PRIVATE_KEY}}
2020-04-06 15:53:57 -06:00
options: |
2020-03-22 05:47:57 -06:00
--inventory hosts
2020-04-06 15:39:47 -06:00
--limit local
2020-04-06 16:03:41 -06:00
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: |
2020-04-06 16:58:47 -06:00
[all]
2020-04-06 16:03:41 -06:00
localhost ansible_user=root ansible_connection=local
options: |
2020-04-06 16:58:47 -06:00
-e key1=val1
-e key2=val2