Role - tripleo-kernel

Role Documentation

Welcome to the “tripleo_kernel” role documentation.

Role Defaults

This section highlights all of the defaults and variables set within the “tripleo_kernel” role.

# All variables intended for modification should be placed in this file.
tripleo_kernel_extra_modules: {}
tripleo_kernel_extra_packages: {}
tripleo_kernel_args: ''
tripleo_kernel_reboot_timeout: 3600
tripleo_kernel_post_reboot_delay: 60
tripleo_kernel_defer_reboot: false
tripleo_kernel_hugepages: {}
tripleo_kernel_hugepages_remove: false
tripleo_kernel_sysctl_extra_settings:
  net.ipv6.conf.default.disable_ipv6:
    value: 0
  net.ipv4.ip_local_reserved_ports:
    value: 35357,49000-49001
  net.ipv6.conf.all.disable_ipv6:
    value: 0
  net.ipv6.conf.lo.disable_ipv6:
    value: 0
  net.ipv4.ip_forward:
    value: 1
  net.ipv4.conf.all.rp_filter:
    value: 1
  net.ipv6.conf.all.forwarding:
    value: 0
  net.ipv4.ip_nonlocal_bind:
    value: 1
  net.ipv6.ip_nonlocal_bind:
    value: 1
  kernel.pid_max:
    value: 1048576
  net.ipv4.neigh.default.gc_thresh1:
    value: 1024
  net.ipv4.neigh.default.gc_thresh2:
    value: 2048
  net.ipv4.neigh.default.gc_thresh3:
    value: 4096
  net.bridge.bridge-nf-call-arptables:
    value: 1
  net.bridge.bridge-nf-call-iptables:
    value: 1
  net.bridge.bridge-nf-call-ip6tables:
    value: 1
  fs.inotify.max_user_instances:
    value: 1024

Role Variables: main.yml

tripleo_kernel_modules:
  br_netfilter: {}
  nf_conntrack: {}

tripleo_kernel_sysctl_settings:
  net.ipv4.tcp_keepalive_intvl:
    value: 1
  net.ipv4.tcp_keepalive_probes:
    value: 5
  net.ipv4.tcp_keepalive_time:
    value: 5
  net.ipv4.conf.default.send_redirects:
    value: 0
  net.ipv4.conf.all.send_redirects:
    value: 0
  net.ipv4.conf.all.arp_accept:
    value: 1
  net.ipv4.conf.default.accept_redirects:
    value: 0
  net.ipv4.conf.default.secure_redirects:
    value: 0
  net.ipv4.conf.all.secure_redirects:
    value: 0
  net.ipv4.conf.default.log_martians:
    value: 1
  net.ipv4.conf.all.log_martians:
    value: 1
  net.nf_conntrack_max:
    value: 500000
  net.netfilter.nf_conntrack_max:
    value: 500000
  net.ipv6.conf.all.accept_ra:
    value: 0
  net.ipv6.conf.default.accept_ra:
    value: 0
  net.ipv6.conf.all.autoconf:
    value: 0
  net.ipv6.conf.default.autoconf:
    value: 0
  net.ipv6.conf.default.accept_redirects:
    value: 0
  net.ipv6.conf.all.accept_redirects:
    value: 0
  net.ipv4.conf.all.arp_notify:
    value: 1
  net.ipv6.conf.all.ndisc_notify:
    value: 1
  net.core.netdev_max_backlog:
    value: 10000
  kernel.dmesg_restrict:
    value: 1
  fs.suid_dumpable:
    value: 0

Molecule Scenarios

Molecule is being used to test the “tripleo_kernel” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.

Scenario: kernelargs-hugepages-modify-idempotency-nochange

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-modify-idempotency-nochange playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: test_vars.yml
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline_original }}'
        stdout_lines: ['{{ _mocked_cmdline_original }}']
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline_updated }}'
        stdout_lines: ['{{ _mocked_cmdline_updated }}']

Scenario: kernelargs-hugepages-modify-idempotency-change

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-modify-idempotency-change playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: test_vars.yml
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline_original }}'
        stdout_lines: ['{{ _mocked_cmdline_original }}']
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_hugepages:
        '2048':
          count: '10'
        4096:
          count: '12'
          default: true
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline_updated }}'
        stdout_lines: ['{{ _mocked_cmdline_updated }}']

Scenario: kernelargs-hugepages-modify-remove

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-modify-remove playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/test_vars.yml"
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']

Scenario: extra

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example extra playbook
- name: Converge
  hosts: all
  pre_tasks:
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  roles:
  - role: tripleo_kernel
    tripleo_kernel_extra_modules:
      dummy: {}
    tripleo_kernel_extra_packages:
      kmod-kvdo: {}
    tripleo_kernel_sysctl_extra_settings:
      kernel.ftrace_dump_on_oops:
        value: 1

Scenario: kernelargs-hugepages-nochange-remove

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-nochange-remove playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/test_vars.yml"
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']

Scenario: kernelargs

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/test_vars.yml"
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']

Scenario: kernelargs-hugepages-modify-integer

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-modify-integer playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/test_vars.yml"
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']

Scenario: kernelargs-hugepages-adding

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-adding playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/test_vars.yml"
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']

Scenario: kernelargs-hugepages-modify

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-modify playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/test_vars.yml"
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']

Scenario: kernelargs-hugepages-nochange

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-nochange playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/test_vars.yml"
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']

Scenario: default

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example default playbook
- name: Converge
  hosts: all
  pre_tasks:
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  roles:
  - role: tripleo_kernel

Scenario: kernelargs-hugepages-modify-existing-kernelargs

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-hugepages-modify-existing-kernelargs playbook
- name: Converge
  hosts: all
  become: true
  pre_tasks:
  - name: Importing test_vars
    include_vars: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/test_vars.yml"
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true
      cmdline:
        stdout: '{{ _mocked_cmdline }}'
        stdout_lines: ['{{ _mocked_cmdline }}']

Scenario: kernelargs-update

Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_connection: local
        ansible_host: localhost
Example kernelargs-update playbook
- name: Converge
  hosts: all
  become: true
  vars:
    tripleo_kernel_args: test=1
  pre_tasks:
  - name: Backing up /etc/default/grub
    import_tasks: ../../resources/molecule/backup_grub.yml
  tasks:
  - name: create kernelargs entry with the older name
    lineinfile:
      dest: /etc/default/grub
      regexp: ^TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS.*
      insertafter: ^GRUB_CMDLINE_LINUX.*
      line: TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS=" {{ tripleo_kernel_args }} "
  - name: create append entry with older name
    lineinfile:
      dest: /etc/default/grub
      line: GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX:+$GRUB_CMDLINE_LINUX }${TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS}"
      insertafter: ^TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS.*
  - include_role:
      name: tripleo_kernel
      tasks_from: kernelargs.yml
    vars:
      tripleo_kernel_defer_reboot: true