mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-11-22 15:32:18 +00:00
58 lines
1.5 KiB
YAML
58 lines
1.5 KiB
YAML
name: Test Action
|
|
|
|
on: push
|
|
|
|
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: ./
|
|
key: ${{secrets.SSH_PRIVATE_KEY}}
|
|
inventory: |
|
|
[all]
|
|
localhost
|
|
test-local:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Test local
|
|
uses: ./
|
|
with:
|
|
playbook: playbook.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
|