Minor tweaks... too lazy to be detailed.
This commit is contained in:
@@ -6,9 +6,13 @@ on:
|
|||||||
branches-ignore:
|
branches-ignore:
|
||||||
- 'main'
|
- 'main'
|
||||||
paths:
|
paths:
|
||||||
- '**.j2'
|
- 'app-configs/**'
|
||||||
- '**/pr-ansible-config-deployment.yaml'
|
- 'inventory/hosts.yml'
|
||||||
- 'ansible/**.yml'
|
- 'host_vars/**.yml'
|
||||||
|
|
||||||
|
env:
|
||||||
|
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
|
||||||
|
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-and-create-pr:
|
check-and-create-pr:
|
||||||
@@ -31,8 +35,8 @@ jobs:
|
|||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
with:
|
with:
|
||||||
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
notification_title: 'GITEA: PR Check'
|
notification_title: 'GITEA: PR Check'
|
||||||
notification_message: 'Checking for existing PR... 🔍'
|
notification_message: 'Checking for existing PR... 🔍'
|
||||||
|
|
||||||
@@ -40,7 +44,7 @@ jobs:
|
|||||||
id: check-opened-pr-step
|
id: check-opened-pr-step
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
tea login add --name gitea-rinoa --url "${{ secrets.RINOA_GITEA_URL }}" --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
tea login add --name gitea-rinoa --url "${{ secrets.TV_GITEA_URL }}" --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
||||||
pr_exists=$(tea pr list --repo ${{ github.repository }} --state open --fields index,title,head | egrep '\[ANSIBLE\].*${{ github.ref_name }}' | tail -1 | wc -l)
|
pr_exists=$(tea pr list --repo ${{ github.repository }} --state open --fields index,title,head | egrep '\[ANSIBLE\].*${{ github.ref_name }}' | tail -1 | wc -l)
|
||||||
echo "exists=$pr_exists" >> $GITHUB_OUTPUT
|
echo "exists=$pr_exists" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
@@ -55,8 +59,8 @@ jobs:
|
|||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
with:
|
with:
|
||||||
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
notification_title: 'GITEA: PR Check'
|
notification_title: 'GITEA: PR Check'
|
||||||
notification_message: 'PR Created 🎟️'
|
notification_message: 'PR Created 🎟️'
|
||||||
|
|
||||||
@@ -68,7 +72,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
host: [rinoa, rikku, benedikta]
|
host: [rinoa, rikku, benedikta]
|
||||||
env:
|
env:
|
||||||
VAULT_ADDR: ${{ secrets.RINOA_VAULT_ADDR }}
|
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
|
||||||
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -98,8 +102,8 @@ jobs:
|
|||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
with:
|
with:
|
||||||
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
notification_title: 'GITEA: Ansible Dry Run'
|
notification_title: 'GITEA: Ansible Dry Run'
|
||||||
notification_message: 'Starting dry run for ${{ matrix.host }}...'
|
notification_message: 'Starting dry run for ${{ matrix.host }}...'
|
||||||
|
|
||||||
@@ -108,8 +112,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
directory: ansible/
|
directory: ansible/
|
||||||
playbook: homelab_config_deploy.yml
|
playbook: homelab_config_deploy.yml
|
||||||
key: ${{ secrets.RINOA_ANSIBLE_PRIVATE_KEY }}
|
key: ${{ secrets.ANSIBLE_PRIVATE_KEY }}
|
||||||
vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
|
|
||||||
requirements: collections/requirements.yml
|
requirements: collections/requirements.yml
|
||||||
options: |
|
options: |
|
||||||
--inventory inventory/hosts.yml
|
--inventory inventory/hosts.yml
|
||||||
@@ -119,8 +122,8 @@ jobs:
|
|||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
with:
|
with:
|
||||||
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
notification_title: 'GITEA: Ansible Dry Run'
|
notification_title: 'GITEA: Ansible Dry Run'
|
||||||
notification_message: 'Dry run for ${{ matrix.host }} completed.'
|
notification_message: 'Dry run for ${{ matrix.host }} completed.'
|
||||||
|
|
||||||
@@ -142,7 +145,7 @@ jobs:
|
|||||||
- name: PR Merge
|
- name: PR Merge
|
||||||
id: pr_merge
|
id: pr_merge
|
||||||
run: |
|
run: |
|
||||||
tea login add --name gitea-rinoa --url ${{ secrets.RINOA_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
tea login add --name gitea-rinoa --url ${{ secrets.TV_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
||||||
tea login default gitea-rinoa
|
tea login default gitea-rinoa
|
||||||
pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state --output csv | egrep ${{ github.ref_name }} | awk -F"," '{print $1}' | sed -e 's|"||g')
|
pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state --output csv | egrep ${{ github.ref_name }} | awk -F"," '{print $1}' | sed -e 's|"||g')
|
||||||
tea pr m --repo ${{ github.repository }} --title "Auto Merge of PR ${pr_index} - ${{ github.ref_name }}" --message "Merged by ${{ github.actor }}" ${pr_index}
|
tea pr m --repo ${{ github.repository }} --title "Auto Merge of PR ${pr_index} - ${{ github.ref_name }}" --message "Merged by ${{ github.actor }}" ${pr_index}
|
||||||
@@ -151,8 +154,8 @@ jobs:
|
|||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
with:
|
with:
|
||||||
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
notification_title: 'GITEA: PR Merge Successful'
|
notification_title: 'GITEA: PR Merge Successful'
|
||||||
notification_message: 'PR #${{ steps.pr_merge.outputs.pr_index }} merged.'
|
notification_message: 'PR #${{ steps.pr_merge.outputs.pr_index }} merged.'
|
||||||
|
|
||||||
@@ -164,7 +167,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
host: [rinoa, rikku, benedikta]
|
host: [rinoa, rikku, benedikta]
|
||||||
env:
|
env:
|
||||||
VAULT_ADDR: ${{ secrets.RINOA_VAULT_ADDR }}
|
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
|
||||||
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -188,8 +191,8 @@ jobs:
|
|||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
with:
|
with:
|
||||||
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
notification_title: 'GITEA: Ansible Config Deployment'
|
notification_title: 'GITEA: Ansible Config Deployment'
|
||||||
notification_message: 'Deploying configs to ${{ matrix.host }}...'
|
notification_message: 'Deploying configs to ${{ matrix.host }}...'
|
||||||
|
|
||||||
@@ -198,8 +201,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
directory: ansible/
|
directory: ansible/
|
||||||
playbook: homelab_config_deploy.yml
|
playbook: homelab_config_deploy.yml
|
||||||
key: ${{ secrets.RINOA_ANSIBLE_PRIVATE_KEY }}
|
key: ${{ secrets.ANSIBLE_PRIVATE_KEY }}
|
||||||
vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
|
|
||||||
requirements: collections/requirements.yml
|
requirements: collections/requirements.yml
|
||||||
options: |
|
options: |
|
||||||
--inventory inventory/hosts.yml
|
--inventory inventory/hosts.yml
|
||||||
@@ -208,7 +210,7 @@ jobs:
|
|||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
with:
|
with:
|
||||||
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
notification_title: 'GITEA: Deployment Completed'
|
notification_title: 'GITEA: Deployment Completed'
|
||||||
notification_message: 'Deployment to ${{ matrix.host }} completed successfully.'
|
notification_message: 'Deployment to ${{ matrix.host }} completed successfully.'
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ collections:
|
|||||||
- name: community.hashi_vault
|
- name: community.hashi_vault
|
||||||
version: 6.2.0
|
version: 6.2.0
|
||||||
- name: community.general
|
- name: community.general
|
||||||
version: "6.*" # or whatever stable version you prefer
|
version: "6.*"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Deploy Docker Service Configurations (Mirrored & Vault-ready)
|
- name: Deploy Docker Service Configurations (Optimized & Vault-ready)
|
||||||
hosts:
|
hosts:
|
||||||
- rinoa
|
- rinoa
|
||||||
- rikku
|
- rikku
|
||||||
@@ -11,10 +11,6 @@
|
|||||||
# appdata_base_path, secrets_path, vault_token_cleaned from host_vars/<host>.yml
|
# appdata_base_path, secrets_path, vault_token_cleaned from host_vars/<host>.yml
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Set vault token from environment
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
vault_token_cleaned: "{{ lookup('env', vault_token_env_var) }}"
|
|
||||||
|
|
||||||
- name: Find all files for this host
|
- name: Find all files for this host
|
||||||
ansible.builtin.find:
|
ansible.builtin.find:
|
||||||
paths: "{{ template_base_path }}/{{ inventory_hostname }}"
|
paths: "{{ template_base_path }}/{{ inventory_hostname }}"
|
||||||
@@ -28,6 +24,7 @@
|
|||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
dest: "{{ appdata_base_path }}/{{ item.path | community.general.relpath(template_base_path + '/' + inventory_hostname) | regex_replace('\\.j2$', '') }}"
|
dest: "{{ appdata_base_path }}/{{ item.path | community.general.relpath(template_base_path + '/' + inventory_hostname) | regex_replace('\\.j2$', '') }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
create_dirs: yes
|
||||||
loop: "{{ host_files.files }}"
|
loop: "{{ host_files.files }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path }}"
|
label: "{{ item.path }}"
|
||||||
@@ -39,6 +36,7 @@
|
|||||||
dest: "{{ appdata_base_path }}/{{ item.path | community.general.relpath(template_base_path + '/' + inventory_hostname) }}"
|
dest: "{{ appdata_base_path }}/{{ item.path | community.general.relpath(template_base_path + '/' + inventory_hostname) }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
remote_src: no
|
remote_src: no
|
||||||
|
create_dirs: yes
|
||||||
loop: "{{ host_files.files }}"
|
loop: "{{ host_files.files }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path }}"
|
label: "{{ item.path }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user