Compare commits

...

14 Commits
master ... v7

38 changed files with 340 additions and 549 deletions

146
Vagrantfile vendored
View File

@ -1,141 +1,29 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
# Defining a base vm name:
myname = "NethServer"
myname = "NethServer7-dev"
config.vm.box = "syntaxerrormmm/nethserver-6.9"
config.vm.box_url = "https://vagrant.libreschool.org/nethserver-6.9"
config.vm.define myname do |nethserver|
end
config.vm.provider :virtualbox do |vb|
vb.name = myname
nethserver.vm.box = "syntaxerrormmm/nethserver-7"
nethserver.vm.box_url = "https://vagrant.libreschool.org/nethserver-7"
nethserver.vm.provider :libvirt do |lv|
lv.keymap = 'it'
end
nethserver.vm.network :private_network,
:ip => "172.16.253.1",
:auto_config => false
nethserver.vm.provision :ansible do |a|
a.compatibility_mode = "2.0"
a.playbook = "provision.yml"
a.groups = { "vagrant" => [ myname ] }
end
end
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "private_network", ip: "172.16.254.1", auto_config: false
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# #vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
#
# View the documentation for the provider you're using for more
# information on available options.
# Enable provisioning with CFEngine. CFEngine Community packages are
# automatically installed. For example, configure the host as a
# policy server and optionally a policy file to run:
#
# config.vm.provision "cfengine" do |cf|
# cf.am_policy_hub = true
# # cf.run_file = "motd.cf"
# end
#
# You can also configure and bootstrap a client to an existing
# policy server:
#
# config.vm.provision "cfengine" do |cf|
# cf.policy_server_address = "10.0.2.15"
# end
# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.
# You will need to create the manifests directory and a manifest in
# the file default.pp in the manifests_path directory.
#
# config.vm.provision "puppet" do |puppet|
# puppet.manifests_path = "manifests"
# puppet.manifest_file = "default.pp"
# end
# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
# some recipes and/or roles.
#
# config.vm.provision "chef_solo" do |chef|
# chef.cookbooks_path = "../my-recipes/cookbooks"
# chef.roles_path = "../my-recipes/roles"
# chef.data_bags_path = "../my-recipes/data_bags"
# chef.add_recipe "mysql"
# chef.add_role "web"
#
# # You may also specify custom JSON attributes:
# chef.json = { mysql_password: "foo" }
# end
# Enable provisioning with chef server, specifying the chef server URL,
# and the path to the validation key (relative to this Vagrantfile).
#
# The Opscode Platform uses HTTPS. Substitute your organization for
# ORGNAME in the URL and validation key.
#
# If you have your own Chef Server, use the appropriate URL, which may be
# HTTP instead of HTTPS depending on your configuration. Also change the
# validation key to validation.pem.
#
# config.vm.provision "chef_client" do |chef|
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
# chef.validation_key_path = "ORGNAME-validator.pem"
# end
#
# If you're using the Opscode platform, your validator client is
# ORGNAME-validator, replacing ORGNAME with your organization name.
#
# If you have your own Chef Server, the default validation client name is
# chef-validator, unless you changed the configuration.
#
# chef.validation_client_name = "ORGNAME-validator"
config.vm.provision "ansible" do |ansible|
# Using default dynamic inventory
ansible.playbook = "provision.yml"
ansible.groups = {
"vagrant" => [ myname ]
}
ansible.compatibility_mode = "2.0"
end
end

View File

@ -2,4 +2,7 @@
host_key_checking=False
inventory=hosts
roles_path=roles
[ssh_connections]
#ssh_args= -o ServerAliveInterval=30 -o ControlMaster=auto -o ControlPersist=60s
pipelining=True

View File

@ -2,15 +2,17 @@
# Configurazione dominio
ntpserver: pdc.topolin.ia
server: pdc
serverip: 172.16.254.1
serverip: 172.16.253.1
nsdc_ipaddress: 172.16.253.2
servernetmask: 255.255.255.0
servernet: 172.16.254.0
servergw: 172.16.254.1
servernet: 172.16.253.0
servergw: 172.16.253.1
serverfqdn: pdc.topolin.ia
domainshort: TOPOLIN
domainfull: topolin.ia
dhcprange_start: 172.16.254.10
dhcprange_end: 172.16.254.50
sssdrealm: ad.topolin.ia
dhcprange_start: 172.16.253.10
dhcprange_end: 172.16.253.50
extdnsserver1: 208.67.222.222
extdnsserver2: 208.67.220.220
org_email: info@bglug.it

2
hosts
View File

@ -2,4 +2,4 @@
host_key_checking=false
[server]
172.16.254.1 ansible_ssh_user=amgmt
172.16.253.1 ansible_ssh_user=amgmt

View File

