Separati compiti playbook init e setup. Prima spostata installazione pacchetti NethServer specifici spostati nel ruolo nethcfg.

This commit is contained in:
Emiliano Vavassori 2015-06-14 02:58:47 +02:00
parent 1bc97c7c01
commit 89db21fab3
17 changed files with 56 additions and 70 deletions

View File

@ -8,7 +8,7 @@ Qui sono presenti i files di configurazione per il server [NethServer](http://ww
Per configurarlo:
$ vim hosts
$ ansible-playbook init.yml -u root --ask-pass \
$ ansible-playbook init.yml --ask-pass \
-e "admin_sshkey=/path/to/id_rsa.pub"
$ ansible-playbook setup.yml
@ -21,10 +21,13 @@ lanciare i seguenti comandi:
$ cd /path/to/ps-srvmgt
$ vagrant up
Aggiornamento 14/06/2015: vengono provisionate via Vagrant e Ansible alcune
configurazioni dal Vagrantfile.
### To Do List ###
* Implementare PXE + Kickstart (manca test)
* Implementare configurazioni per repo Ubuntu
* Implementare configurazioni per repo Ubuntu (test)
* Implementare configurazioni generiche dominio server
* Implementare aggiornamento automatico del sistema via `ansible`
* Implementare backup

4
Vagrantfile vendored
View File

@ -126,4 +126,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# chef-validator, unless you changed the configuration.
#
# chef.validation_client_name = "ORGNAME-validator"
config.vm.provision "ansible" do |ansible|
ansible.inventory_path = "vagrant/hosts"
ansible.playbook = "vagrant/vagrant.yml"
end
end

5
hosts
View File

@ -1,8 +1,5 @@
[defaults]
host_key_checking=false
[localnet]
10.0.0.1 ansible_ssh_port=22 ansible_ssh_user=root
[server]
localhost ansible_ssh_port=2222 ansible_ssh_user=amgmt
10.0.0.1 ansible_ssh_user=amgmt

View File

@ -1,6 +1,6 @@
---
- hosts: localnet
- hosts: server
vars:
- ansible_ssh_user: root
roles:

View File

@ -1,7 +0,0 @@
---
- name: Configuro la scheda secondaria
shell: /sbin/e-smith/db networks setprop eth1 bootproto none device eth1 ipaddr 10.0.0.1 netmask 255.255.255.0 onboot yes role green
when: "'NethServer' in sysconfig_productname.stdout"
register: eth1_enabled
notify:
- interface update

View File

@ -1,13 +1,5 @@
---
- name: Verifica di NethServer
shell: /sbin/e-smith/config getprop sysconfig ProductName
register: sysconfig_productname
changed_when: "'NethServer' in sysconfig_productname.stdout"
ignore_errors: yes
- include: configure-networks.yml
when: sysconfig_productname|changed
# Task basilari per la prima configurazione
- include: selinux-binding.yml
when: ansible_os_family == "RedHat"

View File

@ -1,4 +1,4 @@
---
# Preconfigurazione selinux per host
- name: Binding Python per selinux
yum: name=libselinux-python state=present

View File

@ -1,6 +1,9 @@
---
# Configurazione principale di NethServer.
# Installo pacchetti addizionali
- include: neth_pkgs.yml
- name: Configurazione organizzazione
shell: /sbin/e-smith/db configuration setprop OrganizationContact City "{{ org_city }}" Company "{{ org_company }}" CountryCode {{ org_countrycode }} Department "{{ org_department }}" PhoneNumber "{{ org_phone }}" Street "{{ org_street }}"
sudo: yes

View File

@ -0,0 +1,17 @@
---
neth_pkgs:
- nethserver-tftp
- nethserver-ibays
- nethserver-samba
- nethserver-samba-audit
- nethserver-cups
- nethserver-avahi
- nethserver-dnsmasq
- nethserver-collectd
- nethserver-collectd-web
- nethserver-squid
- nethserver-squidclamav
- nethserver-squidguard
- nethserver-firewall-base
- nethserver-backup-config
- nethserver-backup-data

View File

@ -12,7 +12,3 @@
tags:
- git
- ansible
- include: neth_pkgs.yml
when: ansible_distribution == "CentOS" and ansible_os_family == "RedHat"
tags: neth

View File

@ -1,25 +0,0 @@
---
# Configurazioni a quanto pare non fattibili dall'interfaccia
- name: Configuro il servizio DNS come resolver
shell: /sbin/e-smith/db configuration setprop dns role resolver NameServers 208.67.222.222,208.67.220.220
sudo: yes
tags: dns
- name: Configuro sincronizzazione dell'ora con NTP1
shell: /sbin/e-smith/db configuration setprop ntpd NTPServer ntp1.inrim.it status enabled
sudo: yes
notify:
- ntp save
tags: ntp
- name: Lancio aggiornamenti del clamav
shell: /sbin/e-smith/signal-event nethserver-squidclamav-update
sudo: yes
tags: clamav
- name: "Configuro policy password: no strong"
shell: /sbin/e-smith/db configuration setprop passwordstrength PassExpires no Users none
sudo: yes
notify:
- password-policy-update
tags: policy

View File

@ -5,20 +5,3 @@ addin_pkgs:
- screen
- sshpass
- ansible
neth_pkgs:
- nethserver-tftp
- nethserver-ibays
- nethserver-samba
- nethserver-samba-audit
- nethserver-cups
- nethserver-avahi
- nethserver-dnsmasq
- nethserver-collectd
- nethserver-collectd-web
- nethserver-squid
- nethserver-squidclamav
- nethserver-squidguard
- nethserver-firewall-base
- nethserver-backup-config
- nethserver-backup-data

3
vagrant/hosts Normal file
View File

@ -0,0 +1,3 @@
# Generated by Vagrant
[vagrant]
NethServer ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant

View File

@ -0,0 +1,14 @@
---
# Provisioning per vagrant.
- name: Verifico versione server - NethServer
shell: /sbin/e-smith/db configuration getprop sysconfig ProductName
register: chk_nethserver
ignore_errors: yes
sudo: yes
- name: Configuro la scheda secondaria
shell: /sbin/e-smith/db networks setprop eth1 bootproto none device eth1 ipaddr 10.0.0.1 netmask 255.255.255.0 onboot yes role green
when: "'NethServer' in chk_nethserver.stdout"
sudo: yes
notify:
- interface update

6
vagrant/vagrant.yml Normal file
View File

@ -0,0 +1,6 @@
---
# Vagrant provisioning playbook
- hosts: vagrant
roles:
- vagrant
sudo: yes