Separati compiti playbook init e setup. Prima spostata installazione pacchetti NethServer specifici spostati nel ruolo nethcfg.
This commit is contained in:
parent
1bc97c7c01
commit
89db21fab3
@ -8,7 +8,7 @@ Qui sono presenti i files di configurazione per il server [NethServer](http://ww
|
|||||||
Per configurarlo:
|
Per configurarlo:
|
||||||
|
|
||||||
$ vim hosts
|
$ vim hosts
|
||||||
$ ansible-playbook init.yml -u root --ask-pass \
|
$ ansible-playbook init.yml --ask-pass \
|
||||||
-e "admin_sshkey=/path/to/id_rsa.pub"
|
-e "admin_sshkey=/path/to/id_rsa.pub"
|
||||||
$ ansible-playbook setup.yml
|
$ ansible-playbook setup.yml
|
||||||
|
|
||||||
@ -21,10 +21,13 @@ lanciare i seguenti comandi:
|
|||||||
$ cd /path/to/ps-srvmgt
|
$ cd /path/to/ps-srvmgt
|
||||||
$ vagrant up
|
$ vagrant up
|
||||||
|
|
||||||
|
Aggiornamento 14/06/2015: vengono provisionate via Vagrant e Ansible alcune
|
||||||
|
configurazioni dal Vagrantfile.
|
||||||
|
|
||||||
### To Do List ###
|
### To Do List ###
|
||||||
|
|
||||||
* Implementare PXE + Kickstart (manca test)
|
* Implementare PXE + Kickstart (manca test)
|
||||||
* Implementare configurazioni per repo Ubuntu
|
* Implementare configurazioni per repo Ubuntu (test)
|
||||||
* Implementare configurazioni generiche dominio server
|
* Implementare configurazioni generiche dominio server
|
||||||
* Implementare aggiornamento automatico del sistema via `ansible`
|
* Implementare aggiornamento automatico del sistema via `ansible`
|
||||||
* Implementare backup
|
* Implementare backup
|
||||||
|
4
Vagrantfile
vendored
4
Vagrantfile
vendored
@ -126,4 +126,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||||||
# chef-validator, unless you changed the configuration.
|
# chef-validator, unless you changed the configuration.
|
||||||
#
|
#
|
||||||
# chef.validation_client_name = "ORGNAME-validator"
|
# chef.validation_client_name = "ORGNAME-validator"
|
||||||
|
config.vm.provision "ansible" do |ansible|
|
||||||
|
ansible.inventory_path = "vagrant/hosts"
|
||||||
|
ansible.playbook = "vagrant/vagrant.yml"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
5
hosts
5
hosts
@ -1,8 +1,5 @@
|
|||||||
[defaults]
|
[defaults]
|
||||||
host_key_checking=false
|
host_key_checking=false
|
||||||
|
|
||||||
[localnet]
|
|
||||||
10.0.0.1 ansible_ssh_port=22 ansible_ssh_user=root
|
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
localhost ansible_ssh_port=2222 ansible_ssh_user=amgmt
|
10.0.0.1 ansible_ssh_user=amgmt
|
||||||
|
2
init.yml
2
init.yml
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- hosts: localnet
|
- hosts: server
|
||||||
vars:
|
vars:
|
||||||
- ansible_ssh_user: root
|
- ansible_ssh_user: root
|
||||||
roles:
|
roles:
|
||||||
|
@ -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
|
|
@ -1,13 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Verifica di NethServer
|
# Task basilari per la prima configurazione
|
||||||
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
|
|
||||||
|
|
||||||
- include: selinux-binding.yml
|
- include: selinux-binding.yml
|
||||||
when: ansible_os_family == "RedHat"
|
when: ansible_os_family == "RedHat"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
|
# Preconfigurazione selinux per host
|
||||||
- name: Binding Python per selinux
|
- name: Binding Python per selinux
|
||||||
yum: name=libselinux-python state=present
|
yum: name=libselinux-python state=present
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
# Configurazione principale di NethServer.
|
# Configurazione principale di NethServer.
|
||||||
|
|
||||||
|
# Installo pacchetti addizionali
|
||||||
|
- include: neth_pkgs.yml
|
||||||
|
|
||||||
- name: Configurazione organizzazione
|
- 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 }}"
|
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
|
sudo: yes
|
||||||
|
17
roles/nethcfg/vars/main.yml
Normal file
17
roles/nethcfg/vars/main.yml
Normal 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
|
@ -12,7 +12,3 @@
|
|||||||
tags:
|
tags:
|
||||||
- git
|
- git
|
||||||
- ansible
|
- ansible
|
||||||
|
|
||||||
- include: neth_pkgs.yml
|
|
||||||
when: ansible_distribution == "CentOS" and ansible_os_family == "RedHat"
|
|
||||||
tags: neth
|
|
||||||
|
@ -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
|
|
@ -5,20 +5,3 @@ addin_pkgs:
|
|||||||
- screen
|
- screen
|
||||||
- sshpass
|
- sshpass
|
||||||
- ansible
|
- 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
3
vagrant/hosts
Normal 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
|
14
vagrant/roles/vagrant/tasks/main.yml
Normal file
14
vagrant/roles/vagrant/tasks/main.yml
Normal 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
6
vagrant/vagrant.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# Vagrant provisioning playbook
|
||||||
|
- hosts: vagrant
|
||||||
|
roles:
|
||||||
|
- vagrant
|
||||||
|
sudo: yes
|
Loading…
x
Reference in New Issue
Block a user