@ -1,8 +1,8 @@
---
dependencies:
- { role: ubuntu-mirror, tags: [ 'client-install' ] }
- { role: mirror, tags: [ 'client-install' ] }
- { role: preseed, tags: [ 'client-install' ] }
- { role: ansible-pull, tags: [ 'client-install' ] }
- { role: doraemon, tags: [ 'client-install' ] }
- { role: npm, tags: [ 'client-install' ] }
- { role: git-daemon, tags: [ 'client-install' ] }
# - { role: ansible-pull, tags: [ 'client-install' ] }
# - { role: doraemon, tags: [ 'client-install' ] }
# - { role: npm, tags: [ 'client-install' ] }
# - { role: git-daemon, tags: [ 'client-install' ] }

View File

@ -0,0 +1,7 @@
---
- name: restart httpd-admin
service:
name: httpd-admin
state: restarted
become: yes

View File

@ -0,0 +1,37 @@
---
# Installing and configuring AD role
- name: Verify if br0 exists already
shell: /sbin/e-smith/db networks printprop br0 role
register: br0_status
ignore_errors: yes
- name: Creating brigde interface to host the dc
shell: /sbin/e-smith/db networks set br0 bridge gateway '' ipaddr {{ ansible_local.domain.serverip }} netmask {{ ansible_local.domain.servernetmask }} role green
when: '"role=green" not in br0_status.stdout'
- name: Removing unneded properties from lan0
shell: /sbin/e-smith/db networks delprop lan0 ipaddr netmask bootproto
when: '"role=green" not in br0_status.stdout'
- name: Assigning bridge member role for lan0
shell: /sbin/e-smith/db networks setprop lan0 bridge br0 role bridged
when: '"role=green" not in br0_status.stdout'
- name: Activating bridge
shell: /sbin/e-smith/signal-event interface-update
when: '"role=green" not in br0_status.stdout'
- name: Configuring sssd provider
shell: /sbin/e-smith/db configuration setprop sssd Realm {{ ansible_local.domain.sssdrealm | upper }} Workgroup {{ ansible_local.domain.domainshort }}
- name: Configuring nsdc
shell: /sbin/e-smith/db configuration set nsdc service IpAddress {{ ansible_local.domain.nsdc_ipaddress }} ProvisionType newdomain bridge br0 status enabled
- name: Installing needed packages
yum:
name: "@nethserver-dc"
state: present
- name: Saving new dc status
shell: /sbin/e-smith/signal-event nethserver-dc-update

View File

@ -9,27 +9,25 @@
state: present
tags: nethgui
# Trusted networks: LAN
# Hostname stuff
- name: Changing effectively hostname
shell: /usr/bin/hostnamectl set-hostname {{ ansible_local.domain.serverfqdn }} --static
register: hostnamechg
when: "'{{ ansible_hostname }}' != '{{ ansible_local.domain.server }}'"
- name: Check for LAN to be added as Trusted Network
shell: /sbin/e-smith/db networks printprop {{ ansible_local.domain.servernet }} Description
register: check_trusted
changed_when: '"Description=Local LAN" not in check_trusted.stdout'
ignore_errors: yes
tags: trustednet
- name: Configuring hostname
shell: /sbin/e-smith/db configuration set SystemName {{ ansible_local.domain.server }}
when: hostnamechg|changed
- name: Configuring trusted networks
shell: /sbin/e-smith/db networks set {{ ansible_local.domain.servernet }} network Description "Local LAN" Mask {{ ansible_local.domain.servernetmask }}
when: check_trusted|changed
tags: trustednet
- name: Configuring domain name
shell: /sbin/e-smith/db configuration set DomainName {{ ansible_local.domain.domainfull }}
when: hostnamechg|changed
- name: Activating trusted network
shell: /sbin/e-smith/signal-event trusted-networks-modify
when: check_trusted|changed
tags: trustednet
# Preconfiguring DNS anyways
- name: Activating hostname/domainname changes
shell: /sbin/e-smith/signal-event hostname-modify
when: hostnamechg|changed
# DNS configuration
- name: Checking DNS configuration
shell: /sbin/e-smith/db configuration printprop dns NameServers
register: chk_dns
@ -45,29 +43,7 @@
shell: "/sbin/e-smith/signal-event nethserver-base-update"
when: chk_dns|changed
# Hostname and domainname
- name: Configuring hostname
shell: /sbin/e-smith/db configuration set SystemName {{ ansible_local.domain.server }}
register: chg_hostname
when: "'{{ ansible_hostname }}' != '{{ ansible_local.domain.server }}'"
tags: hostname
- name: Configuring domain name
shell: /sbin/e-smith/db configuration set DomainName {{ ansible_local.domain.domainfull }}
register: chg_domainname
when: "'{{ ansible_domain }}' != '{{ ansible_local.domain.domainfull }}'"
tags: domainname
- name: Activating hostname/domainname changes
shell: /sbin/e-smith/signal-event hostname-modify
when: chg_hostname|changed or chg_domainname|changed
tags:
- hostname
- domainname
# Base certificate
- name: Checking CA configuration
shell: /sbin/e-smith/db configuration printprop pki CommonName
ignore_errors: true
@ -84,3 +60,7 @@
shell: /sbin/e-smith/signal-event certificate-update
when: chk_crt|changed or force_regen_ca|bool
tags: regen-ca
- name: Disabling first time wizard
shell: /sbin/e-smith/db configuration setprop httpd-admin ForcedLoginModule ""
notify: restart httpd-admin

