mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-11-21 23:19:24 +00:00
workflows: refactor
This commit is contained in:
parent
9c19e7ec30
commit
0d7274dc6a
1 changed files with 61 additions and 33 deletions
94
.github/workflows/test.yml
vendored
94
.github/workflows/test.yml
vendored
|
@ -7,14 +7,56 @@ on:
|
|||
pull_request:
|
||||
|
||||
jobs:
|
||||
test-remote:
|
||||
remote:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SSH_PRIVATE_KEY: |
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
|
||||
NhAAAAAwEAAQAAAYEAw1mPRVbmzA1LGWbk9rk9lNxC34M7ZlCHi/OAgglMtFfP6f95hoNA
|
||||
mSggomlTgQNysk1/kTfhVuIvVDVroTV6iyxM6b0eBOwSMglZn60PPZCXzF+VstfrMUH5Vd
|
||||
PbuahVTW453g1ZAhwA+EPDBMEp2VzzbZgX7dCO0WnYrIrXknfiJ+sNYErVm9WqY58a7aoi
|
||||
Y4eCgRD/9FGMyGoQcrmuHPR6tKCN0zIoVKl/wjzWH2jRUhRbZbf7V72VN+lWwJyciH7V+S
|
||||
l4YZiob/JmW0FIPcWckoO1+hLUAQ0LpSaoCyz7ua+G0wgRoeLH3c32yQVjAHFesYzQymhn
|
||||
/KVZBRPfdI2Hjzqj+cnYvyfy0t3R8/K6rdutRSYaQoqfFaFxoWtl59B/v5/IEE7s0Zsy2B
|
||||
5ZJ4SbdYs1lA74UUGn+XjXVor7TTxvDWBV83npHFGBOhn3gqSLRcZ8JLb7KY5CGhbpy3z7
|
||||
y5JDY0lYiZaWXTUQmIOfX54csTu40+yCnlCjRHaDAAAFiAuND90LjQ/dAAAAB3NzaC1yc2
|
||||
EAAAGBAMNZj0VW5swNSxlm5Pa5PZTcQt+DO2ZQh4vzgIIJTLRXz+n/eYaDQJkoIKJpU4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E7BIyCVmfrQ89kJfMX5Wy1+sxQflV09u5qFVNbjneDVkCHAD4Q8MEwSnZXPNtmBft0I7RadisiteSd+In6w1gStWb1apjnxrtqiJjh4KBEP/0UYzIahByua4c9Hq0oI3TMihUqX/CPNYfaNFSFFtlt/tXvZU36VbAnJyIftX5KXhhmKhv8mZbQUg9xZySg7X6EtQBDQulJqgLLPu5r4bTCBGh4sfdzfbJBWMAcV6xjNDKaGf8pVkFE990jYePOqP5ydi/J/LS3dHz8rqt261FJhpCip8VoXGha2Xn0H+/n8gQTuzRmzLYHlknhJt1izWUDvhRQaf5eNdWivtNPG8NYFXzeekcUYE6GfeCpItFxnwktvspjkIaFunLfPvLkkNjSViJlpZdNRCYg59fnhyxO7jT7IKeUKNEdoM=
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup remote
|
||||
run: |
|
||||
echo "${{secrets.SSH_PUBLIC_KEY}}" | sudo tee /etc/ssh/authorized_keys
|
||||
echo "$SSH_PUBLIC_KEY" | sudo tee /etc/ssh/authorized_keys
|
||||
sudo tee /etc/ssh/sshd_config <<EOF
|
||||
PasswordAuthentication no
|
||||
PubkeyAuthentication yes
|
||||
|
@ -23,12 +65,14 @@ jobs:
|
|||
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||
EOF
|
||||
sudo systemctl restart sshd
|
||||
- name: Test remote
|
||||
- name: With everything
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
key: ${{env.SSH_PRIVATE_KEY}}
|
||||
directory: test
|
||||
key: ${{secrets.SSH_PRIVATE_KEY}}
|
||||
vault_password: test
|
||||
requirements: requirements.yml
|
||||
inventory: |
|
||||
[all]
|
||||
localhost
|
||||
|
@ -39,48 +83,32 @@ jobs:
|
|||
-e db_name=db_name
|
||||
-e db_user=db_user
|
||||
-e db_pass=db_pass
|
||||
test-local:
|
||||
local:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Test local
|
||||
- name: With directory
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
directory: test
|
||||
options: --inventory hosts
|
||||
- name: With requirements
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
requirements: requirements.yml
|
||||
options: |
|
||||
--inventory hosts
|
||||
--limit local
|
||||
- name: Test local
|
||||
options: --inventory hosts
|
||||
- name: With requirements bundle
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
requirements: requirements-bundle.yml
|
||||
options: |
|
||||
--inventory hosts
|
||||
--limit local
|
||||
test-local-more:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Test local
|
||||
options: --inventory hosts
|
||||
- name: With vault password
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
vault_password: test
|
||||
inventory: |
|
||||
[all]
|
||||
localhost ansible_connection=local
|
||||
options: |
|
||||
-e key1=val1
|
||||
-e key2=val2
|
||||
- name: Test local
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
vault_password: test
|
||||
inventory: |
|
||||
[all]
|
||||
localhost ansible_connection=local
|
||||
options: --inventory hosts
|
||||
|
|
Loading…
Reference in a new issue