Compare commits

..

14 Commits
master ... v7

49 changed files with 420 additions and 747 deletions

146
Vagrantfile vendored
View File

@ -1,141 +1,29 @@
# -*- mode: ruby -*- # -*- mode: ruby -*-
# vi: set ft=ruby : # vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2" VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 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: # 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| config.vm.define myname do |nethserver|
end nethserver.vm.box = "syntaxerrormmm/nethserver-7"
config.vm.provider :virtualbox do |vb| nethserver.vm.box_url = "https://vagrant.libreschool.org/nethserver-7"
vb.name = myname
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 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 end

View File

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

View File

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

2
hosts
View File

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

View File

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

View File

@ -41,7 +41,7 @@
shell: pushd /var/lib/git-daemon/repositories/client-pull-installation.git; git fetch -p origin; popd shell: pushd /var/lib/git-daemon/repositories/client-pull-installation.git; git fetch -p origin; popd
become: yes become: yes
become_user: git-daemon become_user: git-daemon
when: chk_clientpullinstall_repo is succeeded when: chk_clientpullinstall_repo|success
tags: tags:
- git-daemon-update - git-daemon-update
@ -51,7 +51,7 @@
shell: git clone --mirror {{ client_gitrepo }} /var/lib/git-daemon/repositories/client-pull-installation.git shell: git clone --mirror {{ client_gitrepo }} /var/lib/git-daemon/repositories/client-pull-installation.git
become: yes become: yes
become_user: git-daemon become_user: git-daemon
when: chk_clientpullinstall_repo is changed when: chk_clientpullinstall_repo|changed
- name: Rendo il repository esportabile - name: Rendo il repository esportabile
file: file:
@ -94,7 +94,7 @@
- name: Aggiungo servizio a gestione NethServer - name: Aggiungo servizio a gestione NethServer
shell: /sbin/e-smith/db configuration set git-daemon service status enabled TCPPort 9418 access private shell: /sbin/e-smith/db configuration set git-daemon service status enabled TCPPort 9418 access private
become: yes become: yes
when: chk_gitdaemon_srv is changed when: chk_gitdaemon_srv|changed
- name: Creazione directory defaults per NethServer - name: Creazione directory defaults per NethServer
file: file:
@ -102,7 +102,7 @@
recurse: yes recurse: yes
state: directory state: directory
become: yes become: yes
when: chk_gitdaemon_srv is changed when: chk_gitdaemon_srv|changed
- name: Creazione tipo default per NethServer - name: Creazione tipo default per NethServer
lineinfile: lineinfile:
@ -112,7 +112,7 @@
create: yes create: yes
state: present state: present
become: yes become: yes
when: chk_gitdaemon_srv is changed when: chk_gitdaemon_srv|changed
- name: Creazione stato default per NethServer - name: Creazione stato default per NethServer
lineinfile: lineinfile:
@ -122,19 +122,19 @@
create: yes create: yes
state: present state: present
become: yes become: yes
when: chk_gitdaemon_srv is changed when: chk_gitdaemon_srv|changed
- name: Aggiunta servizio - name: Aggiunta servizio
shell: /sbin/e-smith/signal-event runlevel-adjust shell: /sbin/e-smith/signal-event runlevel-adjust
become: yes become: yes
when: chk_gitdaemon_srv is changed when: chk_gitdaemon_srv|changed
- name: Aggiunta servizio di rete e cambio firewall - name: Aggiunta servizio di rete e cambio firewall
shell: /sbin/e-smith/signal-event firewall-adjust shell: /sbin/e-smith/signal-event firewall-adjust
become: yes become: yes
when: chk_gitdaemon_srv is changed when: chk_gitdaemon_srv|changed
- name: Avvio servizio - name: Avvio servizio
shell: service git-daemon start shell: service git-daemon start
become: yes become: yes
when: chk_gitdaemon_srv is changed when: chk_gitdaemon_srv|changed

View File