View File

@ -0,0 +1,21 @@
---
# DHCP
- name: Checking DHCP configuration
shell: /sbin/e-smith/db dhcp getprop {{ intnic }} DhcpRangeStart
ignore_errors: true
register: chk_dhcp
- name: Configuring DHCP
shell: /sbin/e-smith/db dhcp set {{ intnic }} range DhcpRangeStart {{ ansible_local.domain.dhcprange_start }} DhcpRangeEnd {{ ansible_local.domain.dhcprange_end }} DhcpDNS {{ ansible_local.domain.serverip }} DhcpDomain {{ ansible_local.domain.domainfull }} DhcpGatewayIP {{ ansible_local.domain.servergw }} DhcpLeaseTime 86400 DhcpNTP {{ ansible_local.domain.serverip }} status enabled
when: chk_dhcp|failed
- name: Activating DHCP
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
when: chk_dhcp|failed
# Avahi
- name: Installing avahi-daemon
yum:
name: nethserver-avahi
state: present

View File

@ -1,52 +0,0 @@
---
# Installing and configuring DHCP and DNS
- name: Installing DHCP and DNS related NethServer packages.
yum:
name: nethserver-dnsmasq
state: present
# DHCP
- name: Checking DHCP configuration
shell: /sbin/e-smith/db dhcp getprop {{ intnic }} DhcpRangeStart
ignore_errors: true
register: chk_dhcp
- name: Configuring DHCP
shell: /sbin/e-smith/db dhcp set {{ intnic }} range DhcpRangeStart {{ ansible_local.domain.dhcprange_start }} DhcpRangeEnd {{ ansible_local.domain.dhcprange_end }} status enabled
when: chk_dhcp|failed
- name: Activating DHCP
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
when: chk_dhcp|failed
# DNS
# Already preconfigured before (roles/nethcfg/tasks/base.yml)
# reforcing the resolver addresses to the ones configured
- name: Checking DNS configuration
shell: /sbin/e-smith/db configuration printprop dns NameServers
register: chk_dns
changed_when: "'NameServers={{ ansible_local.domain.extdnsserver1 }}' not in chk_dns.stdout"
tags: force-resolvers
- name: Configuring DNS resolution
shell: /sbin/e-smith/db configuration setprop dns NameServers {{ ansible_local.domain.extdnsserver1 }},{{ ansible_local.domain.extdnsserver2 }}
when: chk_dns|changed
tags: force-resolvers
- name: Activating correct DNS resolution
shell: "/sbin/e-smith/signal-event nethserver-{{ item }}-update"
with_items:
- base
- dnsmasq
when: chk_dns|changed
tags: force-resolvers
# Avahi
- name: Installing avahi-daemon
yum:
name: nethserver-avahi
state: present

View File

@ -1,32 +1,13 @@
---
# Domain groups
# Domain Users
- name: domusers - Checking for group
shell: /sbin/e-smith/db accounts show domusers
register: check_domusers
ignore_errors: true
- name: domusers - Creating new group
shell: /sbin/e-smith/db accounts set domusers group Description "Domain Users" Members admin Removable no
when: check_domusers|failed
- name: domusers - Activating group
shell: /sbin/e-smith/signal-event group-create domusers
when: check_domusers|failed
# Domain Operators
- name: domopers - Checking for group
shell: /sbin/e-smith/db accounts show domopers
shell: /bin/getent group domopers
register: check_domopers
ignore_errors: true
- name: domopers - Creating new group
shell: /sbin/e-smith/db accounts set domopers group Description "Domain Operators" Removable no
when: check_domopers|failed
- name: domopers - Activating group
shell: /sbin/e-smith/signal-event group-create domopers
when: check_domopers|failed
@ -34,14 +15,10 @@
# Docenti
- name: docenti - Checking for group
shell: /sbin/e-smith/db accounts show docenti
shell: /bin/getent group docenti
register: check_docenti
ignore_errors: true
- name: docenti - Creating new group
shell: /sbin/e-smith/db accounts set docenti group Description "Docenti" Removable no
when: check_docenti|failed
- name: docenti - Activating group
shell: /sbin/e-smith/signal-event group-create docenti
when: check_docenti|failed

View File

@ -18,17 +18,16 @@
tags:
- ntp
# Directory and organization
- include: directory.yml
- include: organization.yml
become: yes
tags:
- directory
- organization
# DHCP and DNS
- include: dhcpdns.yml
- include: dhcp.yml
become: yes
tags:
- dhcpdns
- dhcp
# Other small services
- include: otherservices.yml
@ -43,6 +42,19 @@
- proxy
- webfilter
# Active directory container
- include: ad.yml
become: yes
tags:
- activedirectory
- ad
# Correcting passwordpolicy
- include: passwordpolicy.yml
become: yes
tags:
- passwordpolicy
# SAMBA and ibays
- include: samba.yml
become: yes

