fix: Install package fact dependencies needs to be run as root

Signed-off-by: Jonathan Mabit <jonathan.mabit@dametis.com>
This commit is contained in:
Jonathan Mabit 2023-04-27 21:44:50 +02:00 committed by JonathanMbt
parent 7aeb2ad55f
commit 7047669da7
6 changed files with 9 additions and 3 deletions

View file

@ -5,6 +5,7 @@
msg: "This module only works with systemd" msg: "This module only works with systemd"
- name: Install package fact dependencies - name: Install package fact dependencies
become: true
ansible.builtin.package: ansible.builtin.package:
name: "{{ _pkg_fact_req }}" name: "{{ _pkg_fact_req }}"
state: present state: present

View file

@ -5,6 +5,7 @@
msg: "This role only works with systemd" msg: "This role only works with systemd"
- name: Install package fact dependencies - name: Install package fact dependencies
become: true
ansible.builtin.package: ansible.builtin.package:
name: "{{ _pkg_fact_req }}" name: "{{ _pkg_fact_req }}"
state: present state: present

View file

@ -5,6 +5,7 @@
msg: "This role only works with systemd" msg: "This role only works with systemd"
- name: Install package fact dependencies - name: Install package fact dependencies
become: true
ansible.builtin.package: ansible.builtin.package:
name: "{{ _pkg_fact_req }}" name: "{{ _pkg_fact_req }}"
state: present state: present

View file

@ -5,15 +5,16 @@
msg: "This role only works with systemd" msg: "This role only works with systemd"
- name: Install package fact dependencies - name: Install package fact dependencies
become: true
ansible.builtin.package: ansible.builtin.package:
name: "{{ _pkg_fact_req }}" name: "{{ _pkg_fact_req }}"
state: present state: present
when: (_pkg_fact_req) when: (_pkg_fact_req)
vars: vars:
_pkg_fact_req: "{% if (ansible_pkg_mgr == 'apt') %}\ _pkg_fact_req: "{% if (ansible_pkg_mgr == 'apt') %}\
{{ ('python-apt' if ansible_python_version is version('3', '<') else 'python3-apt') }} {{ ('python-apt' if ansible_python_version is version('3', '<') else 'python3-apt') }}
{% else %}\ {% else %}\
{% endif %}" {% endif %}"
- name: Gather package facts - name: Gather package facts
ansible.builtin.package_facts: ansible.builtin.package_facts:

View file

@ -5,6 +5,7 @@
msg: "This module only works with systemd" msg: "This module only works with systemd"
- name: Install package fact dependencies - name: Install package fact dependencies
become: true
ansible.builtin.package: ansible.builtin.package:
name: "{{ _pkg_fact_req }}" name: "{{ _pkg_fact_req }}"
state: present state: present

View file

@ -5,6 +5,7 @@
msg: "This role only works with systemd" msg: "This role only works with systemd"
- name: Install package fact dependencies - name: Install package fact dependencies
become: true
ansible.builtin.package: ansible.builtin.package:
name: "{{ _pkg_fact_req }}" name: "{{ _pkg_fact_req }}"
state: present state: present