@ -23,14 +23,14 @@
owner: root owner: root
group: root group: root
mode: 0755 mode: 0755
when: chk_mount_nfs is changed when: chk_mount_nfs|changed
- name: Adding mountpoint to fstab - name: Adding mountpoint to fstab
lineinfile: lineinfile:
dest: /etc/fstab dest: /etc/fstab
line: "{{ ansible_local.domain.mirror_nfs_share }} /var/spool/apt-mirror/mirror nfs4 defaults 0 0" line: "{{ ansible_local.domain.mirror_nfs_share }} /var/spool/apt-mirror/mirror nfs4 defaults 0 0"
when: chk_mount_nfs is changed when: chk_mount_nfs|changed
- name: Mounting share - name: Mounting share
shell: mount /var/spool/apt-mirror/mirror shell: mount /var/spool/apt-mirror/mirror
when: chk_mount_nfs is changed when: chk_mount_nfs|changed

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 state: present
tags: nethgui 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 - name: Configuring hostname
shell: /sbin/e-smith/db networks printprop {{ ansible_local.domain.servernet }} Description shell: /sbin/e-smith/db configuration set SystemName {{ ansible_local.domain.server }}
register: check_trusted when: hostnamechg|changed
changed_when: '"Description=Local LAN" not in check_trusted.stdout'
ignore_errors: yes
tags: trustednet
- name: Configuring trusted networks - name: Configuring domain name
shell: /sbin/e-smith/db networks set {{ ansible_local.domain.servernet }} network Description "Local LAN" Mask {{ ansible_local.domain.servernetmask }} shell: /sbin/e-smith/db configuration set DomainName {{ ansible_local.domain.domainfull }}
when: check_trusted is changed when: hostnamechg|changed
tags: trustednet
- name: Activating trusted network - name: Activating hostname/domainname changes
shell: /sbin/e-smith/signal-event trusted-networks-modify shell: /sbin/e-smith/signal-event hostname-modify
when: check_trusted is changed when: hostnamechg|changed
tags: trustednet
# Preconfiguring DNS anyways
# DNS configuration
- name: Checking DNS configuration - name: Checking DNS configuration
shell: /sbin/e-smith/db configuration printprop dns NameServers shell: /sbin/e-smith/db configuration printprop dns NameServers
register: chk_dns register: chk_dns
@ -38,36 +36,14 @@
- name: Configuring DNS resolution - name: Configuring DNS resolution
shell: /sbin/e-smith/db configuration setprop dns NameServers {{ ansible_local.domain.extdnsserver1 }},{{ ansible_local.domain.extdnsserver2 }} shell: /sbin/e-smith/db configuration setprop dns NameServers {{ ansible_local.domain.extdnsserver1 }},{{ ansible_local.domain.extdnsserver2 }}
when: chk_dns is changed when: chk_dns|changed
tags: dns-preset tags: dns-preset
- name: Activating correct DNS resolution - name: Activating correct DNS resolution
shell: "/sbin/e-smith/signal-event nethserver-base-update" shell: "/sbin/e-smith/signal-event nethserver-base-update"
when: chk_dns is changed 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 is changed or chg_domainname is changed
tags:
- hostname
- domainname
# Base certificate # Base certificate
- name: Checking CA configuration - name: Checking CA configuration
shell: /sbin/e-smith/db configuration printprop pki CommonName shell: /sbin/e-smith/db configuration printprop pki CommonName
ignore_errors: true ignore_errors: true
@ -78,9 +54,13 @@
- name: Configuring CA - name: Configuring CA
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 }}" 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 }}"
tags: regen-ca tags: regen-ca
when: chk_crt is changed or force_regen_ca|bool when: chk_crt|changed or force_regen_ca|bool
- name: Activating CA and regenerate - name: Activating CA and regenerate
shell: /sbin/e-smith/signal-event certificate-update shell: /sbin/e-smith/signal-event certificate-update
when: chk_crt is changed or force_regen_ca|bool when: chk_crt|changed or force_regen_ca|bool
tags: regen-ca 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 is failed
- name: Activating DHCP
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
when: chk_dhcp is 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 is 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 is changed
tags: force-resolvers
# Avahi
- name: Installing avahi-daemon
yum:
name: nethserver-avahi
state: present

View File

@ -1,42 +0,0 @@
---
# 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 is changed
tags: password-policy
- name: Activating password policy
shell: /sbin/e-smith/signal-event password-policy-update
when: chk_passstr is 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 is changed
- name: Activating organization configuration
shell: /sbin/e-smith/signal-event organization-save
when: check_org is changed