View File

@ -1,24 +1,33 @@
---
# Network time protocol
- name: Installing NTP related packages.
yum:
name: nethserver-ntp
state: present
# Timezone
- name: Configuring timezone
shell: /sbin/e-smith/db configuration set TimeZone "Europe/Rome"
register: chg_timezone
# Configuring same timezone also on php
- name: Configuring timezone in PHP
shell: /sbin/e-smith/db configuration setprop php DateTimezone "Europe/Rome"
register: chg_timezone_php
- name: Activate timezone in PHP
shell: /sbin/e-smith/signal-event nethserver-php-update
when: chg_timezone_php|changed
- name: Checking for NTP Configuration
shell: /sbin/e-smith/db configuration printprop ntpd NTPServer
shell: /sbin/e-smith/db configuration printprop chronyd NTPServer
become: yes
register: chk_ntp
changed_when: "'NTPServer=ntp1.inrim.it' not in chk_ntp.stdout"
ignore_errors: true
- name: Configuring NTP
shell: /sbin/e-smith/db configuration setprop ntpd NTPServer ntp1.inrim.it status enabled
shell: /sbin/e-smith/db configuration setprop chronyd NTPServer ntp1.inrim.it status enabled
become: yes
when: chk_ntp|changed
- name: Activating NTP
shell: /sbin/e-smith/signal-event nethserver-ntp-update
shell: /sbin/e-smith/signal-event nethserver-ntp-save
become: yes
when: chk_ntp|changed

View File

@ -1,38 +1,12 @@
---
# Organization
- name: Installing required packages
yum:
pkg: nethserver-directory
state: present
- name: Check organization configuration
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
# Password policy
- name: Check for password policy
shell: /sbin/e-smith/db configuration printprop passwordstrength Users
register: chk_passstr
changed_when: "'Users=none' not in chk_passstr.stdout"
ignore_errors: true
tags: password-policy
- name: Configuring password policy
shell: /sbin/e-smith/db configuration setprop passwordstrength PassExpires no Users none Admin strong MaxPassAge 180 MinPassAge 0 PassExpires no PassWarning 7
when: chk_passstr|changed
tags: password-policy
- name: Activating password policy
shell: /sbin/e-smith/signal-event password-policy-update
when: chk_passstr|changed
tags: password-policy
# Organization configuration
- name: Configuring organization
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 }}"
when: check_org|changed

View File

@ -3,13 +3,10 @@
- name: Installing other small services
yum:
name: "{{ item }}"
name:
- nethserver-cups
- nethserver-collectd
- nethserver-firewall-base-ui
- nethserver-backup-config
- nethserver-backup-data
state: present
with_items:
- nethserver-cups
- nethserver-collectd
- nethserver-collectd-web
- nethserver-firewall-base
- nethserver-firewall-base-ui
- nethserver-backup-config
- nethserver-backup-data

View File

@ -0,0 +1,19 @@
---
# Password policy
- name: Check for password policy
shell: /sbin/e-smith/db configuration printprop passwordstrength Users
register: chk_passstr
changed_when: "'Users=none' not in chk_passstr.stdout"
ignore_errors: true
tags: password-policy
- name: Configuring password policy
shell: /sbin/e-smith/db configuration setprop passwordstrength PassExpires no Users none MaxPassAge 180 MinPassAge 0 PassWarning 7
when: chk_passstr|changed
tags: password-policy
- name: Activating password policy
shell: /sbin/e-smith/signal-event password-policy-update
when: chk_passstr|changed
tags: password-policy

View File

