From fa2d9d2837b28343271dd3e9105a4f25b13def2d Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Mon, 14 Sep 2015 01:08:32 +0200 Subject: [PATCH] Translated all messages within tasks and roles. Revisited the location of some tasks. --- roles/base/tasks/main.yml | 5 --- roles/base/tasks/role.yml | 11 ----- roles/client/main.yml | 7 +++ roles/client/meta/main.yml | 3 ++ roles/client/tasks/epoptes.yml | 43 ++++++++++++++++++ roles/client/tasks/main.yml | 8 ++++ roles/docenti/meta/main.yml | 3 ++ roles/docenti/tasks/epoptes.yml | 8 ++++ roles/docenti/tasks/main.yml | 8 ++++ roles/domain/tasks/domain_join.yml | 8 ++-- roles/domain/tasks/epoptes.yml | 51 ---------------------- roles/domain/tasks/glib2.yml | 7 +-- roles/domain/tasks/gui-changes.yml | 2 +- roles/domain/tasks/lightdm.yml | 3 +- roles/domain/tasks/main.yml | 8 +--- roles/domain/tasks/nss.yml | 12 ++++- roles/domain/tasks/ntp.yml | 30 ++++++++----- roles/domain/tasks/pam_base.yml | 12 +++-- roles/domain/tasks/pam_mount.yml | 17 +++++--- roles/domain/tasks/pkgs.yml | 9 ++-- roles/domain/tasks/smb_config.yml | 46 +++++++++++++------ roles/domain/tasks/sslproxy.yml | 15 +++---- roles/networkpackagemanager/tasks/main.yml | 13 ++++++ vagrantbox.yml | 12 +++++ 24 files changed, 208 insertions(+), 133 deletions(-) delete mode 100644 roles/base/tasks/role.yml create mode 100644 roles/client/main.yml create mode 100644 roles/client/meta/main.yml create mode 100644 roles/client/tasks/epoptes.yml create mode 100644 roles/client/tasks/main.yml create mode 100644 roles/docenti/meta/main.yml create mode 100644 roles/docenti/tasks/epoptes.yml create mode 100644 roles/docenti/tasks/main.yml delete mode 100644 roles/domain/tasks/epoptes.yml create mode 100644 roles/networkpackagemanager/tasks/main.yml create mode 100644 vagrantbox.yml diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 5b64766..860a4a2 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -34,8 +34,3 @@ tags: - base - edubuntu - -- include: role.yml - tags: - - base - - role diff --git a/roles/base/tasks/role.yml b/roles/base/tasks/role.yml deleted file mode 100644 index f4923e9..0000000 --- a/roles/base/tasks/role.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -# Role based package installation -- name: Installazione pacchetti da aggiungere per il ruolo - apt: name={{ item }} state=present - sudo: yes - with_items: "{{ addpkg }}" - -- name: Rimozione pacchetti da rimuovere per il ruolo - apt: name={{ item }} state=absent purge=yes - sudo: yes - with_items: "{{ delpkg }}" diff --git a/roles/client/main.yml b/roles/client/main.yml new file mode 100644 index 0000000..ceb5a41 --- /dev/null +++ b/roles/client/main.yml @@ -0,0 +1,7 @@ +--- + +- name: reboot + shell: shutdown -r now "Reboot by Ansible." + sudo: yes + async: 0 + poll: 0 diff --git a/roles/client/meta/main.yml b/roles/client/meta/main.yml new file mode 100644 index 0000000..693e6eb --- /dev/null +++ b/roles/client/meta/main.yml @@ -0,0 +1,3 @@ +--- +depenedencies: + - { role: networkpackagemanager, tags: [ 'npm', 'networkpackagemanager' ] } diff --git a/roles/client/tasks/epoptes.yml b/roles/client/tasks/epoptes.yml new file mode 100644 index 0000000..cd7113d --- /dev/null +++ b/roles/client/tasks/epoptes.yml @@ -0,0 +1,43 @@ +--- +# Managing epoptes on 'client' role + +- name: Getting epoptes server name + get_url: + url: "http://{{ serverfqdn }}:3000/epoptes-srv" + dest: /tmp/epoptes-srv + register: get_epo_srv_name + +- name: Checking for a correct name + shell: cat /tmp/epoptes-srv + register: epo_srv_name + when: get_epo_srv_name|changed + changed_when: "'none' not in epo_srv_name.stdout" + +- name: Configuring the client + lineinfile: + dest: /etc/default/epoptes-client + regexp: "^#SERVER=server" + line: "SERVER={{ epo_srv_name.stdout }}" + state: present + when: epo_srv_name|changed + +- name: Checking for an already existent certificate + file: + path: /etc/epoptes/server.crt + status: file + when: epo_srv_name|changed + register: crt_epo_exists + ignore_errors: yes + +- name: Getting the epoptes server certificate + shell: /usr/sbin/epoptes-client -c + sudo: yes + when: crt_epo_exists|failed + notify: + - reboot + +- name: Cleanup + file: + path: /tmp/epoptes-srv + state: absent + when: get_epo_srv_name|changed diff --git a/roles/client/tasks/main.yml b/roles/client/tasks/main.yml new file mode 100644 index 0000000..6bea991 --- /dev/null +++ b/roles/client/tasks/main.yml @@ -0,0 +1,8 @@ +--- +# Managing actions for role 'client' + +- include: epoptes.yml + when: role == 'client' + tags: + - role + - client diff --git a/roles/docenti/meta/main.yml b/roles/docenti/meta/main.yml new file mode 100644 index 0000000..693e6eb --- /dev/null +++ b/roles/docenti/meta/main.yml @@ -0,0 +1,3 @@ +--- +depenedencies: + - { role: networkpackagemanager, tags: [ 'npm', 'networkpackagemanager' ] } diff --git a/roles/docenti/tasks/epoptes.yml b/roles/docenti/tasks/epoptes.yml new file mode 100644 index 0000000..cc1783a --- /dev/null +++ b/roles/docenti/tasks/epoptes.yml @@ -0,0 +1,8 @@ +--- +# Managing Epoptes installation on 'docenti' role. + +- name: Configuring the Epoptes server + lineinfile: + dest: /etc/default/epoptes + line: 'SOCKET_GROUP="{{ domainshort }}\docenti"' + state: present diff --git a/roles/docenti/tasks/main.yml b/roles/docenti/tasks/main.yml new file mode 100644 index 0000000..773e776 --- /dev/null +++ b/roles/docenti/tasks/main.yml @@ -0,0 +1,8 @@ +--- +# Managing actions for role 'docenti' + +- include: epoptes.yml + when: role == 'docenti' + tags: + - role + - docenti diff --git a/roles/domain/tasks/domain_join.yml b/roles/domain/tasks/domain_join.yml index 5a03a1f..02ad97b 100644 --- a/roles/domain/tasks/domain_join.yml +++ b/roles/domain/tasks/domain_join.yml @@ -1,16 +1,14 @@ --- -- name: Permetto ai domadmins di usare sudo - template: src=sudoers.d dest=/etc/sudoers.d/domain owner=root group=root mode=0440 validate="/usr/sbin/visudo -cf %s" - sudo: yes +# Domain join tasks -- name: verifica join a dominio +- name: Checking domain join shell: wbinfo -t sudo: yes register: check_domain changed_when: check_domain.rc != 0 ignore_errors: yes -- name: Join a dominio +- name: Joining domain shell: net rpc join -U admin%{{ domainadminpasswd }} sudo: yes when: check_domain|changed diff --git a/roles/domain/tasks/epoptes.yml b/roles/domain/tasks/epoptes.yml deleted file mode 100644 index 435aaaf..0000000 --- a/roles/domain/tasks/epoptes.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- name: "Configuro il pc docente come Epoptes Server" - replace: - regexp: "^#SOCKET_GROUP=epoptes$" - replace: 'SOCKET_GROUP="{{ domainshort }}\docenti"' - dest: /etc/default/epoptes - sudo: yes - when: role == 'docenti' - -- name: Trovo il nome dell'epoptes server - get_url: - url: "http://{{ serverfqdn }}:3000/epoptes-srv" - dest: /tmp/epoptes-srv - when: role == 'client' - register: get_epo_srv_name - -- name: Verifico il nome, altrimenti salto - shell: cat /tmp/epoptes-srv - register: epo_srv_name - when: role == 'client' and get_epo_srv_name|changed - changed_when: "'none' not in epo_srv_name.stdout" - -- name: Configuro il client per Epoptes - replace: - regexp: "^#SERVER=server" - replace: "SERVER={{ epo_srv_name.stdout }}" - dest: /etc/default/epoptes-client - when: role == 'client' and epo_srv_name|changed - sudo: yes - -- name: Verifica certificato - file: - path: /etc/epoptes/server.crt - status: file - when: role == 'client' and epo_srv_name|changed - register: crt_epo_exists - ignore_errors: yes - -- name: Prendo il certificato - shell: /usr/sbin/epoptes-client -c - sudo: yes - when: role == 'client' and crt_epo_exists|failed - notify: - - reboot - -- name: Pulisco - file: - path: /tmp/epoptes-srv - state: absent - sudo: yes - when: get_epo_srv_name|changed diff --git a/roles/domain/tasks/glib2.yml b/roles/domain/tasks/glib2.yml index 906198a..38ea248 100644 --- a/roles/domain/tasks/glib2.yml +++ b/roles/domain/tasks/glib2.yml @@ -1,20 +1,21 @@ --- +# Glib2 settings for a better user experience -- name: Disabilito la visualizzazione utenti in GNOME +- name: Disabling user listings in Metacity menu copy: src: com.canonical.indicator.session.gschema.override dest: /usr/share/glib-2.0/schemas/com.canonical.indicator.session.gschema.override backup: yes register: cfg_glib_users -- name: Attivo visibilità dei dischi montati sul desktop +- name: Visualizing mounted drives on desktop copy: src: org.gnome.nautilus.desktop.gschema.override dest: /usr/share/glib-2.0/schemas/org.gnome.nautilus.desktop.gschema.override backup: yes register: cfg_glib_mounted -- name: Ricompilo gli schemi glib2 +- name: Recompiling glib2 schemas shell: glib-compile-schemas --strict /usr/share/glib-2.0/schemas/ sudo: yes when: cfg_glib_users|changed or cfg_glib_mounted|changed diff --git a/roles/domain/tasks/gui-changes.yml b/roles/domain/tasks/gui-changes.yml index 92ddaa8..bced57f 100644 --- a/roles/domain/tasks/gui-changes.yml +++ b/roles/domain/tasks/gui-changes.yml @@ -1,5 +1,5 @@ --- -# Cambiamenti all'interfaccia grafica +# Adjusting Graphical User Interface - include: lightdm.yml tags: lightdm diff --git a/roles/domain/tasks/lightdm.yml b/roles/domain/tasks/lightdm.yml index 97b0de3..4035844 100644 --- a/roles/domain/tasks/lightdm.yml +++ b/roles/domain/tasks/lightdm.yml @@ -1,6 +1,7 @@ --- +# Adjusting lightdm settings -- name: Altre impostazioni lightdm +- name: Adjusting lightdm settings lineinfile: dest: /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf regexp: "{{ item }}" diff --git a/roles/domain/tasks/main.yml b/roles/domain/tasks/main.yml index c1f8e50..5d4e449 100644 --- a/roles/domain/tasks/main.yml +++ b/roles/domain/tasks/main.yml @@ -1,6 +1,5 @@ --- -# Configurazioni per messa in dominio. -# Impostazioni grafiche da gestire in dominio +# Domain configurations - include: ntp.yml tags: @@ -27,11 +26,6 @@ - domain - pkgs -- include: epoptes.yml - tags: - - domain - - epoptes - - include: pam_base.yml tags: - domain diff --git a/roles/domain/tasks/nss.yml b/roles/domain/tasks/nss.yml index c49bfa9..4adab0f 100644 --- a/roles/domain/tasks/nss.yml +++ b/roles/domain/tasks/nss.yml @@ -1,3 +1,11 @@ --- -- name: Configurazione nsswitch.conf - template: src=nsswitch.conf dest=/etc/nsswitch.conf backup=yes owner=root group=root mode=0644 +# configuring NSS + +- name: Configuring NSS + template: + src: nsswitch.conf + dest: /etc/nsswitch.conf + backup: yes + owner: root + group: root + mode: 0644 diff --git a/roles/domain/tasks/ntp.yml b/roles/domain/tasks/ntp.yml index 06fdd95..e4bf231 100644 --- a/roles/domain/tasks/ntp.yml +++ b/roles/domain/tasks/ntp.yml @@ -1,23 +1,31 @@ --- -- name: Installazione ntp - apt: name=ntp state=present - sudo: yes +# Configuring NTP for domain clients -- name: Configurazione ntp - template: src=ntp.conf dest=/etc/ntp.conf backup=yes owner=root group=root mode=0644 - sudo: yes +- name: Installing NTP + apt: + name: ntp + state: present + +- name: Configuring NTP + template: + src: ntp.conf + dest: /etc/ntp.conf + backup: yes + owner: root + group: root + mode: 0644 register: cfg_ntp -- name: Permetto a NTP di utilizzare informazioni da winbind +- name: Configuring AppArmor for NTP lineinfile: dest: /etc/apparmor.d/usr.sbin.ntpd regexp: "/run/samba/winbindd/pipe" line: ' /run/samba/winbindd/pipe crw,' insertafter: 'samba/ntp_signd/socket' state: present - sudo: yes -- name: Riavvio ntp - service: name=ntp state=restarted - sudo: yes +- name: Restarting NTP service + service: + name: ntp + state: restarted when: cfg_ntp|changed diff --git a/roles/domain/tasks/pam_base.yml b/roles/domain/tasks/pam_base.yml index 4bb1048..d9569c5 100644 --- a/roles/domain/tasks/pam_base.yml +++ b/roles/domain/tasks/pam_base.yml @@ -1,9 +1,13 @@ --- -# Configurazione di base di PAM per dominio +# base configuration for PAM Module -- name: Installazione libpam-winbind - apt: name=libpam-winbind state=present - sudo: yes +- name: Installing winbind bindings for PAM + apt: + name: libpam-winbind + state: present + +# Leaving them here commented, as they may be needed in the future +# for improvements on login times. # common-auth diff --git a/roles/domain/tasks/pam_mount.yml b/roles/domain/tasks/pam_mount.yml index 162e41d..c08c9fa 100644 --- a/roles/domain/tasks/pam_mount.yml +++ b/roles/domain/tasks/pam_mount.yml @@ -1,10 +1,13 @@ --- -# Configurazione base per pam_mount +# PAM_mount configuration -- name: Installazione pam_mount - apt: name=libpam-mount state=present - sudo: yes +- name: Installing pam_mount + apt: + name: libpam-mount + state: present -- name: Configurazione di pam_mount - template: src=pam_mount.conf.xml dest=/etc/security/pam_mount.conf.xml backup=yes - sudo: yes +- name: Configuring pam_mount + template: + src: pam_mount.conf.xml + dest: /etc/security/pam_mount.conf.xml + backup: yes diff --git a/roles/domain/tasks/pkgs.yml b/roles/domain/tasks/pkgs.yml index c7be7c3..cd72670 100644 --- a/roles/domain/tasks/pkgs.yml +++ b/roles/domain/tasks/pkgs.yml @@ -1,7 +1,10 @@ --- -- name: Installazione pacchetti necessari per dominio - apt: pkg={{ item }} state=present - sudo: yes +# Packages needed for domain join + +- name: Installing domain packages + apt: + pkg: {{ item }} + state: present with_items: - winbind - samba diff --git a/roles/domain/tasks/smb_config.yml b/roles/domain/tasks/smb_config.yml index a016314..d06e021 100644 --- a/roles/domain/tasks/smb_config.yml +++ b/roles/domain/tasks/smb_config.yml @@ -1,26 +1,44 @@ --- -- name: Configurazione smb.conf - template: src=smb.conf dest=/etc/samba/smb.conf validate='testparm -s %s' backup=yes - sudo: yes +# SAMBA configuration for domain + +- name: Configuring SAMBA + template: + src: smb.conf + dest: /etc/samba/smb.conf + validate: 'testparm -s %s' + backup: yes register: cfg_samba -- name: Configuro la home per apparmor +- name: Configuring AppArmor home directories replace: dest: /etc/apparmor.d/tunables/home regexp: '^@\{HOMEDIRS\}=/home/$' replace: '@{HOMEDIRS}=/home/ /home/{{ domainshort }}/' - sudo: yes -- name: Riavvio samba - shell: restart smbd - sudo: yes +- name: SAMBA restart + service: + name: smbd + state: restarted when: cfg_samba|changed -- name: Riavvio winbind - shell: restart winbind - sudo: yes +- name: Winbind restart + service: + name: winbind + state: restarted when: cfg_samba|changed -- name: Creazione home base - file: path=/home/{{ domainshort }} owner=root group=root state=directory - sudo: yes +- name: Creating home base + file: + path: '/home/{{ domainshort }}' + owner: root + group: root + state: directory + +- name: Permitting SAMBA domopers to run sudo + template: + src: sudoers.d + dest: /etc/sudoers.d/domain + owner: root + group: root + mode: 0440 + validate: "/usr/sbin/visudo -cf %s" diff --git a/roles/domain/tasks/sslproxy.yml b/roles/domain/tasks/sslproxy.yml index f207d0c..9807686 100644 --- a/roles/domain/tasks/sslproxy.yml +++ b/roles/domain/tasks/sslproxy.yml @@ -1,5 +1,7 @@ --- -- name: Verifico presenza di directory necessarie +# Adjusting system for domain proxy certificate + +- name: Creating needed directories file: path: '{{ item }}' mode: 0755 @@ -7,22 +9,19 @@ with_items: - /usr/lib/firefox/browser/defaults/profile - /usr/local/share/ca-certificates/{{ domainfull }} - sudo: yes -- name: Scarico il certificato client per proxy trasparente SSL +- name: Getting SSL transparent proxy certificate get_url: - url: http://{{ serverfqdn }}/proxy.crt + url: 'http://{{ serverfqdn }}/proxy.crt' dest: /usr/local/share/ca-certificates/{{ domainfull }}/ca.crt - sudo: yes register: proxycrt_dwnl -- name: Aggiungo il certificato a quelli utilizzati dal sistema +- name: Adding certificate sto the ones used by the system shell: update-ca-certificates when: proxycrt_dwnl|changed sudo: yes -- name: Scarico il database dei certificati di FF con certificato server aggiornato. +- name: Firefox settings to include certificate get_url: url: 'http://{{ serverfqdn }}/ks/cert8.db' dest: /usr/lib/firefox/browser/defaults/profile - sudo: yes diff --git a/roles/networkpackagemanager/tasks/main.yml b/roles/networkpackagemanager/tasks/main.yml new file mode 100644 index 0000000..2f98423 --- /dev/null +++ b/roles/networkpackagemanager/tasks/main.yml @@ -0,0 +1,13 @@ +--- +# Managing installation/deletion of packages set with NetworkPackageManager +# within NethServer console + +- name: Installing packages for specific role from NetworkPackageManager + apt: name={{ item }} state=present + sudo: yes + with_items: "{{ addpkg }}" + +- name: Removing packages for specific role from NetworkPackageManager + apt: name={{ item }} state=absent purge=yes + sudo: yes + with_items: "{{ delpkg }}" diff --git a/vagrantbox.yml b/vagrantbox.yml new file mode 100644 index 0000000..5d4bfcb --- /dev/null +++ b/vagrantbox.yml @@ -0,0 +1,12 @@ +--- + +- hosts: localhost + user: root + vars_files: + - domainpwd.vault + vars: + vagrantbox: true + roles: + - vagrantbox + +