View File

@ -1,47 +1,24 @@
--- ---
# Domain groups # 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 is failed
- name: domusers - Activating group
shell: /sbin/e-smith/signal-event group-create domusers
when: check_domusers is failed
# Domain Operators # Domain Operators
- name: domopers - Checking for group - name: domopers - Checking for group
shell: /sbin/e-smith/db accounts show domopers shell: /bin/getent group domopers
register: check_domopers register: check_domopers
ignore_errors: true 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 is failed
- name: domopers - Activating group - name: domopers - Activating group
shell: /sbin/e-smith/signal-event group-create domopers shell: /sbin/e-smith/signal-event group-create domopers
when: check_domopers is failed when: check_domopers|failed
# Docenti # Docenti
- name: docenti - Checking for group - name: docenti - Checking for group
shell: /sbin/e-smith/db accounts show docenti shell: /bin/getent group docenti
register: check_docenti register: check_docenti
ignore_errors: true ignore_errors: true
- name: docenti - Creating new group
shell: /sbin/e-smith/db accounts set docenti group Description "Docenti" Removable no
when: check_docenti is failed
- name: docenti - Activating group - name: docenti - Activating group
shell: /sbin/e-smith/signal-event group-create docenti shell: /sbin/e-smith/signal-event group-create docenti
when: check_docenti is failed when: check_docenti|failed

View File

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

View File

@ -1,24 +1,33 @@
--- ---
# Network time protocol # Network time protocol
- name: Installing NTP related packages. # Timezone
yum: - name: Configuring timezone
name: nethserver-ntp shell: /sbin/e-smith/db configuration set TimeZone "Europe/Rome"
state: present 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 - 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 become: yes
register: chk_ntp register: chk_ntp
changed_when: "'NTPServer=ntp1.inrim.it' not in chk_ntp.stdout" changed_when: "'NTPServer=ntp1.inrim.it' not in chk_ntp.stdout"
ignore_errors: true ignore_errors: true
- name: Configuring NTP - 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 become: yes
when: chk_ntp is changed when: chk_ntp|changed
- name: Activating NTP - name: Activating NTP
shell: /sbin/e-smith/signal-event nethserver-ntp-update shell: /sbin/e-smith/signal-event nethserver-ntp-save
become: yes become: yes
when: chk_ntp is changed when: chk_ntp|changed

View File

@ -0,0 +1,16 @@
---
# Organization
- 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
- 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
- name: Activating organization configuration
shell: /sbin/e-smith/signal-event organization-save
when: check_org|changed

View File

@ -3,13 +3,10 @@
- name: Installing other small services - name: Installing other small services
yum: yum:
name: "{{ item }}" name:
- nethserver-cups
- nethserver-collectd
- nethserver-firewall-base-ui
- nethserver-backup-config
- nethserver-backup-data
state: present 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 # Proxy and webfiltering configurations
- name: Installing proxy-related packages - name: Installing proxy-related packages
yum: yum:
name: "{{ item }}" name:
- nethserver-squid
- nethserver-squidclamav
- nethserver-squidguard
state: present state: present
with_items:
- nethserver-squid
- nethserver-squidclamav
- nethserver-squidguard
# Squid # Squid
@ -20,47 +18,55 @@
- name: Configuring Squid - name: Configuring Squid
shell: /sbin/e-smith/db configuration setprop squid BlueMode transparent GreenMode transparent PortBlock disabled status enabled DiskCache enabled DiskCacheSize 2000 shell: /sbin/e-smith/db configuration setprop squid BlueMode transparent GreenMode transparent PortBlock disabled status enabled DiskCache enabled DiskCacheSize 2000
when: chk_squid is changed when: chk_squid|changed
- name: Activating Squid configuration - 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 is changed 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 is changed
- name: Activating squidclamav
shell: /sbin/e-smith/signal-event nethserver-squidclamav-update
when: chk_squidclamav is changed
# SquidGuard # SquidGuard
- name: Verifying squidguard configuration - name: Verifying squidguard configuration
shell: /sbin/e-smith/db configuration printprop squidguard status shell: /sbin/e-smith/db configuration printprop squidguard status
register: check_squidguard register: check_squidguard
ignore_errors: true ignore_errors: true
changed_when: '"status=enabled" not in check_squidguard.stdout' 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 - 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 is changed when: check_squidguard|changed
- name: Activating squidguard configuration - name: Activating squidguard configuration
shell: "/sbin/e-smith/signal-event nethserver-squidguard-{{ item }}" shell: "/sbin/e-smith/signal-event nethserver-squidguard-{{ item }}"
with_items: with_items:
- save - save
- update
- downloadlists - downloadlists
when: check_squidguard is changed 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 # Content filtering settings
@ -70,10 +76,10 @@
changed_when: "'sex' not in check_cf.stdout" changed_when: "'sex' not in check_cf.stdout"
- name: Configuring content filtering - 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 register: cf_cat
when: check_cf is changed when: check_cf|changed
- name: Activating content filtering as a whole - 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 is changed when: check_cf|changed