@ -1,14 +1,12 @@
---
# Proxy and webfiltering configurations
- name: Installing proxy-related packages
yum:
name: "{{ item }}"
name:
- nethserver-squid
- nethserver-squidclamav
- nethserver-squidguard
state: present
with_items:
- nethserver-squid
- nethserver-squidclamav
- nethserver-squidguard
# Squid
@ -23,45 +21,53 @@
when: chk_squid|changed
- name: Activating Squid configuration
shell: /sbin/e-smith/signal-event nethserver-squid-update
shell: /sbin/e-smith/signal-event nethserver-squid-save
when: chk_squid|changed
# Squid-clamav
- name: Checking squidclamav configuration
shell: /sbin/e-smith/db configuration printprop squidclamav status
ignore_errors: true
register: chk_squidclamav
changed_when: "'status=enabled' not in chk_squidclamav.stdout"
- name: Configuring squidclamav
shell: /sbin/e-smith/db configuration setprop squidclamav status enabled
when: chk_squidclamav|changed
- name: Activating squidclamav
shell: /sbin/e-smith/signal-event nethserver-squidclamav-update
when: chk_squidclamav|changed
# SquidGuard
- name: Verifying squidguard configuration
shell: /sbin/e-smith/db configuration printprop squidguard status
register: check_squidguard
ignore_errors: true
changed_when: '"status=enabled" not in check_squidguard.stdout'
- name: Checking ufdb configuration
shell: /sbin/e-smith/db configuration printprop ufdb status
ignore_errors: true
register: chk_ufdb
changed_when: "'status=enabled' not in check_squidguard.stdout"
- name: Configuring ufdb
shell: /sbin/e-smith/db configuration setprop ufdb status enabled
when: check_squidguard|changed
- name: Configuring squidguard
shell: /sbin/e-smith/db configuration setprop squidguard Expressions enabled Lists shalla status enabled
shell: /sbin/e-smith/db configuration setprop squidguard Expressions enabled Lists shalla
when: check_squidguard|changed
- name: Activating squidguard configuration
shell: "/sbin/e-smith/signal-event nethserver-squidguard-{{ item }}"
with_items:
- save
- update
- downloadlists
when: check_squidguard|changed
# Squid-clamav
- name: Checking squidclamav configuration
shell: /sbin/e-smith/db configuration printprop clamd@squidclamav status
ignore_errors: true
register: chk_squidclamav
changed_when: "'status=enabled' not in chk_squidclamav.stdout"
- name: Configuring squidclamav
shell: /sbin/e-smith/db configuration setprop clamd@squidclamav status enabled
when: chk_squidclamav|changed
- name: Activating squidclamav
shell: /sbin/e-smith/signal-event nethserver-squidclamav-update
when: chk_squidclamav|changed
# Content filtering settings
- name: Verifying content filtering
@ -70,10 +76,10 @@
changed_when: "'sex' not in check_cf.stdout"
- 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
shell: /sbin/e-smith/db contentfilter setprop default Categories aggressive,alcohol,weapons,games-online,gamble,dating,webradio,webtv,sex,porn,spyware,violence,anonvpn,warez BlackList enabled BlockAll disabled BlockBuiltinRules disabled BlockFileTypes disabled BlockIpAccess enabled
register: cf_cat
when: check_cf|changed
- name: Activating content filtering as a whole
shell: /sbin/e-smith/signal-event nethserver-squidguard-update
shell: /sbin/e-smith/signal-event nethserver-squidguard-save
when: check_cf|changed

View File

@ -4,20 +4,26 @@
- name: Installing SAMBA and ibays packages
yum:
name: "{{ item }}"
name:
- "@nethserver-file-server"
- nethserver-samba-audit
state: present
with_items:
- nethserver-ibays
- nethserver-samba
- nethserver-samba-audit
# SAMBA
- name: "Verifying modifications on templates-custom."
shell: grep -q 'server signing = mandatory' /etc/e-smith/templates-custom/etc/samba/smb.conf/10global
register: check_tempcust
changed_when: check_tempcust.rc != 0
ignore_errors: true
- name: Checking for default SAMBA behaviour
shell: /sbin/e-smith/db configuration getprop smb HomeAdmStatus
register: check_smbbehavior
changed_when: "'enabled' not in check_smbbehavior"
ignore_errors: yes
- name: Configuring standard SAMBA behaviour on shared folders
shell: /sbin/e-smith/db configuration setprop smb HomeAdmStatus enabled InheritOwner yes ShareAdmStatus enabled
when: check_smbbehavior|changed
- name: Activating default SAMBA behaviour
shell: /sbin/e-smith/signal-event nethserver-samba-save
when: check_smbbehavior|changed
- name: "Create directory structure for templates-custom"
file:
@ -26,7 +32,7 @@
group: root
mode: 0755
state: directory
when: check_tempcust|changed
register: check_tempcust
- name: "Copying settings from default."
copy:
@ -39,82 +45,63 @@
when: check_tempcust|changed
- name: "Enabling unix extensions on SAMBA"
replace:
lineinfile:
dest: /etc/e-smith/templates-custom/etc/samba/smb.conf/10global
regexp: '^unix extensions = no$'
replace: 'unix extensions = yes'
line: 'unix extensions = yes'
state: present
insertafter: EOF
when: check_tempcust|changed
- name: Adding server signing as mandatory
lineinfile:
dest: /etc/e-smith/templates-custom/etc/samba/smb.conf/10global
line: "server signing = mandatory"
insertafter: "^workgroup = "
state: present
insertafter: EOF
when: check_tempcust|changed
- name: Checking SMB configuration
shell: /sbin/e-smith/db configuration printprop smb RoamingProfiles
register: chk_smb
changed_when: "'RoamingProfiles=yes' not in chk_smb.stdout"
ignore_errors: true
- name: Configuring SMB
shell: /sbin/e-smith/db configuration setprop smb RoamingProfiles yes ServerRole PDC Workgroup "{{ ansible_local.domain.domainshort }}" status enabled
when: chk_smb|changed
- name: Activating SMB
- name: Applying custom configurations to running SAMBA
shell: /sbin/e-smith/signal-event nethserver-samba-save
when: chk_smb|changed
become: yes
when: check_tempcust|changed
# ibays
- name: Enabling SMB services restart when managing ibays
file:
src: reload
dest: "{{ item }}/smb"
state: link
force: yes
with_items:
- /etc/e-smith/events/ibay-delete/services2adjust
- /etc/e-smith/events/ibay-create/services2adjust
- /etc/e-smith/events/ibay-modify/services2adjust
- name: Checking for shared ibay
shell: /sbin/e-smith/db accounts show shared
ignore_errors: true
register: chk_shared
- name: Copying default templates for shared 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
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
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
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
when: force_ibay_shared|bool or chk_shared|failed
#- name: Copying default templates for shared 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
# 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
# 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
# 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
# when: force_ibay_shared|bool or chk_shared|failed
- name: Configuring shared ibay
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
shell: /sbin/e-smith/db accounts set shared ibay AclRead "" AclWrite "" Description "Cartella condivisa" GroupAccess rw OtherAccess "" OwningGroup "domain users@{{ ansible_local.domain.domainfull }}" SmbAuditStatus enabled SmbGuestAccessType none SmbRecycleBinStatus enabled SmbRecycleBinVersionsStatus enabled SmbShareBrowseable enabled
when: chk_shared|failed
- name: Activating shared ibay
@ -122,20 +109,15 @@
become: yes
when: chk_shared|failed
- name: Changing ibay profile for shared
shell: /sbin/e-smith/db accounts setprop shared SmbProfileType shared
become: yes
when: force_ibay_shared|bool or chk_shared|failed
#- name: Changing ibay profile for shared
# shell: /sbin/e-smith/db accounts setprop shared SmbProfileType shared
# become: yes
# when: force_ibay_shared|bool or chk_shared|failed
- name: Saving new version of smb.conf
shell: /sbin/e-smith/signal-event nethserver-samba-save
become: yes
when: check_tempcust|changed
- name: Forcing regeneration of smb.conf
shell: /sbin/e-smith/signal-event nethserver-samba-update
become: yes
when: force_ibay_shared|bool or chk_shared|failed or check_tempcust|changed
#- name: Forcing regeneration of smb.conf
# shell: /sbin/e-smith/signal-event nethserver-samba-update
# become: yes
# when: force_ibay_shared|bool or chk_shared|failed or check_tempcust|changed
# Fixing issue #3 - Configure sudo access for admin on server for operator
# access
@ -143,7 +125,7 @@
- name: Configuring sudo access for admin account
lineinfile:
dest: /etc/sudoers.d/admin
line: 'admin ALL=(ALL:ALL) NOPASSWD: ALL'
line: 'admin@{{ ansible_local.domain.domainfull }} ALL=(ALL) NOPASSWD: ALL'
create: yes
owner: root
group: root

