Rivisti script per cambio di sistema (NethServer). Script sembrerebbero funzionare.

This commit is contained in:
Emiliano Vavassori 2015-04-20 02:49:11 +02:00
parent 6b5a7568a4
commit 08efa36d0b
10 changed files with 61 additions and 112 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.swp
*.box
Vagrantfile
.vagrant/*

View File

@ -1,6 +1,6 @@
# Repository di Ansible per configurazione del server di dominio con ClearOS #
# Repository di Ansible per configurazione del server di dominio con NethServer #
Qui sono presenti i files di configurazione per il server ClearOS.
Qui sono presenti i files di configurazione per il server [NethServer](http://www.nethserver.org/).
Per configurarlo:
$ vim hosts
@ -16,8 +16,7 @@ l'uso con [`vagrant`](https://www.vagrantup.com/).
È pertanto possibile creare una macchina virtuale automatica eseguendo i
seguenti comandi:
$ vagrant box add clearos6 syntaxerrormmm/clearos6
$ vagrant init clearos6
$ vagrant init syntaxerrormmm/nethserver
[Contattatemi](mailto:syntaxerrormmm-AT-gmail.com) per avere accesso alla
macchina.

3
hosts
View File

@ -1,2 +1,5 @@
[defaults]
host_key_checking=false
[server]
10.0.0.1 ansible_ssh_user=amgmt

View File

@ -1,5 +1,7 @@
---
- include: selinux-binding.yml
- include: mgmtuser.yml
- include: ssh-keygen.yml

View File

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

View File

@ -1,81 +1,39 @@
---
- name: Verifica installazione pacchetti aggiuntivi
yum: name={{ item }} state=present
sudo: yes
with_items: addins_pkgs
register: check_pkg
- 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
tags: pkg
- name: Verifica configurazione CentOS 6
shell: test -f /etc/yum.repos.d/{{ item }}
sudo: yes
with_items: centos_repo_files
when: check_pkg|failed
ignore_errors: yes
register: check_repos
tags: repo
- name: Scarico configurazione per CentOS 6
get_url:
url: http://mirror.centos.org/centos/6/os/x86_64/Packages/centos-release-6-6.el6.centos.12.2.x86_64.rpm
dest: /tmp/centos-release-6-6.el6.centos.12.2.x86_64.rpm
sudo: yes
when: check_repos|failed
tags: repo
- name: Scompatto configurazione CentOS 6
shell: mkdir -p /tmp/centos-release && pushd /tmp/centos-release && rpm2cpio ../centos-release-6-6.el6.centos.12.2.x86_64.rpm | cpio -idmv && popd
sudo: yes
when: check_repos|failed
tags: repo
- name: Copio i repository
shell: cp -f /tmp/centos-release/etc/yum.repos.d/{{ item }} /etc/yum.repos.d/
with_items: centos_repo_files
sudo: yes
when: check_repos|failed
register: centos_repo_installed
tags: repo
- name: Copio le chiavi di firma GPG
shell: cp -f /tmp/centos-release/etc/pki/rpm-gpg/{{ item }} /etc/pki/rpm-gpg/
with_items: centos_gpg_files
sudo: yes
when: check_repos|failed
tags: repo
# Senza di questa, non è possibile installare EPEL dopo
- name: Prima attivazione repo
shell: yum clean all && yum repolist
sudo: yes
register: first_repo_activate
when: centos_repo_installed|changed
tags: repo
- name: Attivo EPEL
- name: Installo epel-release
yum: name=epel-release state=present
sudo: yes
when: first_repo_activate|changed
when: check_epel|success
register: epel_installed
tags: repo
- name: Seconda attivazione repo
- 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
sudo: yes
when: check_epel|failed
register: rpm_epel_installed
- name: Abilito il repo EPEL
shell: yum-config-manager --enable epel
sudo: yes
changed_when: rpm_epel_enabled.rc == 0
register: rpm_epel_enabled
- name: Pulizia e ricaricam. repo
shell: yum clean all && yum repolist
sudo: yes
when: epel_installed|changed
when: epel_installed|changed or rpm_epel_installed|changed
tags: repo
- name: Pulizia
shell: rm -rf /tmp/centos-release && rm -f /tmp/centos-release-6-6.el6.centos.12.2.x86_64.rpm /tmp/epel-release-6-8.noarch.rpm
sudo: yes
when: check_repos|failed
tags: repo
- name: Installo pacchetti di gestione
- name: Installo pacchetti addizionali
yum: name={{ item }} state=present
sudo: yes
when: ansible_os_family == 'ClearOS'
with_items: addin_pkgs
tags: pkg

View File

@ -1,6 +0,0 @@
---
- name: Aggiunta pacchetti specifici ClearOS
yum: name="{{ item }}" state=present
sudo: yes
with_items: clearos_pkgs
register: cleanos_install

View File

@ -1,16 +1,15 @@
---
- include: clearos_pkgs.yml
async: 180
poll: 30
tags: clearos
- include: centos_pkgs.yml
async: 180
poll: 30
when: ansible_distribution == "CentOS" and ansible_os_family == "RedHat"
tags: centos
- include: ansible.yml
when: ansible_distribution == "CentOS"
tags:
- git
- ansible
- include: neth_pkgs.yml
when: ansible_distribution == "CentOS" and ansible_os_family == "RedHat"
tags: neth

View File

@ -0,0 +1,6 @@
---
- name: Installazione pacchetti neth
yum: name="{{ item }}" state=present
sudo: yes
with_items: neth_pkgs

View File

@ -1,17 +1,4 @@
---
centos_repo_files:
- CentOS-Base.repo
- CentOS-Debuginfo.repo
- CentOS-fasttrack.repo
- CentOS-Media.repo
- CentOS-Vault.repo
centos_gpg_files:
- RPM-GPG-KEY-CentOS-6
- RPM-GPG-KEY-CentOS-Security-6
- RPM-GPG-KEY-CentOS-Debug-6
- RPM-GPG-KEY-CentOS-Testing-6
addin_pkgs:
- git
- vim-enhanced
@ -19,20 +6,16 @@ addin_pkgs:
- sshpass
- ansible
clearos_pkgs:
- app-services
- app-software-repository
- app-log-viewer
- app-process-viewer
- app-account-import
- app-ntp
- app-administrators
- app-password-policies
- app-user-profile
- app-openldap-directory
- app-print-server
- app-samba
- app-flexshare
- app-web-proxy
- app-proxy-report
- app-content-filter
neth_pkgs:
- 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