mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-12-28 11:06:09 -07:00
87 lines
2.2 KiB
YAML
87 lines
2.2 KiB
YAML
name: Test Action
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
jobs:
|
|
test-remote:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Setup remote
|
|
run: |
|
|
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
|
|
directory: test
|
|
key: ${{secrets.SSH_PRIVATE_KEY}}
|
|
inventory: |
|
|
[all]
|
|
localhost
|
|
options: |
|
|
-e docker_image=docker_url
|
|
-e docker_username=user
|
|
-e docker_password=pass
|
|
-e db_name=db_name
|
|
-e db_user=db_user
|
|
-e db_pass=db_pass
|
|
test-local:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Test local
|
|
uses: ./
|
|
with:
|
|
playbook: playbook.yml
|
|
requirements: requirements.yml
|
|
options: |
|
|
--inventory hosts
|
|
--limit local
|
|
- name: Test local
|
|
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
|
|
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
|