View File

@ -9,7 +9,7 @@
- name: Creo directory per certificati
file:
path: /var/lib/nethserver/ibay/ks/server-ca
path: /var/www/html/server-ca
state: directory
owner: root
mode: 0755
@ -18,13 +18,13 @@
- name: 'Utilizzo cert8.db precedentemente fornito (pulito da FF appena aperto)'
copy:
src: cert8.db
dest: /var/lib/nethserver/ibay/ks/server-ca/cert8.db
dest: /var/www/html/server-ca/cert8.db
owner: root
mode: 0644
become: yes
- name: Integro la CA nel db
shell: certutil -A -n "{{ ansible_local.domain.domainfull }}" -t "TCu,Cuw,Tuw" -i /tmp/ca.crt -d /var/lib/nethserver/ibay/ks/server-ca
shell: certutil -A -n "{{ ansible_local.domain.domainfull }}" -t "TCu,Cuw,Tuw" -i /tmp/ca.crt -d /var/www/html/server-ca
become: yes
- name: Pulizia
@ -32,5 +32,5 @@
become: yes
with_items:
- /tmp/ca.crt
- /var/lib/nethserver/ibay/ks/server-ca/key3.db
- /var/lib/nethserver/ibay/ks/server-ca/secmod.db
- /var/www/html/server-ca/key3.db
- /var/www/html/server-ca/secmod.db

View File

