Fix a set of issues with K8s deployment
[kuberef.git] / playbooks / roles / pre-install / tasks / main.yml
1 ---
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2020 Samsung Electronics
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 - name: Ensure Python3 is installed (Equinix Metal)
12   raw: yum install -y python3
13   when: lookup('env', 'VENDOR') == 'equinix-metal'
14
15 - name: Gather facts
16   setup:
17
18 - name: Load distro variables
19   include_vars:
20     file: "{{ ansible_os_family }}.yml"
21
22 - name: Install BRMA requirements
23   become: true
24   package:
25     name: "{{ item }}"
26     state: present
27   with_items: "{{ bmra_pkgs }}"
28
29 - name: Check if Python is present in PATH
30   shell: "which python"
31   register: pypath
32   failed_when: false
33
34 - name: Check if /usr/bin/python exists
35   stat:
36     path: /usr/bin/python
37   register: pybin
38
39 - name: Create symlink for Python
40   file:
41     src: /usr/bin/python3
42     dest: /usr/bin/python
43     state: link
44   when:
45     - not pybin.stat.exists
46     - pypath.rc != 0
47
48 - name: Fix /etc/default/grub (1/2)
49   replace:
50     path: /etc/default/grub
51     regexp: ''''
52     replace: '"'
53
54 - name: Fix /etc/default/grub (2/2)
55   replace:
56     path: /etc/default/grub
57     regexp: 'export '
58     replace: ''