View File

@ -4,20 +4,26 @@
- name: Installing SAMBA and ibays packages - name: Installing SAMBA and ibays packages
yum: yum:
name: "{{ item }}" name:
- "@nethserver-file-server"
- nethserver-samba-audit
state: present state: present
with_items:
- nethserver-ibays
- nethserver-samba
- nethserver-samba-audit
# SAMBA # SAMBA
- name: "Verifying modifications on templates-custom." - name: Checking for default SAMBA behaviour
shell: grep -q 'server signing = mandatory' /etc/e-smith/templates-custom/etc/samba/smb.conf/10global shell: /sbin/e-smith/db configuration getprop smb HomeAdmStatus
register: check_tempcust register: check_smbbehavior
changed_when: check_tempcust.rc != 0 changed_when: "'enabled' not in check_smbbehavior"
ignore_errors: true 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" - name: "Create directory structure for templates-custom"
file: file:
@ -26,7 +32,7 @@
group: root group: root
mode: 0755 mode: 0755
state: directory state: directory
when: check_tempcust is changed register: check_tempcust
- name: "Copying settings from default." - name: "Copying settings from default."
copy: copy:
@ -36,106 +42,82 @@
owner: root owner: root
group: root group: root
mode: 0644 mode: 0644
when: check_tempcust is changed when: check_tempcust|changed
- name: "Enabling unix extensions on SAMBA" - name: "Enabling unix extensions on SAMBA"
replace: lineinfile:
dest: /etc/e-smith/templates-custom/etc/samba/smb.conf/10global dest: /etc/e-smith/templates-custom/etc/samba/smb.conf/10global
regexp: '^unix extensions = no$' line: 'unix extensions = yes'
replace: 'unix extensions = yes' state: present
when: check_tempcust is changed insertafter: EOF
when: check_tempcust|changed
- name: Adding server signing as mandatory - name: Adding server signing as mandatory
lineinfile: lineinfile:
dest: /etc/e-smith/templates-custom/etc/samba/smb.conf/10global dest: /etc/e-smith/templates-custom/etc/samba/smb.conf/10global
line: "server signing = mandatory" line: "server signing = mandatory"
insertafter: "^workgroup = "
state: present state: present
when: check_tempcust is changed insertafter: EOF
when: check_tempcust|changed
- name: Checking SMB configuration - name: Applying custom configurations to running SAMBA
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 is changed
- name: Activating SMB
shell: /sbin/e-smith/signal-event nethserver-samba-save shell: /sbin/e-smith/signal-event nethserver-samba-save
when: chk_smb is changed become: yes
when: check_tempcust|changed
# ibays # 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 - name: Checking for shared ibay
shell: /sbin/e-smith/db accounts show shared shell: /sbin/e-smith/db accounts show shared
ignore_errors: true ignore_errors: true
register: chk_shared register: chk_shared
- name: Copying default templates for shared template type #- 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 # 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 is failed # when: force_ibay_shared|bool or chk_shared|failed
#
- name: Configuring ibay-shared template structure (directory mask) #- name: Configuring ibay-shared template structure (directory mask)
lineinfile: # lineinfile:
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default # dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
line: 'directory mask = 0775' # line: 'directory mask = 0775'
insertafter: '^create mask' # insertafter: '^create mask'
state: present # state: present
when: force_ibay_shared|bool or chk_shared is failed # when: force_ibay_shared|bool or chk_shared|failed
#
- name: Configuring force create mode #- name: Configuring force create mode
lineinfile: # lineinfile:
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default # dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
line: 'force create mode = 0664' # line: 'force create mode = 0664'
insertafter: '^directory mask' # insertafter: '^directory mask'
state: present # state: present
when: force_ibay_shared|bool or chk_shared is failed # when: force_ibay_shared|bool or chk_shared|failed
#
- name: Configuring force directory mode #- name: Configuring force directory mode
lineinfile: # lineinfile:
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default # dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
line: 'force directory mode = 0775' # line: 'force directory mode = 0775'
insertafter: '^force create mode' # insertafter: '^force create mode'
state: present # state: present
when: force_ibay_shared|bool or chk_shared is failed # when: force_ibay_shared|bool or chk_shared|failed
- name: Configuring shared ibay - 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 is failed when: chk_shared|failed
- name: Activating shared ibay - name: Activating shared ibay
shell: /sbin/e-smith/signal-event ibay-create shared shell: /sbin/e-smith/signal-event ibay-create shared
become: yes become: yes
when: chk_shared is failed when: chk_shared|failed
- name: Changing ibay profile for shared #- name: Changing ibay profile for shared
shell: /sbin/e-smith/db accounts setprop shared SmbProfileType shared # shell: /sbin/e-smith/db accounts setprop shared SmbProfileType shared
become: yes # become: yes
when: force_ibay_shared|bool or chk_shared is failed # when: force_ibay_shared|bool or chk_shared|failed
- name: Saving new version of smb.conf #- name: Forcing regeneration of smb.conf
shell: /sbin/e-smith/signal-event nethserver-samba-save # shell: /sbin/e-smith/signal-event nethserver-samba-update
become: yes # become: yes
when: check_tempcust is changed # 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 is failed or check_tempcust is changed
# Fixing issue #3 - Configure sudo access for admin on server for operator # Fixing issue #3 - Configure sudo access for admin on server for operator
# access # access
@ -143,7 +125,7 @@
- name: Configuring sudo access for admin account - name: Configuring sudo access for admin account
lineinfile: lineinfile:
dest: /etc/sudoers.d/admin dest: /etc/sudoers.d/admin
line: 'admin ALL=(ALL:ALL) NOPASSWD: ALL' line: 'admin@{{ ansible_local.domain.domainfull }} ALL=(ALL) NOPASSWD: ALL'
create: yes create: yes
owner: root owner: root
group: root group: root

