mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-08 02:16:04 +00:00
Refactor: Migrate deprecated Ansible facts to ansible_facts[] syntax
Why: - Ansible 2.20+ deprecates INJECT_FACTS_AS_VARS and direct usage of top-level ansible_* facts. - This change updates all affected roles and vars files to the new supported syntax. - Ensures compatibility with upcoming Ansible 2.24 removal of implicit fact injection. Conversation reference: https://chatgpt.com/share/692f639b-1380-800f-9f18-732f7108e9e2
This commit is contained in:
@@ -28,5 +28,5 @@ transfer_method = smart
|
|||||||
connect_timeout = 30
|
connect_timeout = 30
|
||||||
command_timeout = 60
|
command_timeout = 60
|
||||||
|
|
||||||
[callback_default]
|
#[callback_default]
|
||||||
result_format = yaml
|
#result_format = yaml
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Host resources
|
# Host resources
|
||||||
RESOURCE_HOST_CPUS: "{{ ansible_processor_vcpus | int }}"
|
RESOURCE_HOST_CPUS: "{{ ansible_facts['processor_vcpus'] | int }}"
|
||||||
RESOURCE_HOST_MEM: "{{ (ansible_memtotal_mb | int) // 1024 }}"
|
RESOURCE_HOST_MEM: "{{ (ansible_facts['memtotal_mb'] | int) // 1024 }}"
|
||||||
|
|
||||||
# Reserve for OS
|
# Reserve for OS
|
||||||
RESOURCE_HOST_RESERVE_CPU: 2
|
RESOURCE_HOST_RESERVE_CPU: 2
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
- name: "Execute {{ SOFTWARE_NAME }} Play"
|
- name: "Execute Infinito.Nexus Play"
|
||||||
hosts: all
|
hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Load 'constructor' tasks"
|
- name: "Load 'constructor' tasks"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
- name: Update package cache (Debian/Ubuntu)
|
- name: Update package cache (Debian/Ubuntu)
|
||||||
apt:
|
apt:
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_facts['os_family'] == "Debian"
|
||||||
|
|
||||||
- name: Install Chromium browser
|
- name: Install Chromium browser
|
||||||
package:
|
package:
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
application_id: "desk-chromium"
|
application_id: "desk-chromium"
|
||||||
|
|
||||||
chromium_package: "{{ 'chromium-browser' if ansible_os_family == 'Debian' else 'chromium' }}"
|
chromium_package: "{{ 'chromium-browser' if ansible_facts['os_family'] == 'Debian' else 'chromium' }}"
|
||||||
@@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
- name: Ensure autostart directory exists
|
- name: Ensure autostart directory exists
|
||||||
file:
|
file:
|
||||||
path: "{{ ansible_env.HOME }}/.config/autostart"
|
path: "{{ ansible_facts['env']['HOME'] }}/.config/autostart"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
- name: Add CopyQ to user autostart
|
- name: Add CopyQ to user autostart
|
||||||
copy:
|
copy:
|
||||||
dest: "{{ ansible_env.HOME }}/.config/autostart/copyq.desktop"
|
dest: "{{ ansible_facts['env']['HOME'] }}/.config/autostart/copyq.desktop"
|
||||||
content: |
|
content: |
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
- name: Ensure systemd user unit directory exists
|
- name: Ensure systemd user unit directory exists
|
||||||
file:
|
file:
|
||||||
path: "{{ ansible_env.HOME }}/.config/systemd/user"
|
path: "{{ ansible_facts['env']['HOME'] }}/.config/systemd/user"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
- name: Install CopyQ user service unit
|
- name: Install CopyQ user service unit
|
||||||
copy:
|
copy:
|
||||||
dest: "{{ ansible_env.HOME }}/.config/systemd/user/copyq.service"
|
dest: "{{ ansible_facts['env']['HOME'] }}/.config/systemd/user/copyq.service"
|
||||||
content: |
|
content: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=CopyQ Clipboard Manager Server
|
Description=CopyQ Clipboard Manager Server
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ POSTGRES_VECTOR_ENABLED: True # Required by discourse, propably
|
|||||||
POSTGRES_RETRIES: 5
|
POSTGRES_RETRIES: 5
|
||||||
|
|
||||||
## Performance
|
## Performance
|
||||||
POSTGRES_TOTAL_RAM_MB: "{{ ansible_memtotal_mb | int }}"
|
POSTGRES_TOTAL_RAM_MB: "{{ ansible_facts['memtotal_mb'] | int }}"
|
||||||
POSTGRES_VCPUS: "{{ ansible_processor_vcpus | int }}"
|
POSTGRES_VCPUS: "{{ ansible_facts['processor_vcpus'] | int }}"
|
||||||
POSTGRES_MAX_CONNECTIONS: "{{ [ ((POSTGRES_VCPUS | int) * 30 + 50), 400 ] | min }}"
|
POSTGRES_MAX_CONNECTIONS: "{{ [ ((POSTGRES_VCPUS | int) * 30 + 50), 400 ] | min }}"
|
||||||
POSTGRES_SUPERUSER_RESERVED_CONNECTIONS: 3
|
POSTGRES_SUPERUSER_RESERVED_CONNECTIONS: 3
|
||||||
POSTGRES_SHARED_BUFFERS_MB: "{{ ((POSTGRES_TOTAL_RAM_MB | int) * 25) // 100 }}"
|
POSTGRES_SHARED_BUFFERS_MB: "{{ ((POSTGRES_TOTAL_RAM_MB | int) * 25) // 100 }}"
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
community.general.pacman:
|
community.general.pacman:
|
||||||
name: wireguard-tools
|
name: wireguard-tools
|
||||||
state: present
|
state: present
|
||||||
when: ansible_os_family == "Archlinux"
|
when: ansible_facts['os_family'] == "Archlinux"
|
||||||
|
|
||||||
- name: install wireguard for Ubuntu
|
- name: install wireguard for Ubuntu
|
||||||
apt:
|
apt:
|
||||||
name: wireguard
|
name: wireguard
|
||||||
state: present
|
state: present
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_facts['os_family'] == "Debian"
|
||||||
|
|
||||||
- name: create wireguard-ip.conf
|
- name: create wireguard-ip.conf
|
||||||
copy:
|
copy:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
swapfile_size: "{{ ansible_memtotal_mb | int }}M"
|
swapfile_size: "{{ ansible_facts['memtotal_mb'] | int }}M"
|
||||||
@@ -119,7 +119,7 @@ UseDNS no
|
|||||||
#Banner none
|
#Banner none
|
||||||
|
|
||||||
# override default of no subsystems
|
# override default of no subsystems
|
||||||
{% if ansible_os_family == "Archlinux" %}
|
{% if ansible_facts['os_family'] == "Archlinux" %}
|
||||||
Subsystem sftp /usr/lib/ssh/sftp-server
|
Subsystem sftp /usr/lib/ssh/sftp-server
|
||||||
{% else%}
|
{% else%}
|
||||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
include_role:
|
include_role:
|
||||||
name: update-pacman
|
name: update-pacman
|
||||||
when:
|
when:
|
||||||
- ansible_distribution == 'Archlinux'
|
- ansible_facts['distribution'] == 'Archlinux'
|
||||||
- run_once_update_pacman is not defined
|
- run_once_update_pacman is not defined
|
||||||
|
|
||||||
- name: "Update with apt"
|
- name: "Update with apt"
|
||||||
include_role:
|
include_role:
|
||||||
name: update-apt
|
name: update-apt
|
||||||
when:
|
when:
|
||||||
- ansible_distribution == "Debian"
|
- ansible_facts['distribution'] == "Debian"
|
||||||
- run_once_update_apt is not defined
|
- run_once_update_apt is not defined
|
||||||
|
|
||||||
- include_tasks: utils/once_finalize.yml
|
- include_tasks: utils/once_finalize.yml
|
||||||
@@ -134,9 +134,9 @@ legacy_login_mask:
|
|||||||
|
|
||||||
performance:
|
performance:
|
||||||
php:
|
php:
|
||||||
memory_limit: "{{ ((ansible_memtotal_mb | int) / 30)|int }}M" # Dynamic set memory limit
|
memory_limit: "{{ ((ansible_facts['memtotal_mb'] | int) / 30)|int }}M" # Dynamic set memory limit
|
||||||
upload_limit: "5G" # Set upload limit to 5GB for big media files
|
upload_limit: "5G" # Set upload limit to 5GB for big media files
|
||||||
opcache_memory_consumption: "{{ ((ansible_memtotal_mb | int) / 30)|int }}M" # Dynamic set memory consumption
|
opcache_memory_consumption: "{{ ((ansible_facts['memtotal_mb'] | int) / 30)|int }}M" # Dynamic set memory consumption
|
||||||
|
|
||||||
plugins_enabled: true # Implemented for speeding up testing and debugging process. For productive environments keep it true and steer the apps via the plugins config
|
plugins_enabled: true # Implemented for speeding up testing and debugging process. For productive environments keep it true and steer the apps via the plugins config
|
||||||
oidc:
|
oidc:
|
||||||
|
|||||||
Reference in New Issue
Block a user