@ -5,44 +5,39 @@
edu_package: "{{ ansible_local.domain.edu_package }}"
when: ansible_local.domain.edu_package is defined
- name: Verifica configurazione ibay preseed
shell: /sbin/e-smith/db accounts show ks
register: chk_ks_created
changed_when: chk_ks_created.rc != 0
ignore_errors: yes
become: yes
# Since NS7 web folders are not anymore managed using ibays.
# I have to correct the issue creating manual folder and assigning correct
# permissions.
- name: Configurazione web preseed
shell: /sbin/e-smith/db accounts set ks ibay Description "Preseed share" GroupAccess rw HttpAccess private HttpAliasType default HttpAllowOverrideStatus disabled HttpForceSslStatus disabled HttpPasswordStatus disabled HttpStatus enabled HttpVirtualHost __ANY__ OtherAccess r OwningGroup locals SmbAuditStatus disabled SmbStatus disabled
when: chk_ks_created|failed
become: yes
- name: Attivazione web preseed
shell: /sbin/e-smith/signal-event ibay-create ks
when: chk_ks_created|failed
become: yes
- name: Verifica presenza directory mirror
file: path=/var/spool/apt-mirror/mirror state=directory
register: chk_mirror_dir
ignore_errors: yes
become: yes
- name: Creating the kickstart folder
file:
path: /var/www/html/ks
state: directory
owner: root
group: locals
mode: 0755
- name: Collegamento directory mirror
file: path=/var/lib/nethserver/ibay/ks/mirror src=/var/spool/apt-mirror/mirror state=link
file:
path: /var/www/html/ks/mirror
src: /var/spool/apt-mirror/mirror
state: link
become: yes
when: chk_mirror_dir|success
when: ansible_local.domain.mirror_mode == 'local' or ansible_local.domain.mirror_mode == 'nfs'
- name: Creazione directory preseed
file:
path: "/var/lib/nethserver/ibay/ks/preseed"
path: "/var/www/html/ks/preseed"
state: directory
owner: root
group: local
mode: 0755
become: yes
- name: Copia profili preseed
template:
src: 'preseed/{{ item }}'
dest: '/var/lib/nethserver/ibay/ks/preseed/{{ item }}'
dest: '/var/www/html/ks/preseed/{{ item }}'
with_items:
- edubuntu.seed
- client-trusty.seed
@ -53,13 +48,13 @@
- block:
- name: Creating development directory
file:
path: "/var/lib/nethserver/ibay/ks/preseed/dev"
path: "/var/www/html/ks/preseed/dev"
state: directory
- name: Preseeding profiles - development
template:
src: 'preseed/dev/{{ item }}'
dest: '/var/lib/nethserver/ibay/ks/preseed/dev/{{ item }}'
dest: '/var/www/html/ks/preseed/dev/{{ item }}'
with_items:
- client-trusty.seed
- docenti-trusty.seed
@ -69,7 +64,7 @@
- name: Copia script post-installazione
template:
src: 'preseed/{{ item }}'
dest: '/var/lib/nethserver/ibay/ks/preseed/{{ item }}'
dest: '/var/www/html/ks/preseed/{{ item }}'
with_items:
- postseed-client.sh
- postseed-docenti.sh

View File

@ -5,31 +5,31 @@
- name: Creating base directory for storing repositories files
file:
path: /var/lib/nethserver/ibay/ks/repoconfig
path: /var/www/html/repoconfig
state: directory
owner: root
group: root
group: locals
mode: 0755
become: yes
- name: Preconfiguring base repositories file for clients
template:
src: repoconfig/sources.list
dest: /var/lib/nethserver/ibay/ks/repoconfig/sources.list
dest: /var/www/html/repoconfig/sources.list
owner: root
group: root
group: locals
mode: 0644
become: yes
- name: Preconfiguring other repositories for clients
template:
src: "repoconfig/{{ item }}"
dest: "/var/lib/nethserver/ibay/ks/repoconfig/{{ item }}"
dest: "/var/www/html/repoconfig/{{ item }}"
owner: root
group: root
group: locals
mode: 0644
with_items:
- bglug-trusty.list
- libreschool-trusty.list
- ansible-ansible-trusty.list
- libreoffice-ppa-trusty.list
- epoptes-ppa-trusty.list
@ -39,6 +39,6 @@
- name: Pre-downloading geogebra GPG signature because of HTTPS
get_url:
url: "https://www.geogebra.net/linux/office@geogebra.org.gpg.key"
dest: "/var/lib/nethserver/ibay/ks/repoconfig/office_geogebra.gpg.key"
dest: "/var/www/html/repoconfig/office_geogebra.gpg.key"
validate_certs: no
become: yes

View File

@ -1,10 +1,7 @@
---
# TFTP
- name: Installing TFTP
yum:
name: nethserver-tftp
state: present
# TFTP is included in DHCP module in NethServer 7
- name: Checking TFTP configuration
shell: /sbin/e-smith/db configuration getprop dnsmasq dhcp-boot
@ -13,7 +10,7 @@
ignore_errors: yes
- name: Configuring TFTP
shell: /sbin/e-smith/db configuration setprop dnsmasq tftp-status enabled dhcp-boot pxelinux.0
shell: /sbin/e-smith/db configuration setprop dnsmasq dhcp-boot pxelinux.0
when: chk_tftp_enabled|changed
- name: Activating tftp

View File