View File

@ -9,7 +9,7 @@
- name: Creo directory per certificati - name: Creo directory per certificati
file: file:
path: /var/lib/nethserver/ibay/ks/server-ca path: /var/www/html/server-ca
state: directory state: directory
owner: root owner: root
mode: 0755 mode: 0755
@ -18,13 +18,13 @@
- name: 'Utilizzo cert8.db precedentemente fornito (pulito da FF appena aperto)' - name: 'Utilizzo cert8.db precedentemente fornito (pulito da FF appena aperto)'
copy: copy:
src: cert8.db src: cert8.db
dest: /var/lib/nethserver/ibay/ks/server-ca/cert8.db dest: /var/www/html/server-ca/cert8.db
owner: root owner: root
mode: 0644 mode: 0644
become: yes become: yes
- name: Integro la CA nel db - 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 become: yes
- name: Pulizia - name: Pulizia
@ -32,5 +32,5 @@
become: yes become: yes
with_items: with_items:
- /tmp/ca.crt - /tmp/ca.crt
- /var/lib/nethserver/ibay/ks/server-ca/key3.db - /var/www/html/server-ca/key3.db
- /var/lib/nethserver/ibay/ks/server-ca/secmod.db - /var/www/html/server-ca/secmod.db

View File

@ -17,8 +17,3 @@
- include: firefoxcert.yml - include: firefoxcert.yml
tags: tags:
- firefox - firefox
- include: paperms.yml
tags:
- preseed
- paperms

View File

