ansible-core deprecates injecting facts as top-level variables (removal is scheduled for 2.24, see #364). Three roles still read a bare fact: system_baseline (reboot check, ansible_os_family), docker (APT source line, ansible_distribution_release) and gitea_runner (re-registration backup name, ansible_date_time). With inject_facts_as_vars set to false the system_baseline reboot check failed with "'ansible_os_family' is undefined". They now read ansible_facts[...]; the argument specs and READMEs that name the facts follow. run_molecule_in_ci_image.sh exports ANSIBLE_INJECT_FACT_VARS=False, so a role that reads an injected fact fails its scenario, and a script test keeps the export in place. Refs #364 Assisted-by: Claude Code:claude-sonnet-5-5
59 lines
1.6 KiB
YAML
59 lines
1.6 KiB
YAML
---
|
|
- name: Install prerequisite packages
|
|
become: true
|
|
ansible.builtin.apt:
|
|
name:
|
|
- ca-certificates
|
|
- curl
|
|
state: present
|
|
update_cache: true
|
|
tags: [docker, install]
|
|
|
|
- name: Ensure APT keyrings directory exists
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: /etc/apt/keyrings
|
|
state: directory
|
|
mode: "0755"
|
|
tags: [docker, install]
|
|
|
|
- name: Install Docker APT GPG key
|
|
become: true
|
|
ansible.builtin.get_url:
|
|
url: "{{ docker_gpg_url }}"
|
|
dest: "{{ docker_keyring_path }}"
|
|
mode: "0644"
|
|
tags: [docker, install]
|
|
|
|
- name: Install Docker APT source list
|
|
become: true
|
|
ansible.builtin.copy:
|
|
dest: "{{ docker_apt_list_path }}"
|
|
content: |
|
|
deb [arch={{ __docker_apt_arch }} signed-by={{ docker_keyring_path }}] {{ docker_repo_base_url }} {{ ansible_facts['distribution_release'] }} stable
|
|
mode: "0644"
|
|
register: __docker_apt_source
|
|
tags: [docker, install]
|
|
|
|
- name: Install Docker Engine packages
|
|
become: true
|
|
ansible.builtin.apt:
|
|
name: "{{ docker_packages }}"
|
|
state: present
|
|
update_cache: true
|
|
register: __docker_packages
|
|
notify: Restart docker
|
|
# Under --check a new source line is only simulated, so apt would find no Docker package.
|
|
when: not ansible_check_mode or __docker_apt_source is not changed
|
|
tags: [docker, install]
|
|
|
|
- name: Enable and start Docker service
|
|
become: true
|
|
ansible.builtin.systemd:
|
|
name: "{{ docker_service }}"
|
|
enabled: true
|
|
state: started
|
|
# Under --check on a host without the packages there is no unit to start yet.
|
|
when: not ansible_check_mode or (__docker_apt_source is not changed and __docker_packages is not changed)
|
|
tags: [docker, install]
|