update
Some checks failed
Deploy Minecraft Server / deploy (push) Failing after 1m25s
Ansible Lint / lint (push) Failing after 12s

This commit is contained in:
2025-08-26 14:28:09 +02:00
parent 0315edf95f
commit 31711c7627
105 changed files with 1419 additions and 366 deletions

View File

@@ -1,51 +0,0 @@
name: Run ansible
on:
push:
schedule:
- cron: "0 */12 * * *"
jobs:
ansible_lint_and_syntax_check:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install ansible
run: |
apt update && apt upgrade -y
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Ansible and dependencies
run: |
pip install ansible ansible-lint
- name: Run Ansible Lint
run: ansible-lint
continue-on-error: true
- name: Run playbook "Minecraft"
run: |
ansible-playbook -i inventories/hosts playbook.yml
run-ansible-playbook:
needs: ansible_lint_and_syntax_check # Ce job dépend du succès du précédent
runs-on: ubuntu-latest
if: gitea.ref == 'refs/heads/main' # Ce job ne s'exécute que pour les push sur la branche 'main'
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Ansible and dependencies
run: |
pip install ansible

View File

@@ -0,0 +1,54 @@
name: Deploy Minecraft Server
on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy'
required: true
default: 'staging'
type: choice
options:
- staging
- production
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment || 'staging' }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Ansible
run: pip install ansible
- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.ANSIBLE_SSH_KEY }}" > ~/.ssh/ansible_key
chmod 600 ~/.ssh/ansible_key
ssh-keyscan -H ${{ secrets.ANSIBLE_HOST }} >> ~/.ssh/known_hosts
- name: Create vault password file
run: echo "${{ secrets.ANSIBLE_VAULT_PASSWORD }}" > ~/.ansible_vault_pass
- name: Deploy to staging
if: ${{ github.event.inputs.environment == 'staging' || github.ref == 'refs/heads/develop' }}
run: |
ansible-playbook -i inventories/staging/hosts.yml site.yml \
--vault-password-file ~/.ansible_vault_pass \
--private-key ~/.ssh/ansible_key
- name: Deploy to production
if: ${{ github.event.inputs.environment == 'production' || github.ref == 'refs/heads/main' }}
run: |
ansible-playbook -i inventories/production/hosts.yml site.yml \
--vault-password-file ~/.ansible_vault_pass \
--private-key ~/.ssh/ansible_key

33
.gitea/workflows/lint.yml Normal file
View File

@@ -0,0 +1,33 @@
name: Ansible Lint
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install ansible ansible-lint yamllint
- name: Run yamllint
run: yamllint .
- name: Run ansible-lint
run: ansible-lint
- name: Validate inventory files
run: |
ansible-inventory --list -i inventories/production/hosts.yml
ansible-inventory --list -i inventories/staging/hosts.yml