Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README-ostree.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Usage:
.ostree/get_ostree_data.sh packages runtime DISTRO-VERSION FORMAT
```

`DISTRO-VERSION` is in the format that Ansible uses for `ansible_distribution`
and `ansible_distribution_version` - for example, `Fedora-38`, `CentOS-8`,
`DISTRO-VERSION` is in the format that Ansible uses for `ansible_facts['distribution']`
and `ansible_facts['distribution_version']` - for example, `Fedora-38`, `CentOS-8`,
`RedHat-9.4`

`FORMAT` is one of `toml`, `json`, `yaml`, `raw`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ To configure the private key of the logging system, `private_key_src` and/or `pr

#### logging_domain

The default DNS domain used to accept remote incoming logs from remote hosts. Default to "{{ ansible_domain if ansible_domain else ansible_hostname }}"
The default DNS domain used to accept remote incoming logs from remote hosts. Default to "{{ ansible_facts['domain'] if ansible_facts['domain'] else ansible_facts['hostname'] }}"

### Server performance optimization options

Expand Down
19 changes: 14 additions & 5 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ logging_pki_files: []
# logging_domain
#
# The default DNS domain used to accept remote incoming logs from remote hosts.
logging_domain: '{{ ansible_domain if ansible_domain else ansible_hostname }}'
logging_domain: '{{ ansible_facts["domain"] if ansible_facts["domain"] else ansible_facts["hostname"] }}'

# logging_elasticsearch_password
#
Expand Down Expand Up @@ -125,17 +125,26 @@ logging_custom_templates: []

# ansible_facts required by the role
__logging_required_facts:
- default_ipv4 # requires the iproute package for the ip command
- distribution
- distribution_major_version
- distribution_version
- domain
- fqdn
- hostname
- os_family
- default_ipv4 # requires the iproute package for the ip command
- pkg_mgr

__logging_no_subsets_facts:
- domain
- fqdn
- hostname

# the subsets of ansible_facts that need to be gathered in case any of the
# facts in required_facts is missing; see the documentation of
# the 'gather_subset' parameter of the 'setup' module
__logging_required_facts_subsets: "{{ ['!all', '!min'] +
__logging_required_facts }}"
__logging_required_facts | difference(__logging_no_subsets_facts) }}"

# BEGIN - DO NOT EDIT THIS BLOCK - rh distros variables
# Ansible distribution identifiers that the role treats like RHEL
Expand All @@ -149,8 +158,8 @@ __logging_rh_distros:
__logging_rh_distros_fedora: "{{ __logging_rh_distros + ['Fedora'] }}"

# Use this in conditionals to check if distro is Red Hat or clone
__logging_is_rh_distro: "{{ ansible_distribution in __logging_rh_distros }}"
__logging_is_rh_distro: "{{ ansible_facts['distribution'] in __logging_rh_distros }}"

# Use this in conditionals to check if distro is Red Hat or clone, or Fedora
__logging_is_rh_distro_fedora: "{{ ansible_distribution in __logging_rh_distros_fedora }}"
__logging_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __logging_rh_distros_fedora }}"
# END - DO NOT EDIT THIS BLOCK - rh distros variables
2 changes: 1 addition & 1 deletion roles/rsyslog/tasks/main_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- name: Reset original confs - logging package is absent
# we can't do this with "package", dnf5 does not remove reverse
# dependencies (such as rsyslog-gnutls) any more
command: "{{ ansible_pkg_mgr }} remove -y {{ __rsyslog_only_packages | join(' ') }}"
command: "{{ ansible_facts['pkg_mgr'] }} remove -y {{ __rsyslog_only_packages | join(' ') }}"
# we know it's a change here, as we just rpm -V'ed it above
changed_when: true
register: __rsyslog_erased
Expand Down
4 changes: 2 additions & 2 deletions roles/rsyslog/templates/input_ovirt.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ if $syslogtag == "{{ __rsyslog_input.name }}" then {
set $!service = $syslogtag;
set $!message = $.ovirt!message;
set $!level = $.ovirt!level;
set $!hostname = '{{ ansible_fqdn }}';
set $!hostname = '{{ ansible_facts["fqdn"] }}';
set $!ovirt!cluster_name = '{{ __ovirt_vds_cluster_name }}';
set $!ipaddr4 = '{{ ansible_default_ipv4.address }}';
set $!ipaddr4 = '{{ ansible_facts["default_ipv4"]["address"] }}';
set $!ovirt!engine_fqdn = '{{ __ovirt_engine_fqdn }}';
set $.input_type = "ovirt";
set $!ovirt!class = $.ovirt!class;
Expand Down
4 changes: 2 additions & 2 deletions roles/rsyslog/templates/input_relp.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
input(name="{{ __rsyslog_input.name }}"
type="imrelp"
port="{{ __rsyslog_input.port | d(20514) | int }}"
{% if ansible_distribution in ['CentOS', 'RedHat'] and
ansible_distribution_major_version is version('7', '>') %}
{% if ansible_facts['distribution'] in ['CentOS', 'RedHat'] and
ansible_facts['distribution_major_version'] is version('7', '>') %}
maxDataSize="{{ __rsyslog_input.max_data_size | d(logging_max_message_size) | int }}"
{% endif %}
{% if __rsyslog_input.tls | default(true) %}
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_combination.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
input_log_path: "{{ __test_inputfiles_dir }}/*.log"
# Not supported on EL 7
endmsg_regex: "{{ omit
if ansible_distribution in ['CentOS', 'RedHat'] and
ansible_distribution_major_version is version('7', '==')
if ansible_facts['distribution'] in ['CentOS', 'RedHat'] and
ansible_facts['distribution_major_version'] is version('7', '==')
else 'xyz' }}"
- name: basic_input
type: basics
Expand Down
8 changes: 4 additions & 4 deletions tests/tests_include_vars_from_parent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
# create all variants like CentOS, CentOS_8.1, CentOS-8.1,
# CentOS-8, CentOS-8.1
# more formally:
# {{ ansible_distribution }}-{{ ansible_distribution_version }}
# {{ ansible_distribution }}-{{ ansible_distribution_major_version }}
# {{ ansible_distribution }}
# {{ ansible_os_family }}
# {{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}
# {{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}
# {{ ansible_facts['distribution'] }}
# {{ ansible_facts['os_family'] }}
# and the same for _ as separator.
varfiles: "{{ [facts['distribution']] | product(separators) |
map('join') | product(versions) | map('join') | list +
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_relp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@
register: __result
failed_when: __result.stdout != "1"
when:
- ansible_distribution in ['CentOS', 'RedHat']
- ansible_distribution_major_version is version('7', '>')
- ansible_facts['distribution'] in ['CentOS', 'RedHat']
- ansible_facts['distribution_major_version'] is version('7', '>')

- name: Check preserveFQDN is on
command: grep -c 'preserveFQDN="on"' {{ __test_relp_global }}
Expand Down
4 changes: 2 additions & 2 deletions tests/vars/rh_distros_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ __logging_rh_distros:
__logging_rh_distros_fedora: "{{ __logging_rh_distros + ['Fedora'] }}"

# Use this in conditionals to check if distro is Red Hat or clone
__logging_is_rh_distro: "{{ ansible_distribution in __logging_rh_distros }}"
__logging_is_rh_distro: "{{ ansible_facts['distribution'] in __logging_rh_distros }}"

# Use this in conditionals to check if distro is Red Hat or clone, or Fedora
__logging_is_rh_distro_fedora: "{{ ansible_distribution in __logging_rh_distros_fedora }}"
__logging_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __logging_rh_distros_fedora }}"
Loading