client-pull-installation/roles/base/tasks/base.yml

94 lines
2.7 KiB
YAML

---
# Configurazione di base del sistema.
- name: Cambiamento apt/sources.list
template:
src: sources.list
dest: /etc/apt/sources.list
backup: yes
when: ansible_product_name != "VirtualBox"
- name: Aggiornamento pacchetti disponibili
apt: update_cache=yes
sudo: yes
- name: Aggiornamento sistema
apt: upgrade=full
sudo: yes
- name: Verifica presenza desktop environment
shell: 'tasksel --list-tasks | grep "^i edubuntu-desktop-gnome"'
ignore_errors: yes
register: check_edubuntu_pkg
changed_when: check_edubuntu_pkg.rc != 0
tags: edu-install
sudo: yes
- name: Installazione desktop environment
shell: "DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -y install edubuntu-desktop-gnome^"
when: check_edubuntu_pkg|changed
tags: edu-install
sudo: yes
- name: Rimozione di pacchetti installati ma non richiesti
apt: pkg={{ item }} state=absent purge=yes
with_items: "{{ base_common_delpkg }}"
sudo: yes
- name: Rimozione pacchetti installati ruolo client
apt: pkg={{ item }} state=absent purge=yes
with_items: "{{ base_client_delpkg }}"
sudo: yes
when: role == 'client' and base_client_delpkg|length > 0
- name: Rimozione pacchetti installati ruolo docenti
apt: pkg={{ item }} state=absent purge=yes
with_items: "{{ base_docenti_delpkg }}"
sudo: yes
when: role == 'docenti' and base_docenti_delpkg|length > 0
- name: Rimozione pacchetti non più necessari
shell: apt-get -y autoremove
register: autoremove
changed_when: "'Rimozione' in autoremove.stdout"
sudo: yes
- name: Installazione pacchetti aggiuntivi
apt: pkg={{ item }} state=installed
with_items: "{{ base_common_addpkg }}"
tags: edu-install
sudo: yes
- name: Installazione pacchetti installati ruolo client
apt: pkg={{ item }} state=present
with_items: "{{ base_client_addpkg }}"
sudo: yes
when: role == 'client' and base_client_addpkg|length > 0
- name: Installazione pacchetti installati ruolo docenti
apt: pkg={{ item }} state=present
with_items: "{{ base_docenti_addpkg }}"
sudo: yes
when: role == 'docenti' and base_docenti_addpkg|length > 0
- name: Aggiungo VirtualBox Guest Additions, se necessario
apt: pkg=virtualbox-guest-dkms state=present
when: ansible_product_name == "VirtualBox"
sudo: yes
- name: Correggo NetworkManager per gestire la rete
lineinfile:
dest: /etc/network/interfaces
regexp: "{{ item }}"
state: absent
when: ansible_product_name != "VirtualBox"
with_items:
- ^auto eth0
- ^iface eth0
- name: 'Cambio sessione di default (gnome-fallback)'
replace:
dest: /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
regexp: "^user-session=ubuntu$"
replace: "user-session=gnome-fallback"