Skip to content

Commit

Permalink
Fix Ansible compatibility with sysctl module
Browse files Browse the repository at this point in the history
In older versions of Ansible, such as the version included with RHEL7,
the sysctl module was part of the ansible.builtin collection. But in
most recent versions it belongs to the ansible.posix collection. Since
explicity collection is not mandadotory, we can leave it implicit for
this particular case so each Ansible version can manage it properly.
  • Loading branch information
marcusburghardt committed Feb 2, 2024
1 parent 38094d5 commit 6319439
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,15 @@
register: ipv6_status

- name: Check sysctl value of net.ipv6.conf.all.disable_ipv6
{{% if product == "rhel7" %}}
ansible.builtin.sysctl:
{{% else %}}
ansible.posix.sysctl:
{{%endif %}}
sysctl:
name: net.ipv6.conf.all.disable_ipv6
state: present
value: "1"
check_mode: true
register: sysctl_ipv6_all

- name: Check sysctl value of net.ipv6.conf.default.disable_ipv6
{{% if product == "rhel7" %}}
ansible.builtin.sysctl:
{{% else %}}
ansible.posix.sysctl:
{{%endif %}}
sysctl:
name: net.ipv6.conf.default.disable_ipv6
state: present
value: "1"
Expand Down

0 comments on commit 6319439

Please sign in to comment.