mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-09 02:45:17 +00:00
Refactor task includes and update variable handling for Ansible 2.20 migration
This commit updates multiple roles to ensure compatibility with Ansible 2.20. Several include paths and task-loading mechanisms required adjustments, as Ansible 2.20 applies stricter evaluation rules for complex Jinja expressions and no longer resolves certain relative include paths the way Ansible 2.18 did. Key changes: - Replaced legacy once_finalize.yml and once_flag.yml with the new structure under tasks/utils/once/finalize.yml and tasks/utils/once/flag.yml. - Updated all include_tasks statements to use 'path_join' with playbook_dir, ensuring deterministic and absolute file resolution across roles. - Fixed all network helper includes by converting direct relative paths such as 'roles/docker-compose/tasks/utils/network.yml' to proper Jinja-evaluated paths. - Normalized MATOMO_* variable names for consistency with the updated variable scope behavior in Ansible 2.20. - Removed deprecated patterns that were implicitly supported in Ansible 2.18 but break under the more strict variable and path resolution model in 2.20. These changes are part of the full migration step required to ensure the infinito-nexus roles remain stable, deterministic, and forward-compatible with Ansible 2.20. Details of the discussion and reasoning can be found in this conversation: https://chatgpt.com/share/69300a8d-24d4-800f-bec0-e895a695618a
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
---
|
||||
- name: "Wait until the Snipe-IT Login is available"
|
||||
uri:
|
||||
url: "{{ snipe_it_url }}/login"
|
||||
url: "{{ SNIPE_IT_URL }}/login"
|
||||
method: GET
|
||||
return_content: no
|
||||
status_code: 200
|
||||
@@ -12,12 +12,12 @@
|
||||
until: snipeit_admin_check.status == 200
|
||||
when: not ( applications | get_app_conf(application_id, 'features.oauth2', False))
|
||||
|
||||
- name: "Set all LDAP settings via Laravel Setting model (inside container as {{ snipe_it_user }})"
|
||||
- name: "Set all LDAP settings via Laravel Setting model (inside container as {{ SNIPE_IT_USER }})"
|
||||
shell: |
|
||||
docker-compose exec -T \
|
||||
-e APP_KEY='{{ applications | get_app_conf(application_id, 'credentials.app_key', True) }}' \
|
||||
-e XDG_CONFIG_HOME=/tmp \
|
||||
-u {{ snipe_it_user }} application \
|
||||
-u {{ SNIPE_IT_USER }} application \
|
||||
sh -c 'php artisan tinker << "EOF"
|
||||
$s = \App\Models\Setting::getSettings();
|
||||
$s->ldap_enabled = 1;
|
||||
@@ -53,7 +53,7 @@
|
||||
- name: Encrypt & save LDAP bind password via Crypt + DB façade
|
||||
shell: |
|
||||
docker-compose exec -T \
|
||||
-u {{ snipe_it_user }} \
|
||||
-u {{ SNIPE_IT_USER }} \
|
||||
-e APP_KEY="{{ applications | get_app_conf(application_id, 'credentials.app_key', True) }}" \
|
||||
-e XDG_CONFIG_HOME=/tmp \
|
||||
application \
|
||||
@@ -76,10 +76,10 @@
|
||||
register: ldap_encrypt
|
||||
failed_when: ldap_encrypt.rc != 0
|
||||
|
||||
- name: "Clear Laravel config & cache (inside container as {{ snipe_it_user }})"
|
||||
- name: "Clear Laravel config & cache (inside container as {{ SNIPE_IT_USER }})"
|
||||
shell: |
|
||||
docker-compose exec -T -u {{ snipe_it_user }} application php artisan config:clear
|
||||
docker-compose exec -T -u {{ snipe_it_user }} application php artisan cache:clear
|
||||
docker-compose exec -T -u {{ SNIPE_IT_USER }} application php artisan config:clear
|
||||
docker-compose exec -T -u {{ SNIPE_IT_USER }} application php artisan cache:clear
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
notify: docker compose up
|
||||
@@ -2,6 +2,8 @@
|
||||
- name: "load docker, db and proxy for {{ application_id }}"
|
||||
include_role:
|
||||
name: sys-stk-full-stateful
|
||||
vars:
|
||||
docker_compose_flush_handlers: true
|
||||
|
||||
- name: "Configure Snipe-IT LDAP settings"
|
||||
import_tasks: ldap.yml
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
application:
|
||||
{% set container_port = 80 %}
|
||||
image: "{{ snipe_it_image }}:{{ snipe_it_version }}"
|
||||
container_name: "{{ snipe_it_container }}"
|
||||
image: "{{ SNIPE_IT_IMAGE }}:{{ SNIPE_IT_VERSION }}"
|
||||
container_name: "{{ SNIPE_IT_CONTAINER }}"
|
||||
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
||||
volumes:
|
||||
- data:/var/lib/snipeit
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
|
||||
data:
|
||||
name: "{{ snipe_it_volume }}"
|
||||
name: "{{ SNIPE_IT_VOLUME }}"
|
||||
|
||||
{% include 'roles/docker-compose/templates/networks.yml.j2' %}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
APP_ENV={{ ENVIRONMENT | lower }}
|
||||
APP_DEBUG={{MODE_DEBUG | string | lower }}
|
||||
APP_KEY={{ applications | get_app_conf(application_id, 'credentials.app_key', True)}}
|
||||
APP_URL={{ snipe_it_url }}
|
||||
APP_URL={{ SNIPE_IT_URL }}
|
||||
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - TZ identifier
|
||||
APP_TIMEZONE='{{ HOST_TIMEZONE }}'
|
||||
APP_LOCALE={{ HOST_LL }}
|
||||
|
||||
@@ -2,16 +2,13 @@
|
||||
application_id: "web-app-snipe-it"
|
||||
|
||||
# Database
|
||||
database_password: "{{ applications | get_app_conf(application_id, 'credentials.database_password', True) }}"
|
||||
database_password: "{{ applications | get_app_conf(application_id, 'credentials.database_password') }}"
|
||||
database_type: "mariadb"
|
||||
|
||||
# Docker
|
||||
docker_compose_flush_handlers: true
|
||||
|
||||
# Snipe-IT specific
|
||||
snipe_it_url: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
|
||||
snipe_it_version: "{{ applications | get_app_conf(application_id, 'docker.services.snipe-it.version', True) }}"
|
||||
snipe_it_image: "{{ applications | get_app_conf(application_id, 'docker.services.snipe-it.image', True) }}"
|
||||
snipe_it_container: "{{ applications | get_app_conf(application_id, 'docker.services.snipe-it.name', True) }}"
|
||||
snipe_it_volume: "{{ applications | get_app_conf(application_id, 'docker.volumes.data', True) }}"
|
||||
snipe_it_user: "www-data"
|
||||
SNIPE_IT_URL: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
|
||||
SNIPE_IT_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.snipe-it.version') }}"
|
||||
SNIPE_IT_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.snipe-it.image') }}"
|
||||
SNIPE_IT_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.snipe-it.name') }}"
|
||||
SNIPE_IT_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}"
|
||||
SNIPE_IT_USER: "www-data"
|
||||
Reference in New Issue
Block a user