fix: update Ansible facts syntax for future compatibility

- Use ansible_facts[] instead of ansible_ prefix
- Update os_family, distribution, default_ipv4, date_time, hostname, port
- Also fixes YAML colons in msg strings
This commit is contained in:
Sebastian Palencsar
2026-05-06 14:09:22 +02:00
parent cfb63da386
commit da2f0876dd
3 changed files with 24 additions and 24 deletions

View File

@@ -20,15 +20,15 @@
- name: Debug OS information - name: Debug OS information
debug: debug:
msg: | msg: |
OS Family: {{ ansible_os_family }} OS Family: {{ ansible_facts["os_family"] }}
Distribution: {{ ansible_distribution }} Distribution: {{ ansible_facts["distribution"] }}
Version: {{ ansible_distribution_version }} Version: {{ ansible_facts["distribution_version"] }}
Supported: Ubuntu/Debian family systems Supported: Ubuntu/Debian family systems
- name: Verify supported OS - name: Verify supported OS
fail: fail:
msg: "This playbook only supports Ubuntu/Debian systems. Detected: {{ ansible_os_family }}" msg: "This playbook only supports Ubuntu/Debian systems. Detected {{ ansible_facts['os_family'] }}"
when: ansible_os_family != "Debian" when: ansible_facts["os_family"] != "Debian"
# Environment Detection and Configuration # Environment Detection and Configuration
- name: Detect if running in Docker - name: Detect if running in Docker
@@ -54,7 +54,7 @@
vars: vars:
_auto_wp_url: >- _auto_wp_url: >-
{{ 'http://localhost:8080' if (deployment_environment == 'docker') {{ 'http://localhost:8080' if (deployment_environment == 'docker')
else 'http://' + (ansible_default_ipv4.address | default('localhost')) }} else 'http://' + (ansible_facts["default_ipv4"]["address"] | default('localhost')) }}
tags: always tags: always
- name: Debug deployment configuration - name: Debug deployment configuration
@@ -71,7 +71,7 @@
# WordPress Configuration # WordPress Configuration
wordpress_path: "{{ web_root }}" wordpress_path: "{{ web_root }}"
wordpress_url: "http://{{ ansible_default_ipv4.address | default('localhost') }}" wordpress_url: "http://{{ ansible_facts['default_ipv4']['address'] | default('localhost') }}"
# Database Configuration (use inventory variables or these defaults) # Database Configuration (use inventory variables or these defaults)
default_mysql_root_password: "{{ mysql_root_password | default('secure_root_password_123') }}" default_mysql_root_password: "{{ mysql_root_password | default('secure_root_password_123') }}"

View File

@@ -20,15 +20,15 @@
- name: Debug OS information - name: Debug OS information
debug: debug:
msg: | msg: |
OS Family: {{ ansible_os_family }} OS Family: {{ ansible_facts["os_family"] }}
Distribution: {{ ansible_distribution }} Distribution: {{ ansible_facts["distribution"] }}
Version: {{ ansible_distribution_version }} Version: {{ ansible_facts["distribution_version"] }}
Supported: Ubuntu/Debian family systems Supported: Ubuntu/Debian family systems
- name: Verify supported OS - name: Verify supported OS
fail: fail:
msg: "This playbook only supports Ubuntu/Debian systems. Detected: {{ ansible_os_family }}" msg: "This playbook only supports Ubuntu/Debian systems. Detected {{ ansible_facts['os_family'] }}"
when: ansible_os_family != "Debian" when: ansible_facts["os_family"] != "Debian"
# Environment Detection and Configuration # Environment Detection and Configuration
- name: Detect if running in Docker - name: Detect if running in Docker
@@ -54,7 +54,7 @@
vars: vars:
_auto_wp_url: >- _auto_wp_url: >-
{{ 'http://localhost:8080' if (deployment_environment == 'docker') {{ 'http://localhost:8080' if (deployment_environment == 'docker')
else 'http://' + (ansible_default_ipv4.address | default('localhost')) }} else 'http://' + (ansible_facts["default_ipv4"]["address"] | default('localhost')) }}
tags: always tags: always
- name: Debug deployment configuration - name: Debug deployment configuration
@@ -71,7 +71,7 @@
# WordPress Configuration # WordPress Configuration
wordpress_path: "{{ web_root }}" wordpress_path: "{{ web_root }}"
wordpress_url: "http://{{ ansible_default_ipv4.address | default('localhost') }}" wordpress_url: "http://{{ ansible_facts['default_ipv4']['address'] | default('localhost') }}"
# Database Configuration (use inventory variables or these defaults) # Database Configuration (use inventory variables or these defaults)
default_mysql_root_password: "{{ mysql_root_password | default('secure_root_password_123') }}" default_mysql_root_password: "{{ mysql_root_password | default('secure_root_password_123') }}"

View File

@@ -49,14 +49,14 @@ define( 'WP_CACHE_KEY_SALT', '{{ domain_name | default('localhost') }}' );
{% endif %} {% endif %}
// ** Authentifizierungs-Schlüssel und Salts ** // // ** Authentifizierungs-Schlüssel und Salts ** //
define( 'AUTH_KEY', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}' ); define( 'AUTH_KEY', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}' );
define( 'SECURE_AUTH_KEY', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}2' ); define( 'SECURE_AUTH_KEY', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}2' );
define( 'LOGGED_IN_KEY', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}3' ); define( 'LOGGED_IN_KEY', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}3' );
define( 'NONCE_KEY', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}4' ); define( 'NONCE_KEY', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}4' );
define( 'AUTH_SALT', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}5' ); define( 'AUTH_SALT', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}5' );
define( 'SECURE_AUTH_SALT', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}6' ); define( 'SECURE_AUTH_SALT', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}6' );
define( 'LOGGED_IN_SALT', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}7' ); define( 'LOGGED_IN_SALT', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}7' );
define( 'NONCE_SALT', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}8' ); define( 'NONCE_SALT', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}8' );
// ** WordPress Tabellen-Präfix ** // // ** WordPress Tabellen-Präfix ** //
$table_prefix = 'wp_'; $table_prefix = 'wp_';
@@ -71,8 +71,8 @@ define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_HOME', 'https://{{ domain_name }}' ); define( 'WP_HOME', 'https://{{ domain_name }}' );
define( 'WP_SITEURL', 'https://{{ domain_name }}' ); define( 'WP_SITEURL', 'https://{{ domain_name }}' );
{% else %} {% else %}
define( 'WP_HOME', 'http://{{ domain_name }}{% if ansible_port is defined and ansible_port != 22 and ansible_port != 80 %}:{{ ansible_port }}{% endif %}' ); define( 'WP_HOME', 'http://{{ domain_name }}{% if ansible_facts["port"] is defined and ansible_facts["port"] != 22 and ansible_facts["port"] != 80 %}:{{ ansible_facts["port"] }}{% endif %}' );
define( 'WP_SITEURL', 'http://{{ domain_name }}{% if ansible_port is defined and ansible_port != 22 and ansible_port != 80 %}:{{ ansible_port }}{% endif %}' ); define( 'WP_SITEURL', 'http://{{ domain_name }}{% if ansible_facts["port"] is defined and ansible_facts["port"] != 22 and ansible_facts["port"] != 80 %}:{{ ansible_facts["port"] }}{% endif %}' );
{% endif %} {% endif %}
// ** Weitere Einstellungen ** // // ** Weitere Einstellungen ** //