@ -1,25 +0,0 @@
---
# Installing fixes final fixes for PulseAudio permissions.
- name: Creating paperms subdir inside ks/preseed share
file:
path: /var/lib/nethserver/ibay/ks/paperms
state: directory
owner: root
group: locals
mode: 0755
become: yes
- name: Deploy template files for paperms
template:
src: "paperms/{{ item }}"
dest: "/var/lib/nethserver/ibay/ks/paperms/{{ item }}"
owner: root
group: locals
mode: 0644
with_items:
- updategrp.py
- paperms.sh
- cronjob
- logrotate
become: yes

View File

@ -5,44 +5,39 @@
edu_package: "{{ ansible_local.domain.edu_package }}" edu_package: "{{ ansible_local.domain.edu_package }}"
when: ansible_local.domain.edu_package is defined when: ansible_local.domain.edu_package is defined
- name: Verifica configurazione ibay preseed # Since NS7 web folders are not anymore managed using ibays.
shell: /sbin/e-smith/db accounts show ks # I have to correct the issue creating manual folder and assigning correct
register: chk_ks_created # permissions.
changed_when: chk_ks_created.rc != 0
ignore_errors: yes
become: yes
- name: Configurazione web preseed - name: Creating the kickstart folder
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 file:
when: chk_ks_created is failed path: /var/www/html/ks
become: yes state: directory
owner: root
- name: Attivazione web preseed group: locals
shell: /sbin/e-smith/signal-event ibay-create ks mode: 0755
when: chk_ks_created is 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: Collegamento directory mirror - 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 become: yes
when: chk_mirror_dir is succeeded when: ansible_local.domain.mirror_mode == 'local' or ansible_local.domain.mirror_mode == 'nfs'
- name: Creazione directory preseed - name: Creazione directory preseed
file: file:
path: "/var/lib/nethserver/ibay/ks/preseed" path: "/var/www/html/ks/preseed"
state: directory state: directory
owner: root
group: local
mode: 0755
become: yes become: yes
- name: Copia profili preseed - name: Copia profili preseed
template: template:
src: 'preseed/{{ item }}' src: 'preseed/{{ item }}'
dest: '/var/lib/nethserver/ibay/ks/preseed/{{ item }}' dest: '/var/www/html/ks/preseed/{{ item }}'
with_items: with_items:
- edubuntu.seed - edubuntu.seed
- client-trusty.seed - client-trusty.seed
@ -53,13 +48,13 @@
- block: - block:
- name: Creating development directory - name: Creating development directory
file: file:
path: "/var/lib/nethserver/ibay/ks/preseed/dev" path: "/var/www/html/ks/preseed/dev"
state: directory state: directory
- name: Preseeding profiles - development - name: Preseeding profiles - development
template: template:
src: 'preseed/dev/{{ item }}' src: 'preseed/dev/{{ item }}'
dest: '/var/lib/nethserver/ibay/ks/preseed/dev/{{ item }}' dest: '/var/www/html/ks/preseed/dev/{{ item }}'
with_items: with_items:
- client-trusty.seed - client-trusty.seed
- docenti-trusty.seed - docenti-trusty.seed
@ -69,10 +64,11 @@
- name: Copia script post-installazione - name: Copia script post-installazione
template: template:
src: 'preseed/{{ item }}' src: 'preseed/{{ item }}'
dest: '/var/lib/nethserver/ibay/ks/preseed/{{ item }}' dest: '/var/www/html/ks/preseed/{{ item }}'
with_items: with_items:
- postseed-client.sh - postseed-client.sh
- postseed-docenti.sh - postseed-docenti.sh
- postseed-aula.sh - postseed-aula.sh
- pulseaudio-perms.sh
- checksum.fact - checksum.fact
become: yes become: yes

View File

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

View File

@ -1 +0,0 @@
@reboot root /var/lib/{{ ansible_local.domain.domainfull }}/bin/paperms.sh >> /var/log/paperms.log 2>&1

View File

@ -1,7 +0,0 @@
/var/log/paperms.log {
rotate 7
daily
compress
missingok
notifempty
}

View File

