54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
---
|
|
- block:
|
|
- name: Ensure that the /etc/sysctl.d directory exists
|
|
file:
|
|
path: /etc/sysctl.d
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
|
|
tags: ['sysctl', 'kernel', 'sysctl_ipv6', 'ipv6']
|
|
|
|
- block:
|
|
- name: Set the custom sysctl values
|
|
sysctl:
|
|
name: '{{ item.name }}'
|
|
value: '{{ item.value }}'
|
|
sysctl_file: "{{ item.sysctlfile | default ('/etc/sysctl.d/90-custom-values.conf') }}"
|
|
reload: "{{ item.sysctl_reload | default(true) }}"
|
|
state: "{{ item.sysctlfile_state | default('present') }}"
|
|
loop: '{{ sysctl_custom_options }}'
|
|
|
|
tags: ['sysctl', 'kernel']
|
|
|
|
- block:
|
|
- name: Disable the in kernel ipv6 support
|
|
sysctl:
|
|
name: '{{ item }}'
|
|
value: 1
|
|
sysctl_file: '{{ ipv6_sysctl_file }}'
|
|
reload: true
|
|
state: present
|
|
loop:
|
|
- net.ipv6.conf.all.disable_ipv6
|
|
- net.ipv6.conf.default.disable_ipv6
|
|
- net.ipv6.conf.lo.disable_ipv6
|
|
- net.ipv6.conf.{{ ansible_default_ipv4.interface }}.disable_ipv6
|
|
when: disable_ipv6
|
|
|
|
- name: enable the in kernel ipv6 support
|
|
sysctl:
|
|
name: '{{ item }}'
|
|
value: 0
|
|
sysctl_file: '{{ ipv6_sysctl_file }}'
|
|
reload: true
|
|
state: present
|
|
loop:
|
|
- net.ipv6.conf.all.disable_ipv6
|
|
- net.ipv6.conf.default.disable_ipv6
|
|
- net.ipv6.conf.lo.disable_ipv6
|
|
- net.ipv6.conf.{{ ansible_default_ipv4.interface }}.disable_ipv6
|
|
when: not disable_ipv6
|
|
|
|
tags: ['sysctl', 'kernel', 'sysctl_ipv6', 'ipv6']
|