Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Commit eb946ef

Browse files
author
Povilas
committed
Renaming ansible variables discovered from systems: Facts to be placed in new namespace ansible_facts.*
Signed-off-by: Povilas <pga@tiatechnology.com>
1 parent b720fd9 commit eb946ef

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

tasks/2fa.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
apt:
55
name: 'libpam-google-authenticator'
66
state: present
7-
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
7+
when: ansible_facts.distribution == 'Debian' or ansible_facts.distribution == 'Ubuntu'
88

99
- name: Install google authenticator PAM module
1010
yum:
1111
name: 'google-authenticator'
1212
state: present
13-
when: ansible_os_family == 'RedHat' or ansible_os_family == 'Oracle Linux'
13+
when: ansible_facts.os_family == 'RedHat' or ansible_facts.os_family == 'Oracle Linux'
1414

1515
- name: Add google auth module to PAM
1616
pamd:
@@ -26,11 +26,11 @@
2626
control: 'substack'
2727
module_path: 'password-auth'
2828
state: absent
29-
when: ansible_distribution == 'RedHat' or ansible_distribution == 'Oracle Linux' or ansible_distribution == 'Amazon'
29+
when: ansible_facts.distribution == 'RedHat' or ansible_facts.distribution == 'Oracle Linux' or ansible_facts.distribution == 'Amazon'
3030

3131
- name: Remove password auth from PAM
3232
replace:
3333
dest: '/etc/pam.d/sshd'
3434
regexp: '^@include common-auth'
3535
replace: '#@include common-auth'
36-
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
36+
when: ansible_facts.distribution == 'Debian' or ansible_facts.distribution == 'Ubuntu'

templates/opensshd.conf.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ LogLevel {{ sshd_log_level }}
8787
UseLogin no
8888
{% endif %}
8989
{% if sshd_version is version('7.5', '<') %}
90-
UsePrivilegeSeparation {% if (ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6') or (ansible_os_family in ['Oracle Linux', 'RedHat'] and ansible_distribution_major_version <= '6') -%}{{ssh_ps53}}{% else %}{{ssh_ps59}}{% endif %}
90+
UsePrivilegeSeparation {% if (ansible_facts.distribution == 'Debian' and ansible_facts.distribution_major_version <= '6') or (ansible_facts.os_family in ['Oracle Linux', 'RedHat'] and ansible_facts.distribution_major_version <= '6') -%}{{ssh_ps53}}{% else %}{{ssh_ps59}}{% endif %}
9191
{% endif %}
9292

9393
LoginGraceTime 30s
@@ -217,13 +217,13 @@ UseDNS {{ 'yes' if (ssh_use_dns|bool) else 'no' }}
217217

218218
PrintMotd {{ 'yes' if (ssh_print_motd|bool) else 'no' }}
219219

220-
{% if ansible_os_family != 'FreeBSD' %}
220+
{% if ansible_facts.os_family != 'FreeBSD' %}
221221
PrintLastLog {{ 'yes' if (ssh_print_last_log|bool) else 'no' }}
222222
{% endif %}
223223

224224
Banner {{ '/etc/ssh/banner.txt' if (ssh_banner|bool) else 'none' }}
225225

226-
{% if ansible_os_family == 'Debian' -%}
226+
{% if ansible_facts.os_family == 'Debian' -%}
227227
DebianBanner {{ 'yes' if (ssh_print_debian_banner|bool) else 'no' }}
228228
{% endif %}
229229

tests/default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- file: path="/var/run/sshd" state=directory
1818
- name: create ssh host keys
1919
command: "ssh-keygen -A"
20-
when: not ((ansible_os_family in ['Oracle Linux', 'RedHat']) and ansible_distribution_major_version < '7') or ansible_distribution == "Fedora"
20+
when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7') or ansible_facts.distribution == "Fedora"
2121

2222
roles:
2323
- ansible-ssh-hardening

tests/default_custom.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- file: path="/var/run/sshd" state=directory
1818
- name: create ssh host keys
1919
command: "ssh-keygen -A"
20-
when: not ((ansible_os_family in ['Oracle Linux', 'RedHat']) and ansible_distribution_major_version < '7') or ansible_distribution == "Fedora"
20+
when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7') or ansible_facts.distribution == "Fedora"
2121

2222
roles:
2323
- ansible-ssh-hardening

0 commit comments

Comments
 (0)