Skip to content

fixed logic

fixed logic #5

Workflow file for this run

---
name: GitOps
on:
push:
branches: [main, development]
pull_request:
schedule:
- cron: '53 1 */15 * *'
jobs:
lint:
runs-on: ubuntu-latest
container:
image: ghcr.io/secshellnet/ansible-vyos-lint
steps:
- uses: actions/checkout@v3
- name: Run ansible-lint
run: |
ansible-lint -x yaml[comments],yaml[empty-lines],\
yaml[new-line-at-end-of-file],yaml[trailing-spaces],\
var-spacing,command-instead-of-shell,no-changed-when,\
name[template],args[module]
run:
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@v3
if: env.ENABLE_GITOPS == '1'
- name: Prepare environment
if: env.ENABLE_GITOPS == '1'
run: |
echo "${{ secrets.SSH_KEY }}" > .keys/id_eddsa
chmod 600 .keys/id_ecdsa
echo "${{ secrets.ANSIBLE_KEYS_ALL }}" > .keys/all
git submodule update
ansible-galaxy collection install hetzner.hcloud
/opt/pipx/venvs/ansible-core/bin/python -m pip install -r requirements.txt
- name: Run ansible inventory in check mode
if: |
env.ENABLE_GITOPS == '1' &&
github.event_name != 'pull_request'
env:
ANSIBLE_HOST_KEY_CHECKING: false
run: |
ansible-playbook servers.yaml --check
- name: Deploy ansible inventory
if: |
env.ENABLE_GITOPS == '1' && github.event_name != 'pull_request'
env:
ANSIBLE_HOST_KEY_CHECKING: false
run: |
ansible-playbook servers.yaml