Compare commits

..

No commits in common. "7f39793df7cff44fa0479c6da269399955d5266c" and "6607b9ea336c8282d59257f974c62a893fb3969a" have entirely different histories.

7 changed files with 3 additions and 151 deletions

View File

@ -1,73 +1,3 @@
# role_apt
# role_modele
Rôle de configuration du gestionnaire de paquet *apt* et de déploiement/suppression de paquets.
## Variables
### apt_distribution_name
Nom de la distribution utilisée.
<span style="text-decoration: underline">Valeur par défaut:</span> `debian`
### apt_distribution_release
Nom de la version de la distribution utilisée.
<span style="text-decoration: underline">Valeur par défaut:</span> `bullseye`
### apt_distribution_sections
Sections où seront chercher les paquets (exemple : `main contrib non-free`).
<span style="text-decoration: underline">Valeur par défaut:</span> `main`
### apt_remove
Liste de paquets qui seront désinstallés.
<span style="text-decoration: underline">Valeur par défaut:</span> aucune
### apt_install
Liste de paquets qui seront installés.
<span style="text-decoration: underline">Valeur par défaut:</span> aucune
## Exemple d'utilisation
### inventory.yml
```yaml
---
all:
hosts:
host1.ykn.local:
```
### group_vars/all.yml
```yaml
---
apt_remove:
- cloud-guest-utils
- cloud-init
apt_install:
- fail2ban
- nftables
- tmux
```
### playbook.yml
```yaml
---
- hosts: 'all'
roles:
- name: apt
```
Modèle

View File

@ -1,9 +0,0 @@
---
# defaults file for apt
apt_distribution_name: debian
apt_distribution_release: bullseye
apt_distribution_sections: main
apt_remove: []
apt_install: []

View File

@ -1,7 +1,7 @@
galaxy_info:
namespace: ykn
author: pulsar89.5
description: Configurer apt et gérer les paquets communs
description: Rôle modèle
license: GPL-3.0-or-later

View File

@ -1,49 +0,0 @@
---
# tasks file for apt
- name: Déployer la configuration du gestionnaire
ansible.builtin.template:
src: apt.conf.j2
dest: /etc/apt/apt.conf.d/99-custom
owner: root
group: root
mode: u=rw,g=r,o=r
become: true
- name: Déployer la configuration des sources
ansible.builtin.template:
src: sources.list.j2
dest: /etc/apt/sources.list
owner: root
group: root
mode: u=rw,g=r,o=r
become: true
- name: Mettre à jour le cache
ansible.builtin.apt:
name: sudo
become: true
- name: Installer sudo
ansible.builtin.apt:
name: sudo
become: true
- name: Désinstaller les paquets communs
ansible.builtin.apt:
state: absent
purge: true
autoremove: true
name: "{{ apt_remove }}"
become: true
- name: Mettre à jour la distribution
become: true
ansible.builtin.apt:
update_cache: true
upgrade: dist
- name: Installer les paquets communs
ansible.builtin.apt:
name: "{{ apt_install }}"
become: true

View File

@ -1,8 +0,0 @@
# {{ ansible_managed }}
APT::Install-Recommends "false";
APT::Install-Suggests "false";
APT::Get::Show-Versions "true";
APT::Get::Show-Upgraded "true";
APT::Get::Purge "true";
APT::Get::List-Cleanup "true";

View File

@ -1,3 +0,0 @@
# {{ ansible_managed }}
{{ apt_repositories[apt_distribution_name] }}

View File

@ -1,9 +0,0 @@
---
# vars file for apt
apt_repositories:
debian: |
deb http://deb.debian.org/debian {{ apt_distribution_release }} {{ apt_distribution_sections }}
deb http://security.debian.org/debian-security {{ apt_distribution_release }}-security {{ apt_distribution_sections }}
deb http://deb.debian.org/debian {{ apt_distribution_release }}-updates {{ apt_distribution_sections }}
deb https://deb.debian.org/debian/ {{ apt_distribution_release }}-backports {{ apt_distribution_sections }}