54 lines
1.3 KiB
YAML
54 lines
1.3 KiB
YAML
name: Run Ansible Playbook
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
force:
|
|
type: boolean
|
|
description: "Force re-install"
|
|
required: true
|
|
default: false
|
|
version:
|
|
description: "Golang version"
|
|
required: true
|
|
target:
|
|
description: "Target hosts"
|
|
required: true
|
|
default: "prodesk"
|
|
type: choice
|
|
options:
|
|
- "all"
|
|
- "prodesk"
|
|
|
|
jobs:
|
|
ansible-job:
|
|
runs-on: homelab
|
|
container:
|
|
image: dtrotskiy/ansible
|
|
|
|
steps:
|
|
- name: Setup SSH key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
|
|
- name: Setup SSH key
|
|
run: |
|
|
apk add --no-cache git openssh nodejs npm
|
|
node -v && npm -v
|
|
|
|
- name: Checkout code (with actions)
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Checkout dir
|
|
run: |
|
|
ls -la
|
|
|
|
- name: Checkout code (with git clone)
|
|
run: |
|
|
git clone https://gitea.bwonsamdi.ru/HomeLab/gonfig.git dump
|
|
|
|
- name: Run Ansible playbook
|
|
run: |
|
|
ansible-playbook ./dump/playbook.yml -i ./dump/hosts.yml -e "go_version=${{ inputs.version }} force=${{ inputs.force }} TARGET=prodesk" |