homelab-automation/.gitea/workflows/ansible-deploy.yml
Benjamin Hays 55dcb55854
All checks were successful
Ansible Deploy / deploy (Ansible/cloudflare-dns.yml) (push) Successful in 1m6s
Ansible Deploy / deploy (Ansible/debian.yml) (push) Successful in 1m18s
Ansible Deploy / deploy (Ansible/heartbeat.yml) (push) Successful in 59s
Ansible Deploy / deploy (Ansible/openssh.yml) (push) Successful in 1m17s
Ansible Lint / build (push) Successful in 1m10s
Revert "revert to pip version and try new caching method"
This reverts commit 5b0d0aa13e.
2024-10-12 21:32:25 -04:00

57 lines
1.6 KiB
YAML

name: Ansible Deploy
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
env:
RUNNER_TOOL_CACHE: /toolcache
ANSIBLE_VERSION: "8.7.0"
strategy:
matrix:
playbook:
- Ansible/openssh.yml
- Ansible/cloudflare-dns.yml
- Ansible/heartbeat.yml
- Ansible/debian.yml
steps:
- name: Copy SSH Key
run: |
mkdir ~/.ssh/
echo "Host *" > ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
echo '${{secrets.SSH_PRIVATE_KEY}}' > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- uses: actions/checkout@v3
with:
submodules: recursive
- name: "Cache python packages"
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ env.ANSIBLE_VERSION }}
- name: Install Ansible
run: |
apt update -y
apt install python3-pip -y
python3 -m pip install ansible==${{ env.ANSIBLE_VERSION }}
#- name: Install Ansible Galaxy requirements
# run: |
# ansible-galaxy install -r requirements.yaml
- name: Run playbook
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: ${{ matrix.playbook }}
directory: ./
key: ${{secrets.SSH_PRIVATE_KEY}}
vault_password: ${{secrets.VAULT_PASSWORD}}
# requirements: requirements.yaml
options: |
--inventory Ansible/inventory.ini
--extra-vars "@Ansible/homelab-vault/secrets.yml"