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 *.swp
*.box *.box
Vagrantfile 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: Per configurarlo:
$ vim hosts $ vim hosts
@ -16,8 +16,7 @@ l'uso con [`vagrant`](https://www.vagrantup.com/).
È pertanto possibile creare una macchina virtuale automatica eseguendo i È pertanto possibile creare una macchina virtuale automatica eseguendo i
seguenti comandi: seguenti comandi:
$ vagrant box add clearos6 syntaxerrormmm/clearos6 $ vagrant init syntaxerrormmm/nethserver
$ vagrant init clearos6
[Contattatemi](mailto:syntaxerrormmm-AT-gmail.com) per avere accesso alla [Contattatemi](mailto:syntaxerrormmm-AT-gmail.com) per avere accesso alla
macchina. macchina.

3
hosts
View File

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

View File

@ -1,5 +1,7 @@
--- ---
- include: selinux-binding.yml
- include: mgmtuser.yml - include: mgmtuser.yml
- include: ssh-keygen.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 - name: Verifica abilitazione repo Extra
yum: name={{ item }} state=present shell: yum repolist
sudo: yes register: check_epel
with_items: addins_pkgs failed_when: "'Extra Packages for Enterprise Linux 6' not in check_epel.stdout"
register: check_pkg
ignore_errors: yes ignore_errors: yes
tags: pkg
- name: Verifica configurazione CentOS 6 - name: Installo epel-release
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
yum: name=epel-release state=present yum: name=epel-release state=present
sudo: yes sudo: yes
when: first_repo_activate|changed when: check_epel|success
register: epel_installed 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 shell: yum clean all && yum repolist
sudo: yes sudo: yes
when: epel_installed|changed when: epel_installed|changed or rpm_epel_installed|changed
tags: repo tags: repo
- name: Pulizia - name: Installo pacchetti addizionali
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
yum: name={{ item }} state=present yum: name={{ item }} state=present
sudo: yes sudo: yes
when: ansible_os_family == 'ClearOS'
with_items: addin_pkgs with_items: addin_pkgs
tags: pkg 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 - include: centos_pkgs.yml
async: 180 when: ansible_distribution == "CentOS" and ansible_os_family == "RedHat"
poll: 30
tags: centos tags: centos
- include: ansible.yml - include: ansible.yml
when: ansible_distribution == "CentOS"
tags: tags:
- git - git
- ansible - 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: addin_pkgs:
- git - git
- vim-enhanced - vim-enhanced
@ -19,20 +6,16 @@ addin_pkgs:
- sshpass - sshpass
- ansible - ansible
clearos_pkgs: neth_pkgs:
- app-services - nethserver-ibays
- app-software-repository - nethserver-samba
- app-log-viewer - nethserver-samba-audit
- app-process-viewer - nethserver-cups
- app-account-import - nethserver-avahi
- app-ntp - nethserver-dnsmasq
- app-administrators - nethserver-collectd
- app-password-policies - nethserver-collectd-web
- app-user-profile - nethserver-squid
- app-openldap-directory - nethserver-squidclamav
- app-print-server - nethserver-squidguard
- app-samba - nethserver-firewall-base
- app-flexshare
- app-web-proxy
- app-proxy-report
- app-content-filter