@ -1,34 +0,0 @@
#!/bin/bash
# Fixing base variables
basedir=/var/lib/{{ ansible_local.domain.domainfull }}
# Making sure destination folder exists.
/usr/bin/install -d -o root -g users ${basedir}/bin
# Update this script itself
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/paperms/paperms.sh -O ${basedir}/bin/paperms.sh
/bin/chown root:users ${basedir}/bin/paperms.sh
/bin/chmod a+x ${basedir}/bin/paperms.sh
# Updating cronjob
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/paperms/cronjob -O /etc/cron.d/paperms
/bin/chown root:root /etc/cron.d/paperms
/bin/chmod 0644 /etc/cron.d/paperms
# Removing old versions of the cronjob
rm -f /etc/cron.d/pulseaudio-perms
# Updating logrotate
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/paperms/logrotate -O /etc/logrotate.d/paperms
/bin/chown root:root /etc/logrotate.d/paperms
/bin/chmod 0644 /etc/logrotate.d/paperms
# Updating updategrp.py
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/paperms/updategrp.py -O ${basedir}/bin/updategrp.py
/bin/chown root:users ${basedir}/bin/updategrp.py
/bin/chmod a+x ${basedir}/bin/updategrp.py
# Main part: run updategrp.py
/usr/bin/wbinfo -t && /usr/bin/python2 ${basedir}/bin/updategrp.py "domain users" "pulse" || echo "Not in domain."
/usr/bin/wbinfo -t && /usr/bin/python2 ${basedir}/bin/updategrp.py "domain users" "pulse-access" || echo "Not in domain."

View File

@ -1,74 +0,0 @@
#!/usr/bin/env python2
from __future__ import print_function
import grp
import re
from subprocess import check_output
from sys import argv
class UpdateGrp:
def __init__(self, leftname = "domain users", rightname = "pulse"):
"""Confronts members of the LHS group with the members of the RHS group. LHS group defaults to "domain users"."""
self.leftname = leftname
self.rightname = rightname
self.leftmembers = grp.getgrnam(self.leftname)[3]
self.rightmembers = grp.getgrnam(self.rightname)[3]
# Since there is also a local user already created on the machine but
# it is not a domain user, we will add it to leftmembers
self.leftmembers.append("bglug")
self.to_add = list(set(self.leftmembers) - set(self.rightmembers))
self.to_remove = list(set(self.rightmembers) - set(self.leftmembers))
def update_rhs(self):
"""Updates the RHS group members to be equal to the LHS group members."""
# If RHS is a local group
with open('/etc/group', 'r') as group:
for grp in group.readlines():
if re.match("%s:" % self.rightname, grp):
# If to_add is not empty, add each element to group
if len(self.to_add) > 0:
for user in self.to_add:
print(check_output(["gpasswd", "-a", user, self.rightname]), end='')
# If to_remove is not empty, remove each element to group
if len(self.to_remove) > 0:
for user in self.to_remove:
print(check_output(["gpasswd", "-d", user, self.rightname]), end='')
def update_lhs(self):
"""Updates the LHS group members to be equal to the RHS group members."""
# If LHS is a local group
with open('/etc/group', 'r') as group:
for grp in group.readline():
if re.match("%s:" % self.leftname, grp):
# If to_remove is not empty, add each element to group
if len(self.to_remove) > 0:
for user in self.to_remove:
print(check_output(["gpasswd", "-a", user, self.leftname]), end='')
# If to_add is not empty, remove each element to group
if len(self.to_add) > 0:
for user in self.to_add:
print(check_output(["gpasswd", "-d", user, self.leftname]), end='')
def modprint(self):
"""Debug function to print only modifications."""
print("To add: ", end='')
print(self.to_add)
print("To remove: ", end='')
print(self.to_remove)
# When run interactively
if __name__ == '__main__':
# If the first argument is '--help' or '-h', or number of arguments less than 1 and more than 2, print help.
if len(argv) < 2 or len(argv) > 3 or argv[1] == '--help' or argv[1] == '-h':
print("Usage: %s <LHSgroup> <RHSgroup>" % argv[0])
print("Aligns RHS group members as LHS.")
else:
updgrp = UpdateGrp(argv[1], argv[2])
updgrp.update_rhs()

View File

