Commit | Line | Data |
---|---|---|
858e2403 MJ |
1 | --- |
2 | # Include variables and define needed variables. | |
3 | - name: Include OS-specific variables. | |
4302b783 | 4 | ansible.builtin.include_vars: "{{ item }}" |
858e2403 MJ |
5 | with_first_found: |
6 | - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml" | |
7 | - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" | |
8 | - "{{ ansible_distribution }}.yml" | |
9 | - "{{ ansible_os_family }}.yml" | |
10 | ||
c426b44b KS |
11 | - when: ansible_virtualization_role == "host" or (ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm") |
12 | block: | |
13 | - name: 'Set core pattern for reboot' | |
14 | ansible.builtin.copy: | |
15 | dest: '/etc/sysctl.d/10-core_pattern.conf' | |
16 | owner: 'root' | |
17 | group: 'root' | |
18 | mode: '0644' | |
19 | content: "kernel.core_pattern /tmp/core.%p\n" | |
20 | - name: 'Check current core pattern' | |
21 | ansible.builtin.command: | |
22 | argv: ['cat', '/proc/sys/kernel/core_pattern'] | |
23 | register: current_core_pattern | |
24 | - name: 'Update current core pattern' | |
25 | when: current_core_pattern.stdout|trim != common_node_core_pattern | |
26 | ansible.builtin.command: | |
27 | argv: ['sysctl', '-w', "kernel.core_pattern='{{common_node_core_pattern}}'"] | |
28 | ||
858e2403 | 29 | # Setup/install tasks. |
4302b783 | 30 | - ansible.builtin.include_tasks: setup-RedHat.yml |
858e2403 MJ |
31 | when: ansible_os_family in ['RedHat', 'Rocky'] |
32 | ||
4302b783 | 33 | - ansible.builtin.include_tasks: setup-Debian.yml |
858e2403 MJ |
34 | when: ansible_os_family == 'Debian' |
35 | ||
4302b783 | 36 | - ansible.builtin.include_tasks: setup-Alpine.yml |
858e2403 MJ |
37 | when: ansible_os_family == 'Alpine' |
38 | ||
4302b783 | 39 | - ansible.builtin.include_tasks: setup-Suse.yml |
858e2403 | 40 | when: ansible_os_family == 'Suse' |
fe47937c KS |
41 | |
42 | - when: common_node_rootfs_readonly_reboot|default(false) | |
43 | block: | |
44 | - name: Install readonly reboot script | |
45 | ansible.builtin.copy: | |
46 | dest: '/usr/sbin/readonly_root_reboot.sh' | |
47 | src: 'readonly_root_reboot.sh' | |
48 | owner: 'root' | |
49 | group: 'root' | |
50 | mode: '0750' | |
51 | - name: Add cronjob | |
52 | ansible.builtin.cron: | |
53 | name: 'readonly_root_reboot' | |
54 | job: '/usr/sbin/readonly_root_reboot.sh' | |
55 | cron_file: 'readonly_root_reboot' | |
56 | minute: '*/10' | |
57 | user: 'root' |