2015-06-23 21:38:22 +02:00
|
|
|
|
---
|
2015-08-20 23:02:53 +02:00
|
|
|
|
- name: Verifica configurazione organizzazione
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop OrganizationContact City
|
|
|
|
|
register: check_org
|
|
|
|
|
changed_when: "'City={{ ansible_local.domain.org_city }}' not in check_org.stdout"
|
|
|
|
|
ignore_errors: yes
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
|
2015-06-23 21:38:22 +02:00
|
|
|
|
- name: Configurazione organizzazione
|
2015-07-22 00:24:00 +02:00
|
|
|
|
shell: /sbin/e-smith/db configuration setprop OrganizationContact City "{{ ansible_local.domain.org_city }}" Company "{{ ansible_local.domain.org_company }}" CountryCode {{ ansible_local.domain.org_countrycode }} Department "{{ ansible_local.domain.org_department }}" PhoneNumber "{{ ansible_local.domain.org_phone }}" Street "{{ ansible_local.domain.org_street }}"
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: check_org|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Configurazione nome server
|
2015-07-22 00:24:00 +02:00
|
|
|
|
shell: /sbin/e-smith/db configuration set SystemName {{ ansible_local.domain.server }}
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
register: chg_hostname
|
|
|
|
|
when: "'{{ ansible_hostname }}' != '{{ ansible_local.domain.server }}'"
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Configurazione nome dominio
|
2015-07-22 00:24:00 +02:00
|
|
|
|
shell: /sbin/e-smith/db configuration set DomainName {{ ansible_local.domain.domainfull }}
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
register: chg_domainname
|
|
|
|
|
when: "'{{ ansible_domain }}' != '{{ ansible_local.domain.domainfull }}'"
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivazione cambiamenti hostname
|
|
|
|
|
shell: /sbin/e-smith/signal-event hostname-modify
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chg_hostname|changed or chg_domainname|changed
|
|
|
|
|
|
|
|
|
|
- name: Verifica robustezza password
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop passwordstrength Users
|
|
|
|
|
register: chk_passstr
|
|
|
|
|
changed_when: "'Users=none' not in chk_passstr.stdout"
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
ignore_errors: true
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Configurazione forza password
|
2015-09-06 20:35:27 +02:00
|
|
|
|
shell: /sbin/e-smith/db configuration setprop passwordstrength PassExpires no Users none Admin strong MaxPassAge 180 MinPassAge 0 PassExpires no PassWarning 7
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_passstr|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivo configurazione policy password
|
|
|
|
|
shell: /sbin/e-smith/signal-event password-policy-update
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_passstr|changed
|
|
|
|
|
|
|
|
|
|
- name: Verifica configurazione DHCP
|
2015-09-06 23:15:13 +02:00
|
|
|
|
shell: /sbin/e-smith/db dhcp getprop {{ intnic }} DhcpRangeStart
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
ignore_errors: true
|
|
|
|
|
register: chk_dhcp
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Configurazione servizio DHCP
|
2015-09-06 23:15:13 +02:00
|
|
|
|
shell: /sbin/e-smith/db dhcp set {{ intnic }} range DhcpRangeStart {{ ansible_local.domain.dhcprange_start }} DhcpRangeEnd {{ ansible_local.domain.dhcprange_end }} status enabled
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_dhcp|failed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivazione configurazione DHCP
|
2015-07-22 07:58:18 +02:00
|
|
|
|
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_dhcp|failed
|
|
|
|
|
|
|
|
|
|
- name: Verifica configurazione DNS
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop dns NameServers
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
register: chk_dns
|
|
|
|
|
changed_when: "'NameServers={{ ansible_local.domain.extdnsserver1 }},{{ ansible_local.domain.extdnsserver2 }}' not in chk_dns.stdout"
|
|
|
|
|
ignore_errors: yes
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Configurazione servizio DNS
|
2015-07-22 00:24:00 +02:00
|
|
|
|
shell: /sbin/e-smith/db configuration setprop dns role resolver NameServers "{{ ansible_local.domain.extdnsserver1 }},{{ ansible_local.domain.extdnsserver2 }}"
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_dns|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivo configurazione DNS
|
|
|
|
|
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_dns|changed
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
2015-08-20 23:02:53 +02:00
|
|
|
|
- name: Verifica configurazione NTP
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop ntpd NTPServer
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
register: chk_ntp
|
|
|
|
|
changed_when: "'NTPServer=ntp1.inrim.it' not in chk_ntp.stdout"
|
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
2015-06-23 21:38:22 +02:00
|
|
|
|
- name: Configuro NTP
|
|
|
|
|
shell: /sbin/e-smith/db configuration setprop ntpd NTPServer ntp1.inrim.it status enabled
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_ntp|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivazione NTP
|
|
|
|
|
shell: /sbin/e-smith/signal-event nethserver-ntp-update
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_ntp|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
2015-08-20 06:20:41 +02:00
|
|
|
|
- name: Utilizzo unix extensions nei template per ibay
|
|
|
|
|
replace:
|
|
|
|
|
dest: /etc/e-smith/templates/etc/samba/smb.conf/10global
|
|
|
|
|
regexp: '^unix extensions = no$'
|
|
|
|
|
replace: 'unix extensions = yes'
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 06:20:41 +02:00
|
|
|
|
|
2015-08-20 23:02:53 +02:00
|
|
|
|
- name: Verifica configurazione SMB
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop smb RoamingProfiles
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
register: chk_smb
|
|
|
|
|
changed_when: "'RoamingProfiles=yes' not in chk_smb.stdout"
|
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
2015-06-23 21:38:22 +02:00
|
|
|
|
- name: Configurazione SMB
|
2015-07-22 00:24:00 +02:00
|
|
|
|
shell: /sbin/e-smith/db configuration setprop smb RoamingProfiles yes ServerRole PDC Workgroup "{{ ansible_local.domain.domainshort }}" status enabled
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_smb|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivo configurazione SMB
|
|
|
|
|
shell: /sbin/e-smith/signal-event nethserver-samba-save
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_smb|changed
|
|
|
|
|
|
2015-06-24 22:17:08 +02:00
|
|
|
|
- name: Abilito il ricaricamento dei servizi smb su ibay-create
|
2015-06-25 23:51:52 +02:00
|
|
|
|
file: src="reload" dest="{{ item }}/smb" state=link force=yes
|
2015-06-24 22:17:08 +02:00
|
|
|
|
with_items:
|
|
|
|
|
- /etc/e-smith/events/ibay-delete/services2adjust
|
|
|
|
|
- /etc/e-smith/events/ibay-create/services2adjust
|
|
|
|
|
- /etc/e-smith/events/ibay-modify/services2adjust
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-06-24 22:17:08 +02:00
|
|
|
|
|
2015-08-20 23:02:53 +02:00
|
|
|
|
- name: Verifica creazione share condiviso
|
|
|
|
|
shell: /sbin/e-smith/db accounts show shared
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
ignore_errors: true
|
|
|
|
|
register: chk_shared
|
|
|
|
|
|
2015-11-06 00:10:14 +01:00
|
|
|
|
- name: Copying default templates for new template type
|
|
|
|
|
shell: cp -r /etc/e-smith/templates/etc/samba/smb.conf/ibay-default /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-11-06 00:10:14 +01:00
|
|
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
|
|
|
|
|
|
- name: Configuring ibay-shared template structure (directory mask)
|
|
|
|
|
lineinfile:
|
|
|
|
|
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
|
|
|
|
|
line: 'directory mask = 0775'
|
|
|
|
|
insertafter: '^create mask'
|
|
|
|
|
state: present
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-11-06 00:10:14 +01:00
|
|
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
|
|
|
|
|
|
- name: Configuring force create mode
|
|
|
|
|
lineinfile:
|
|
|
|
|
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
|
|
|
|
|
line: 'force create mode = 0664'
|
|
|
|
|
insertafter: '^directory mask'
|
|
|
|
|
state: present
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-11-06 00:10:14 +01:00
|
|
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
|
|
|
|
|
|
- name: Configuring force directory mode
|
|
|
|
|
lineinfile:
|
|
|
|
|
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
|
|
|
|
|
line: 'force directory mode = 0775'
|
|
|
|
|
insertafter: '^force create mode'
|
|
|
|
|
state: present
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-11-06 00:10:14 +01:00
|
|
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
|
|
2015-06-23 21:38:22 +02:00
|
|
|
|
- name: Configurazione share Condiviso
|
|
|
|
|
shell: /sbin/e-smith/db accounts set shared ibay AclRead domusers,domadmins AclWrite domusers,domadmins Description "Cartella condivisa" GroupAccess rw HttpStatus disabled OtherAccess r OwningGroup locals SmbAuditStatus enabled SmbGuestAccessType none SmbRecycleBinStatus enabled SmbRecycleBinVersionsStatus enabled SmbStatus enabled
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_shared|failed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivazione share condiviso
|
2015-06-24 22:17:08 +02:00
|
|
|
|
shell: /sbin/e-smith/signal-event ibay-create shared
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_shared|failed
|
|
|
|
|
|
2015-11-06 00:10:14 +01:00
|
|
|
|
- name: Changing ibay profile for shared
|
|
|
|
|
shell: /sbin/e-smith/db accounts setprop shared SmbProfileType shared
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-11-06 00:10:14 +01:00
|
|
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
|
|
|
|
|
|
- name: Forcing regeneration of smb.conf
|
|
|
|
|
shell: /sbin/e-smith/signal-event nethserver-samba-update
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-11-06 00:10:14 +01:00
|
|
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
|
|
2015-08-20 23:02:53 +02:00
|
|
|
|
- name: Verifica configurazione squid
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop squid GreenMode
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
ignore_errors: yes
|
|
|
|
|
register: chk_squid
|
2016-02-21 00:47:38 +01:00
|
|
|
|
changed_when: "'DiskCacheSize=2000' not in chk_squid.stdout"
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Configurazione squid
|
2016-02-21 00:19:27 +01:00
|
|
|
|
shell: /sbin/e-smith/db configuration setprop squid BlueMode transparent GreenMode transparent PortBlock disabled status enabled DiskCache enabled DiskCacheSize 2000
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_squid|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivazione configurazione squid
|
|
|
|
|
shell: /sbin/e-smith/signal-event nethserver-squid-update
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_squid|changed
|
|
|
|
|
|
|
|
|
|
- name: Verifica configurazione squidguard
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop squidguard Lists
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
ignore_errors: true
|
|
|
|
|
register: chk_squidguard
|
|
|
|
|
changed_when: "'Lists=shalla' not in chk_squidguard.stdout"
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Configurazione squidguard
|
|
|
|
|
shell: /sbin/e-smith/db configuration setprop squidguard Expressions enabled Lists shalla status enabled
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_squidguard|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
2016-02-21 00:47:38 +01:00
|
|
|
|
- name: Activating squidguard configuration
|
|
|
|
|
shell: "/sbin/e-smith/signal-event nethserver-squidguard-{{ item }}"
|
|
|
|
|
with_items:
|
|
|
|
|
- save
|
|
|
|
|
- update
|
|
|
|
|
- downloadlists
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_squidguard|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
2016-02-21 00:47:38 +01:00
|
|
|
|
- name: Verifying content filter activation
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop squidguard status
|
|
|
|
|
register: check_cf_enabled
|
|
|
|
|
changed_when: "'disabled' not in check_cf_enabled.stdout"
|
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
|
|
- name: Enabling squidguard for content filtering
|
|
|
|
|
shell: /sbin/e-smith/db configuration setprop squidguard status enabled
|
|
|
|
|
when: check_cf_enabled|changed
|
|
|
|
|
register: cf_enable
|
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
|
|
- name: Verifying content filtering
|
|
|
|
|
shell: /sbin/e-smith/db contentfilter getprop default Categories
|
|
|
|
|
ignore_errors: yes
|
|
|
|
|
register: check_cf
|
|
|
|
|
changed_when: check_cf.rc != 0
|
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
|
|
- name: Configuring content filtering
|
|
|
|
|
shell: /sbin/e-smith/db contentfilter setprop default Categories aggressive,alcohol,weapons,games-online,gamble,dating,webradio,webtv,sex,porn,spyware,violence,anonvpn,warez
|
|
|
|
|
become: yes
|
|
|
|
|
register: cf_cat
|
|
|
|
|
when: check_cf|changed
|
|
|
|
|
|
|
|
|
|
- name: Activating content filtering as a whole
|
2015-06-23 21:38:22 +02:00
|
|
|
|
shell: /sbin/e-smith/signal-event nethserver-squidguard-update
|
2016-02-21 00:47:38 +01:00
|
|
|
|
when: cf_enable|changed or cf_cat|changed
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2016-02-21 00:47:38 +01:00
|
|
|
|
|
2015-08-20 23:02:53 +02:00
|
|
|
|
|
|
|
|
|
- name: Verifica configurazione squidclamav
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop squidclamav status
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
ignore_errors: true
|
|
|
|
|
register: chk_squidclamav
|
|
|
|
|
changed_when: "'status=enabled' not in chk_squidclamav.stdout"
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Configurazione squidclamav
|
|
|
|
|
shell: /sbin/e-smith/db configuration setprop squidclamav status enabled
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_squidclamav|changed
|
2015-06-23 21:38:22 +02:00
|
|
|
|
|
|
|
|
|
- name: Attivazione squidclamav
|
|
|
|
|
shell: /sbin/e-smith/signal-event nethserver-squidclamav-update
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
when: chk_squidclamav|changed
|
|
|
|
|
|
|
|
|
|
- name: Verifica completamento configurazione per certificato
|
|
|
|
|
shell: /sbin/e-smith/db configuration printprop pki CommonName
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-08-20 23:02:53 +02:00
|
|
|
|
ignore_errors: true
|
|
|
|
|
register: chk_crt
|
|
|
|
|
changed_when: "'CommonName={{ ansible_local.domain.serverfqdn }}' not in chk_crt.stdout"
|
2015-11-02 07:43:05 +01:00
|
|
|
|
tags: regen-ca
|
2015-08-20 23:02:53 +02:00
|
|
|
|
|
|
|
|
|
- name: Completo la configurazione per produzione certificato
|
2015-11-02 07:43:05 +01:00
|
|
|
|
shell: /sbin/e-smith/db configuration setprop pki CertificateDuration 3650 CommonName {{ ansible_local.domain.serverfqdn }} CountryCode {{ ansible_local.domain.org_countrycode }} EmailAddress {{ ansible_local.domain.org_email }} Locality "{{ ansible_local.domain.org_city }}" Organization "{{ ansible_local.domain.org_company }}"
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-11-02 07:43:05 +01:00
|
|
|
|
tags: regen-ca
|
|
|
|
|
when: chk_crt|changed or force_regen_ca|bool
|
2015-08-20 23:02:53 +02:00
|
|
|
|
|
|
|
|
|
- name: Rigenero il certificato con le informazioni inserite
|
|
|
|
|
shell: /sbin/e-smith/signal-event certificate-update
|
2016-01-12 22:03:15 +01:00
|
|
|
|
become: yes
|
2015-11-02 07:43:05 +01:00
|
|
|
|
when: chk_crt|changed or force_regen_ca|bool
|
2015-08-20 23:02:53 +02:00
|
|
|
|
tags: regen-ca
|