Add an Gitea Action for Deploying Ansible Playbooks #1

Merged
BenHays42 merged 12 commits from ansible-deploy-action into main 2024-10-13 01:42:00 +00:00
2 changed files with 43 additions and 20 deletions
Showing only changes of commit 5b0d0aa13e - Show all commits

View File

@ -1,7 +1,11 @@
name: Ansible Deploy name: Ansible Deploy
on: [push] on: [push]
jobs: jobs:
build:
uses: ./.gitea/workflows/ansible-install.yml
deploy: deploy:
needs: [ 'build' ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
RUNNER_TOOL_CACHE: /toolcache RUNNER_TOOL_CACHE: /toolcache
@ -22,26 +26,6 @@ jobs:
echo '${{secrets.SSH_PRIVATE_KEY}}' > ~/.ssh/id_rsa echo '${{secrets.SSH_PRIVATE_KEY}}' > ~/.ssh/id_rsa
chmod 600 ~/.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 - name: Run playbook
uses: dawidd6/action-ansible-playbook@v2 uses: dawidd6/action-ansible-playbook@v2
with: with:

View File

@ -0,0 +1,39 @@
name: Install Ansible using Pip
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
env:
RUNNER_TOOL_CACHE: /toolcache
ANSIBLE_VERSION: "8.7.0"
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