Translated in english tasks descriptions for init and base. Better split of operations within base role.

This commit is contained in:
Emiliano Vavassori 2015-09-14 00:23:31 +02:00
parent d3af386f4a
commit 102aab5328
10 changed files with 158 additions and 112 deletions

View File

@ -7,5 +7,4 @@
roles:
- init
- base
- vagrantbox
- domain

View File

@ -0,0 +1,9 @@
---
# Manage Repository changes (but only for physical machines)
- name: Change repository sources
template:
src: sources.list
dest: /etc/apt/sources.list
backup: yes
when: ansible_product_name != "VirtualBox"

View File

@ -1,93 +0,0 @@
---
# 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"

View File

@ -0,0 +1,22 @@
---
# Manages the installation of the main desktop environment
- name: Checking for 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: Installation of the 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: Change default desktop environment
replace:
dest: /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
regexp: "^user-session=ubuntu$"
replace: "user-session=gnome-fallback"

View File

@ -1,9 +1,36 @@
---
# Configurazioni di base.
# Al termine delle configurazioni di base, avremo un'installazione
# completa di Edubuntu.
# System base configurations.
# At the end of system configuration, we should have a complete
# Edubuntu system
- include: base.yml
- include: apt-sources.yml
tags:
- base
- apt-sources
- include: virtualbox-guest-addons.yml
tags:
- base
- virtualbox-addons
- include: system-update.yml
tags:
- base
- update
- include: desktop-environment.yml
tags:
- base
- de
- desktop-environment
- include: packages.yml
tags:
- base
- pkgs
- packages
- include: system.yml
tags:
- base
- edubuntu

View File

@ -0,0 +1,53 @@
---
# Management of packages
- name: Removing packages commonly not required
apt: pkg={{ item }} state=absent purge=yes
with_items: "{{ base_common_delpkg }}"
sudo: yes
- name: Removing packages from client machines
apt: pkg={{ item }} state=absent purge=yes
with_items: "{{ base_client_delpkg }}"
sudo: yes
when: role == 'client' and base_client_delpkg|length > 0
- name: Removing packages from docenti machines
apt: pkg={{ item }} state=absent purge=yes
with_items: "{{ base_docenti_delpkg }}"
sudo: yes
when: role == 'docenti' and base_docenti_delpkg|length > 0
- name: Cleanup of unneeded packages
shell: apt-get -y autoremove
register: autoremove
changed_when: "'Rimozione' in autoremove.stdout"
sudo: yes
- name: Installing additional common packages
apt: pkg={{ item }} state=installed
with_items: "{{ base_common_addpkg }}"
tags: edu-install
sudo: yes
- name: Installing additional packages for client role
apt: pkg={{ item }} state=present
with_items: "{{ base_client_addpkg }}"
sudo: yes
when: role == 'client' and base_client_addpkg|length > 0
- name: Installing additional packages for docenti role
apt: pkg={{ item }} state=present
with_items: "{{ base_docenti_addpkg }}"
sudo: yes
when: role == 'docenti' and base_docenti_addpkg|length > 0
- 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

View File

@ -0,0 +1,10 @@
---
# Manage system upgrade
- name: Updating available packages
apt: update_cache=yes
sudo: yes
- name: Upgrading system
apt: upgrade=full
sudo: yes

View File

@ -0,0 +1,12 @@
---
# Adjusting other settings due to unattended installation
- name: Adjusting connections for NetworkManager
lineinfile:
dest: /etc/network/interfaces
regexp: "{{ item }}"
state: absent
when: ansible_product_name != "VirtualBox"
with_items:
- ^auto eth0
- ^iface eth0

View File

@ -0,0 +1,7 @@
---
# Manage Virtualbox additions
- name: Adding Virtualbox Guest Additions if required
apt: pkg=virtualbox-guest-dkms state=present
when: ansible_product_name == "VirtualBox"
sudo: yes

View File

@ -1,17 +1,7 @@
---
# Task di configurazione iniziali
# Initialization task (for simpler ansible management)
- name: Creazione utente di gestione
user:
name: amgmt
comment: "Ansible Management User"
group: users
password: $6$rounds=100000$XvHuMoXtpCksx379$nhlfUn38.oBB7JrDrtwfUisw8T0Bg5InzFq1fw31mcEmGZ2AYFkFK2zC2g04lSfw.kpdSgqH3Dl5q9r1fY6.k.
shell: /bin/bash
state: present
generate_ssh_key: yes
- name: Concessione diritti sudo all'utente root
- name: Setting up sudoers for root
lineinfile:
dest: /etc/sudoers.d/root
regexp: "^root.*NOPASSWD"
@ -23,7 +13,17 @@
state: present
validate: '/usr/sbin/visudo -c -f %s'
- name: Concessione diritti sudo all'utente ansible
- name: Creating Ansible Management User
user:
name: amgmt
comment: "Ansible Management User"
group: users
password: $6$rounds=100000$XvHuMoXtpCksx379$nhlfUn38.oBB7JrDrtwfUisw8T0Bg5InzFq1fw31mcEmGZ2AYFkFK2zC2g04lSfw.kpdSgqH3Dl5q9r1fY6.k.
shell: /bin/bash
state: present
generate_ssh_key: yes
- name: Setting up sudoers for Ansible Management User
lineinfile:
dest: /etc/sudoers.d/amgmt
regexp: "^amgmt.*NOPASSWD"
@ -35,7 +35,7 @@
state: present
validate: '/usr/sbin/visudo -c -f %s'
- name: Autorizzazione della chiave pubblica del server
- name: Authorizing Ansible Management User's key from server
authorized_key:
user: amgmt
key: "{{ lookup('pipe', 'curl -sSL http://' + serverfqdn + ':3000/mgmtkey') }}"