linuxinstaller/ansible/roles/base/tasks/main.yml
2024-10-18 19:50:12 +02:00

65 lines
2 KiB
YAML

- name: Source les variables dépendantes de la distribution
ansible.builtin.import_tasks: variables.yml
tags: always
- name: Utilisateurs existants
ansible.builtin.getent:
database: passwd
# Si le compte installer_username existe, c'est qu'on est passé par l'installation automatique
# On n'a pas de compte avec sudo, on doit permettre au compte installer de lancer le menu
- name: Sudoers pour {{ installer_username }}
ansible.builtin.copy:
content: |
# Autorise {{ installer_username }} à lancer le menu sans mdp
{{ installer_username }} ALL = NOPASSWD:/opt/linuxinstaller/linuxinstaller.sh
dest: /etc/sudoers.d/{{ installer_username }}
when: installer_username in getent_passwd.keys()
- name: Installation des packages nécessaires
ansible.builtin.package:
name: "{{ required_packages }}"
- name: Suppression des packages non souhaités
ansible.builtin.package:
name: "{{ remove_packages }}"
state: absent
- name: Installation des flatpak nécessaires
community.general.flatpak:
name: "{{ required_flatpak }}"
method: system
- name: Configuration Mintupdate
ansible.builtin.file:
path: "{{ item }}"
owner: root
group: root
mode: u=rw,g=r,o=r
state: touch
modification_time: preserve
access_time: preserve
loop:
- /var/lib/linuxmint/mintupdate-automatic-removals-enabled
- /var/lib/linuxmint/mintupdate-automatic-upgrades-enabled
- name: Configure GRUB_CMDLINE_LINUX_DEFAULT
ansible.builtin.lineinfile:
state: present
dest: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=""$'
line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"'
notify: Update-grub
- name: Configure GRUB options
ansible.builtin.blockinfile:
state: present
path: /etc/default/grub
marker: "# {mark} ANSIBLE MANAGED BLOCK: GRUB options"
block: |
GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT
notify: Update-grub
- name: Installe Element
ansible.builtin.include_tasks: element.yml