summaryrefslogtreecommitdiff
path: root/ansible_tools/roles/prerequis/tasks/main.yml
blob: df01f35d482526d1ddacbce30b52857d697d05f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
# Set Timezone
- name: Set timezone variables
  ansible.builtin.copy:
    content: 'Europe/Paris'
    dest: /etc/timezone
    owner: root
    group: root
    mode: 0644
    backup: true
    force: false
  notify:
    - Update timezone

# Disable ipv6
- name: Checking GRUB cmdline
  ansible.builtin.shell: "grep 'GRUB_CMDLINE_LINUX_DEFAULT=.*ipv6.disable=1.*' /etc/default/grub"
  register: grub_cfg_grep
  changed_when: false
  failed_when: false

- name: Disable IPV6 on GRUB cmdline
  ansible.builtin.replace:
    path: '/etc/default/grub'
    regexp: '^GRUB_CMDLINE_LINUX_DEFAULT="((\w.?)*)"$'
    replace: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 ipv6.disable=1"'
  when: '"ipv6.disable=1" not in grub_cfg_grep.stdout'

# Remove snap
- name: Stop service snap, if running
  ansible.builtin.systemd:
    name: snapd
    state: stopped
  register: unused_disable # on enregistre le retour de la commande pour déclencher l'arret que si le service existe
  failed_when: "unused_disable is failed and ('find' not in unused_disable.msg and 'found' not in unused_disable.msg)"

- name: Uninstall
  ansible.builtin.apt:
    pkg:
      - snapd
      - gnome-software-plugin-snap
    state: absent
    purge: true

- name: Delete snap directory
  ansible.builtin.file:
    path:
      - ~/snap/
      - /var/cache/snapd/
    state: absent

# Install LibreOffice
- name: Apt Install Prerequis
  ansible.builtin.apt:
    update_cache: true
    name:
      - libreoffice
      - net-tools