diff --git a/ansible/roles/base/tasks/main.yml b/ansible/roles/base/tasks/main.yml index 555a122..fd63464 100644 --- a/ansible/roles/base/tasks/main.yml +++ b/ansible/roles/base/tasks/main.yml @@ -1,3 +1,7 @@ +- 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 diff --git a/ansible/roles/base/tasks/variables.yml b/ansible/roles/base/tasks/variables.yml new file mode 100644 index 0000000..1ae51cc --- /dev/null +++ b/ansible/roles/base/tasks/variables.yml @@ -0,0 +1,37 @@ +- name: Block variables de système d'exploitation + vars: + _distribution_lts_offset: >- + {{ + ansible_facts['distribution_major_version'] | int % 2 + if ansible_facts['distribution'] == "Ubuntu" + else 0 + }} + _distribution_lts_version: >- + {{ + ansible_facts['distribution_major_version'] | int - + _distribution_lts_offset | int + if ansible_facts['distribution'] == "Ubuntu" + else ansible_facts['distribution_version'] + }} + params: + files: + - "{{ ansible_facts['distribution'] }}_{{ _distribution_lts_version }}.yml" + - "{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" + - "{{ ansible_facts['os_family'] }}_{{ ansible_facts['distribution_major_version'] }}.yml" + - "{{ ansible_facts['distribution'] }}.yml" + - "{{ ansible_facts['os_family'] }}.yml" + - main.yml # fallback, vars/main.yml is always loaded by Ansible + paths: + - "{{ role_path }}/vars" + - "{{ playbook_dir }}/vars" + block: + - name: Affiche variables + ansible.builtin.debug: + msg: | + Recherche de fichier de variables dans : + {{ params | to_yaml }} + - debug: + msg: "Utilise {{ lookup('first_found', params) }}" + - name: Charge variables + ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" + diff --git a/ansible/roles/base/vars/Ubuntu.yml b/ansible/roles/base/vars/Ubuntu.yml new file mode 100644 index 0000000..2fbd4d3 --- /dev/null +++ b/ansible/roles/base/vars/Ubuntu.yml @@ -0,0 +1,18 @@ +required_packages: + - nextcloud-desktop + - gimp + - vlc + - deja-dup + - thunderbird + - pdfarranger + - nautilus-image-converter + - nautilus-nextcloud + - nautilus-image-converter + - flatpak + +remove_packages: [] + + +required_flatpak: + - io.github.ungoogled_software.ungoogled_chromium + diff --git a/ansible/roles/base/vars/main.yml b/ansible/roles/base/vars/mint.yml similarity index 100% rename from ansible/roles/base/vars/main.yml rename to ansible/roles/base/vars/mint.yml