@ -7,29 +7,21 @@
state: absent
become: yes
- name: Forcing recreation of {{ extnic }}
shell: "INTERFACE=eth0 MATCHADDR={{ ansible_eth0.macaddress }} INTERFACE_NAME={{ extnic }} /lib/udev/write_net_rules"
become: yes
- name: Forcing recreation of {{ intnic }}
shell: "INTERFACE=eth1 MATCHADDR={{ ansible_eth1.macaddress }} INTERFACE_NAME={{ intnic }} /lib/udev/write_net_rules"
become: yes
- name: Pulizia vecchie interfacce
- name: Removing old interfaces from db networks
shell: "/sbin/e-smith/db networks delete {{ item }}"
become: yes
with_items:
- eth0
- eth1
- name: Creo interfaccia esterna in NethServer
shell: /sbin/e-smith/db networks set {{ extnic }} ethernet bootproto dhcp device {{ extnic }} hwaddr {{ ansible_eth0.macaddress }} onboot yes peerdns yes role red
- name: Configuring new external interface
shell: "/sbin/e-smith/db networks set {{ extnic }} ethernet bootproto dhcp device {{ extnic }} hwaddr {{ ansible_eth0.macaddress }} onboot yes role red"
become: yes
- name: Creo interfaccia interna in NethServer
shell: /sbin/e-smith/db networks set {{ intnic }} ethernet bootproto none device {{ intnic }} hwaddr {{ ansible_eth1.macaddress }} ipaddr 172.16.254.1 netmask 255.255.255.0 onboot yes role green
- name: Configuring new internal interface
shell: "/sbin/e-smith/db networks set {{ intnic }} ethernet bootproto none device {{ intnic }} hwaddr {{ ansible_eth1.macaddress }} ipaddr 172.16.253.1 netmask 255.255.255.0 onboot yes role green"
become: yes
- name: Trigger interfaces configuration
shell: "ifdown eth0; ifdown eth1; udevadm control --reload-rules && udevadm trigger; /sbin/e-smith/signal-event interface-update"
- name: Trigger interfaces configuration change
shell: "ip link set eth0 down; ip link set eth0 name {{ extnic }}; ip link set eth1 down; ip link set eth1 name {{ intnic }}; /sbin/e-smith/signal-event interface-update; /sbin/e-smith/signal-event firewall-adjust"
become: yes

View File

@ -10,32 +10,16 @@
become: yes
tags: ansible
- name: Checking for python-argparse
shell: rpm -q python-argparse
become: yes
register: check_argparse
ignore_errors: yes
changed_when: "check_argparse.rc == 1"
tags: ansible
- name: Installazione python-argparse
yum:
name: python-argparse
state: present
become: yes
when: check_argparse|changed
tags: ansible
#- name: Download della gestione client con ansible
# git:
# repo: "https://github.com/bglug-it/ps-clientmgmt.git"
# dest: /home/amgmt/clientmgmt
# tags:
# - git
# - ansible
#
#- name: Attivo sotto modulo ansdyninv
# shell: cd /home/amgmt/clientmgmt/ansdyninv; git submodule init && git submodule update
# tags:
# - git
# - ansible
#- name: Download della gestione client con ansible
# git:
# repo: "https://github.com/bglug-it/ps-clientmgmt.git"
# dest: /home/amgmt/clientmgmt
# tags:
# - git
# - ansible
#
#- name: Attivo sotto modulo ansdyninv
# shell: cd /home/amgmt/clientmgmt/ansdyninv; git submodule init && git submodule update
# tags:
# - git
# - ansible

View File

@ -1,39 +1,5 @@
---
- name: Verifica abilitazione repo Extra
shell: yum repolist
register: check_epel
failed_when: "'Extra Packages for Enterprise Linux 6' not in check_epel.stdout"
ignore_errors: yes
- name: Installo epel-release
yum: name=epel-release state=present
become: yes
when: check_epel|failed
register: epel_installed
ignore_errors: yes
- name: Installo epel-release da URL
yum:
name: "http://dl.fedoraproject.org/pub/epel/6/{{ ansible_architecture }}/epel-release-6-8.noarch.rpm"
state: present
become: yes
when: epel_installed|failed
register: rpm_epel_installed
- name: Abilito il repo EPEL
shell: yum-config-manager --enable epel
become: yes
when: epel_installed|changed or epel_installed|success or rpm_epel_installed|changed
changed_when: "'[epel]' in epel_enabled.stdout and epel_enabled.rc == 0"
register: epel_enabled
- name: Pulizia e ricaricam. repo
shell: yum clean all && yum repolist
become: yes
when: epel_enabled|changed
tags: repo
- name: Aggiorno il sistema
yum: name=* state=latest
become: yes

View File

@ -0,0 +1,7 @@
---
# We should install here the LibreSchool repos.
- name: Install LibreSchool package repo
yum:
url: "https://repo.libreschool.org/nethserver/7/base/x86_64/Packages/libreschool-release-1.0-1.noarch.rpm"
state: present

View File

@ -8,14 +8,12 @@
tags: lock-nethrelease
- include: centos_pkgs.yml
when: ansible_distribution == "CentOS" and ansible_os_family == "RedHat"
tags: centos
- include: pvtrepo.yml
tags: bglug
#- include: libreschool-repo.yml
# tags: libreschool
- include: ansible.yml
when: ansible_distribution == "CentOS"
tags:
- git
- ansible

View File

@ -1,10 +0,0 @@
---
- name: Installazione istruzioni per repo.bglug.it
copy:
src: bglug.repo
dest: /etc/yum.repos.d/bglug.repo
become: yes
- name: Ricalcolo repository disponibili
shell: yum repolist
become: yes