Add bootstrao and dependenciy script for debian 13 (trixie)'.
This commit is contained in:
72
roles/ansible_dependencies-trixie/tasks/main.yml.02
Normal file
72
roles/ansible_dependencies-trixie/tasks/main.yml.02
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
|
||||
# --- Nur fürs Bootstrap, damit Python für Ansible verfügbar ist ---
|
||||
- name: Ensure python3 and python3-apt are present (bootstrap)
|
||||
ansible.builtin.raw: |
|
||||
test -x /usr/bin/python3 || (apt-get -y update && apt-get install -y python3)
|
||||
test -x /usr/bin/python3 && (apt-get -y update && apt-get install -y python3-apt)
|
||||
changed_when: false
|
||||
|
||||
|
||||
# Ab dem Zeitpunkt in dem Python auf dem Zielsystem vorhanden ist,
|
||||
# kann Ansible wieder normale Module (wie apt, file, service, copy, usw.) benutzen.
|
||||
#
|
||||
# Aber:
|
||||
# Da gather_facts: false gesetzt war, hat Ansible bis hierher keine Systeminformationen (Facts) wie:
|
||||
#
|
||||
# ansible_distribution
|
||||
#
|
||||
# ansible_fqdn
|
||||
#
|
||||
# ansible_memtotal_mb
|
||||
#
|
||||
# ansible_interfaces
|
||||
#
|
||||
# etc.
|
||||
# eingesammelt.
|
||||
#
|
||||
# Rufe das 'setup'-Modul manuell auf mit:
|
||||
#
|
||||
# - name: Enable facts now that Python exists
|
||||
# ansible.builtin.setup:
|
||||
#
|
||||
# Damit holt Ansible nachträglich die Facts, jetzt, wo Python verfügbar ist.
|
||||
#
|
||||
- name: Enable facts now that Python exists
|
||||
ansible.builtin.setup:
|
||||
|
||||
# --- Ab hier normale Module verwenden ---
|
||||
- name: Update APT cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"
|
||||
tags: [ansible-dependencies]
|
||||
|
||||
- name: Ensure aptitude is present
|
||||
ansible.builtin.apt:
|
||||
name: aptitude
|
||||
state: present
|
||||
tags: [ansible-dependencies]
|
||||
|
||||
- name: dpkg --configure -a
|
||||
ansible.builtin.command: dpkg --configure -a
|
||||
register: dpkg_out
|
||||
# "changed" nur, wenn es wirklich etwas ausgibt/konfiguriert
|
||||
changed_when: dpkg_out.stdout is defined and dpkg_out.stdout | length > 0
|
||||
when: apt_dpkg_configure | bool
|
||||
tags: [ansible-dependencies]
|
||||
|
||||
- name: apt upgrade
|
||||
ansible.builtin.apt:
|
||||
upgrade: "{{ apt_upgrade_type }}"
|
||||
update_cache: true
|
||||
dpkg_options: "{{ apt_upgrade_dpkg_options | join(',') }}"
|
||||
when: apt_upgrade | bool
|
||||
tags: [ansible-dependencies]
|
||||
|
||||
- name: apt install ansible dependencies
|
||||
ansible.builtin.apt:
|
||||
name: "{{ apt_ansible_dependencies_trixie }}"
|
||||
state: "{{ apt_install_state }}"
|
||||
tags: [ansible-dependencies]
|
||||
|
||||
Reference in New Issue
Block a user