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

78 lines
1.9 KiB
YAML
Raw Normal View History

2020-03-21 10:06:40 -06:00
name: Test Action
2020-08-30 04:06:25 -06:00
on:
push:
branches:
- master
pull_request:
2020-03-21 10:06:40 -06:00
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-05-01 12:11:28 -06:00
- name: Setup remote
2020-03-22 05:17:17 -06:00
run: |
2020-05-01 12:11:28 -06:00
echo "${{secrets.SSH_PUBLIC_KEY}}" | sudo tee /etc/ssh/authorized_keys
sudo tee /etc/ssh/sshd_config <<EOF
PasswordAuthentication no
PubkeyAuthentication yes
AuthorizedKeysFile /etc/ssh/authorized_keys
PermitRootLogin no
Subsystem sftp /usr/lib/openssh/sftp-server
EOF
sudo systemctl restart sshd
- name: Test remote
uses: ./
with:
playbook: playbook.yml
2020-05-14 12:20:43 -06:00
directory: test
2020-05-01 12:11:28 -06:00
key: ${{secrets.SSH_PRIVATE_KEY}}
inventory: |
[all]
localhost
2020-05-03 04:45:56 -06:00
options: |
-e docker_image=docker_url
2020-09-04 02:16:36 -06:00
-e docker_username=user
-e docker_password=pass
2020-05-03 04:45:56 -06:00
-e db_name=db_name
-e db_user=db_user
-e db_pass=db_pass
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
2020-04-06 15:53:57 -06:00
options: |
2020-05-01 12:11:28 -06:00
--inventory hosts
--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
vault_password: test
inventory: |
2020-04-06 16:58:47 -06:00
[all]
2020-05-01 12:11:28 -06:00
localhost ansible_connection=local
2020-04-06 16:03:41 -06:00
options: |
2020-04-06 16:58:47 -06:00
-e key1=val1
-e key2=val2
- name: Test local
uses: ./
with:
playbook: playbook.yml
vault_password: test
inventory: |
[all]
localhost ansible_connection=local