Align license headers with REUSE guidelines
[kuberef.git] / playbooks / roles / pre-install / tasks / main.yml
1 ---
2
3 # SPDX-FileCopyrightText: 2020 Samsung Electronics
4 #
5 # SPDX-License-Identifier: Apache-2.0
6
7 - name: Ensure Python3 is installed for CentOS (Equinix Metal)
8   raw: yum install -y python3
9   ignore_errors: true
10   failed_when: false
11   when: lookup('env', 'VENDOR') == 'equinix-metal'
12
13 - name: Gather facts
14   setup:
15
16 - name: Load distro variables
17   include_vars:
18     file: "{{ ansible_os_family }}.yml"
19
20 - name: Update cache (RedHat)
21   yum:
22     update_cache: yes
23   when: ansible_os_family == "RedHat"
24
25 - name: Update cache (Debian)
26   apt:
27     update_cache: yes
28   when: ansible_os_family == "Debian"
29
30 - name: Install BRMA requirements
31   become: true
32   package:
33     name: "{{ item }}"
34     state: present
35   with_items: "{{ bmra_pkgs }}"
36
37 - name: Check if Python is present in PATH
38   shell: "which python"
39   register: pypath
40   failed_when: false
41
42 - name: Check if /usr/bin/python exists
43   stat:
44     path: /usr/bin/python
45   register: pybin
46
47 - name: Create symlink for Python
48   file:
49     src: /usr/bin/python3
50     dest: /usr/bin/python
51     state: link
52   when:
53     - not pybin.stat.exists
54     - pypath.rc != 0
55
56 - name: Fix /etc/default/grub (1/2)
57   replace:
58     path: /etc/default/grub
59     regexp: ''''
60     replace: '"'
61
62 - name: Fix /etc/default/grub (2/2)
63   replace:
64     path: /etc/default/grub
65     regexp: 'export '
66     replace: ''