aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/sysctl/tasks/main.yml
blob: 3851bcc9ed3c82f209857f5506e546de6f685d4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
- name: Check IPv6 support
  ansible.builtin.command: >
    {{ sysctl_path }} -n net.ipv6.conf.all.disable_ipv6
  register: ipv6_disabled
  changed_when: false

- name: Setting sysctl values
  become: true
  vars:
    should_set: "{{ item.value != 'KOLLA_UNSET' }}"
  ansible.posix.sysctl:
    name: "{{ item.name }}"
    state: "{{ should_set | ternary('present', 'absent') }}"
    value: "{{ should_set | ternary(item.value, omit) }}"
    sysctl_set: "{{ should_set }}"
    sysctl_file: "{{ kolla_sysctl_conf_path }}"
  with_items: "{{ settings }}"
  when:
    - item.value != 'KOLLA_SKIP'
    - not ('ipv6' in item.name and ipv6_disabled.stdout | bool)