Skip to content

Commit

Permalink
Use variables from ansible_facts in _common role
Browse files Browse the repository at this point in the history
to allow ANSIBLE_INJECT_FACT_VARS to become false

Signed-off-by: Marcus Klein <[email protected]>
  • Loading branch information
kleini committed Nov 21, 2024
1 parent 6460d74 commit 00088b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions roles/_common/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ argument_specs:
options:
_common_dependencies:
description: "Package dependencies to install"
default: "{% if (ansible_pkg_mgr == 'apt') %}\
{{ ('python-apt' if ansible_python_version is version('3', '<') else 'python3-apt') }}
default: "{% if (ansible_facts['pkg_mgr'] == 'apt') %}\
{{ ('python-apt' if ansible_facts['python_version'] is version('3', '<') else 'python3-apt') }}
{% else %}\
{% endif %}"
_common_web_listen_address:
Expand Down
2 changes: 1 addition & 1 deletion roles/_common/tasks/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

- name: Assert usage of systemd as an init system
ansible.builtin.assert:
that: ansible_service_mgr == 'systemd'
that: ansible_facts['service_mgr'] == 'systemd'
msg: "This module only works with systemd"
tags:
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/_common/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ _common_selinux_port: ""
_common_service_name: "{{ __common_parent_role_short_name }}"
_common_system_user: ""
_common_system_group: ""
_common_dependencies: "{% if (ansible_pkg_mgr == 'apt') %}\
{{ ('python-apt' if ansible_python_version is version('3', '<') else 'python3-apt') }}
_common_dependencies: "{% if (ansible_facts['pkg_mgr'] == 'apt') %}\
{{ ('python-apt' if ansible_facts['python_version'] is version('3', '<') else 'python3-apt') }}
{% else %}\
{% endif %}"
_common_binary_unarchive_opts: ""
Expand Down

0 comments on commit 00088b1

Please sign in to comment.