diff --git a/README.md b/README.md index fee692f..e59175e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Vagrantfile b/Vagrantfile index 2d648ee..1ebd1a0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 diff --git a/hosts b/hosts index e28941b..b43c59b 100644 --- a/hosts +++ b/hosts @@ -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 diff --git a/init.yml b/init.yml index c41466e..73deca3 100644 --- a/init.yml +++ b/init.yml @@ -1,6 +1,6 @@ --- -- hosts: localnet +- hosts: server vars: - ansible_ssh_user: root roles: diff --git a/roles/init/tasks/configure-networks.yml b/roles/init/tasks/configure-networks.yml deleted file mode 100644 index 96ed901..0000000 --- a/roles/init/tasks/configure-networks.yml +++ /dev/null @@ -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 diff --git a/roles/init/tasks/main.yml b/roles/init/tasks/main.yml index ebfa79b..32bdeae 100644 --- a/roles/init/tasks/main.yml +++ b/roles/init/tasks/main.yml @@ -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" diff --git a/roles/init/tasks/selinux-binding.yml b/roles/init/tasks/selinux-binding.yml index 3a359e5..259d886 100644 --- a/roles/init/tasks/selinux-binding.yml +++ b/roles/init/tasks/selinux-binding.yml @@ -1,4 +1,4 @@ --- - +# Preconfigurazione selinux per host - name: Binding Python per selinux yum: name=libselinux-python state=present diff --git a/roles/nethcfg/tasks/main.yml b/roles/nethcfg/tasks/main.yml index 6ff2d7c..f4c7ef5 100644 --- a/roles/nethcfg/tasks/main.yml +++ b/roles/nethcfg/tasks/main.yml @@ -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 diff --git a/roles/setup/tasks/neth_pkgs.yml b/roles/nethcfg/tasks/neth_pkgs.yml similarity index 100% rename from roles/setup/tasks/neth_pkgs.yml rename to roles/nethcfg/tasks/neth_pkgs.yml diff --git a/roles/nethcfg/vars/main.yml b/roles/nethcfg/vars/main.yml new file mode 100644 index 0000000..e8ed334 --- /dev/null +++ b/roles/nethcfg/vars/main.yml @@ -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 diff --git a/roles/setup/tasks/main.yml b/roles/setup/tasks/main.yml index 756fde0..d714e73 100644 --- a/roles/setup/tasks/main.yml +++ b/roles/setup/tasks/main.yml @@ -12,7 +12,3 @@ tags: - git - ansible - -- include: neth_pkgs.yml - when: ansible_distribution == "CentOS" and ansible_os_family == "RedHat" - tags: neth diff --git a/roles/setup/tasks/neth_config.yml b/roles/setup/tasks/neth_config.yml deleted file mode 100644 index b997a9f..0000000 --- a/roles/setup/tasks/neth_config.yml +++ /dev/null @@ -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 diff --git a/roles/setup/vars/main.yml b/roles/setup/vars/main.yml index 1b79ef7..c42feee 100644 --- a/roles/setup/vars/main.yml +++ b/roles/setup/vars/main.yml @@ -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 diff --git a/vagrant/hosts b/vagrant/hosts new file mode 100644 index 0000000..3d5298e --- /dev/null +++ b/vagrant/hosts @@ -0,0 +1,3 @@ +# Generated by Vagrant +[vagrant] +NethServer ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant diff --git a/roles/init/handlers/main.yml b/vagrant/roles/vagrant/handlers/main.yml similarity index 100% rename from roles/init/handlers/main.yml rename to vagrant/roles/vagrant/handlers/main.yml diff --git a/vagrant/roles/vagrant/tasks/main.yml b/vagrant/roles/vagrant/tasks/main.yml new file mode 100644 index 0000000..6b3a925 --- /dev/null +++ b/vagrant/roles/vagrant/tasks/main.yml @@ -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 diff --git a/vagrant/vagrant.yml b/vagrant/vagrant.yml new file mode 100644 index 0000000..ce3cc43 --- /dev/null +++ b/vagrant/vagrant.yml @@ -0,0 +1,6 @@ +--- +# Vagrant provisioning playbook +- hosts: vagrant + roles: + - vagrant + sudo: yes