ansible: Add missing default variables for common-node
[lttng-ci.git] / automation / ansible / roles / common-node / tasks / main.yml
1 ---
2 # Include variables and define needed variables.
3 - name: Include OS-specific variables.
4 ansible.builtin.include_vars: "{{ item }}"
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
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
29 # Setup/install tasks.
30 - ansible.builtin.include_tasks: setup-RedHat.yml
31 when: ansible_os_family in ['RedHat', 'Rocky']
32
33 - ansible.builtin.include_tasks: setup-Debian.yml
34 when: ansible_os_family == 'Debian'
35
36 - ansible.builtin.include_tasks: setup-Alpine.yml
37 when: ansible_os_family == 'Alpine'
38
39 - ansible.builtin.include_tasks: setup-Suse.yml
40 when: ansible_os_family == 'Suse'
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'
This page took 0.031914 seconds and 5 git commands to generate.