@ -0,0 +1,27 @@
#!/bin/bash
domaingroup="domain users"
localgroups="pulse pulse-access"
baseusers="bglug"
domainusers="$(getent group "${domaingroup}" | awk 'BEGIN { FS = ":" } ; { print $4 }' | sed -e 's/,/ /g')"
users="${baseusers} ${domainusers}"
for group in ${localgroups}; do
actualusers=$(getent group '${group}' | awk 'BEGIN { FS = ":" }; { print $4 }' | sed -e 's/,/ /g')
# Removing users not in the group
for user in ${actualusers}; do
whuser=${user//[[:space:]]/}
echo "removing ${user}"
[[ "${users}" =~ "${whuser}" ]] || gpasswd -d "${whuser}" "${group}"
unset whuser
done
# Adding users to group
for user in ${users}; do
whuser=${user//[[:space:]]/}
[[ "${actualusers}" =~ "${whuser}" ]] || gpasswd -a "${whuser}" "${group}"
done
done

View File

@ -1,10 +1,7 @@
--- ---
# TFTP # TFTP
- name: Installing TFTP # TFTP is included in DHCP module in NethServer 7
yum:
name: nethserver-tftp
state: present
- name: Checking TFTP configuration - name: Checking TFTP configuration
shell: /sbin/e-smith/db configuration getprop dnsmasq dhcp-boot shell: /sbin/e-smith/db configuration getprop dnsmasq dhcp-boot
@ -13,9 +10,9 @@
ignore_errors: yes ignore_errors: yes
- name: Configuring TFTP - 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 is changed when: chk_tftp_enabled|changed
- name: Activating tftp - name: Activating tftp
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
when: chk_tftp_enabled is changed when: chk_tftp_enabled|changed

View File

@ -7,29 +7,21 @@
state: absent state: absent
become: yes become: yes
- name: Forcing recreation of {{ extnic }} - name: Removing old interfaces from db networks
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
shell: "/sbin/e-smith/db networks delete {{ item }}" shell: "/sbin/e-smith/db networks delete {{ item }}"
become: yes become: yes
with_items: with_items:
- eth0 - eth0
- eth1 - eth1
- name: Creo interfaccia esterna in NethServer - name: Configuring new external interface
shell: /sbin/e-smith/db networks set {{ extnic }} ethernet bootproto dhcp device {{ extnic }} hwaddr {{ ansible_eth0.macaddress }} onboot yes peerdns yes role red shell: "/sbin/e-smith/db networks set {{ extnic }} ethernet bootproto dhcp device {{ extnic }} hwaddr {{ ansible_eth0.macaddress }} onboot yes role red"
become: yes become: yes
- name: Creo interfaccia interna in NethServer - 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.254.1 netmask 255.255.255.0 onboot yes role green 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 become: yes
- name: Trigger interfaces configuration - name: Trigger interfaces configuration change
shell: "ifdown eth0; ifdown eth1; udevadm control --reload-rules && udevadm trigger; /sbin/e-smith/signal-event interface-update" 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 become: yes

View File

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

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 is 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 is failed
register: rpm_epel_installed
- name: Abilito il repo EPEL
shell: yum-config-manager --enable epel
become: yes
when: epel_installed is changed or epel_installed is succeeded or rpm_epel_installed is 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 is changed
tags: repo
- name: Aggiorno il sistema - name: Aggiorno il sistema
yum: name=* state=latest yum: name=* state=latest
become: yes 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

@ -15,4 +15,4 @@
- name: Locking nethserver-release version - name: Locking nethserver-release version
shell: yum versionlock add nethserver-release shell: yum versionlock add nethserver-release
when: chk_locked_nethrelease is changed when: chk_locked_nethrelease|changed

View File

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

View File

@ -7,7 +7,7 @@
- name: Creazione directory .ssh - name: Creazione directory .ssh
shell: mkdir -p $HOME/.ssh shell: mkdir -p $HOME/.ssh
when: check_sshdir is failed when: check_sshdir|failed
- name: Verifica chiave ssh - name: Verifica chiave ssh
shell: test -f $HOME/.ssh/id_rsa shell: test -f $HOME/.ssh/id_rsa
@ -17,4 +17,4 @@
- name: Gestione creazione chiave ssh - name: Gestione creazione chiave ssh
shell: ssh-keygen -t rsa -b 1024 -f $HOME/.ssh/id_rsa -N '' shell: ssh-keygen -t rsa -b 1024 -f $HOME/.ssh/id_rsa -N ''
when: check_key is failed when: check_key|failed