diff --git a/.gitignore b/.gitignore index d1b60a1..9920c54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swp *.box Vagrantfile +.vagrant/* diff --git a/README.md b/README.md index a36971e..9ed4b9b 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/hosts b/hosts index fb4ca40..b43c59b 100644 --- a/hosts +++ b/hosts @@ -1,2 +1,5 @@ +[defaults] +host_key_checking=false + [server] 10.0.0.1 ansible_ssh_user=amgmt diff --git a/roles/init/tasks/main.yml b/roles/init/tasks/main.yml index 1e8dd9e..82a86d5 100644 --- a/roles/init/tasks/main.yml +++ b/roles/init/tasks/main.yml @@ -1,5 +1,7 @@ --- +- include: selinux-binding.yml + - include: mgmtuser.yml - include: ssh-keygen.yml diff --git a/roles/init/tasks/selinux-binding.yml b/roles/init/tasks/selinux-binding.yml new file mode 100644 index 0000000..3a359e5 --- /dev/null +++ b/roles/init/tasks/selinux-binding.yml @@ -0,0 +1,4 @@ +--- + +- name: Binding Python per selinux + yum: name=libselinux-python state=present diff --git a/roles/setup/tasks/centos_pkgs.yml b/roles/setup/tasks/centos_pkgs.yml index 6eb9f74..5143fb1 100644 --- a/roles/setup/tasks/centos_pkgs.yml +++ b/roles/setup/tasks/centos_pkgs.yml @@ -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 diff --git a/roles/setup/tasks/clearos_pkgs.yml b/roles/setup/tasks/clearos_pkgs.yml deleted file mode 100644 index 392f11f..0000000 --- a/roles/setup/tasks/clearos_pkgs.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Aggiunta pacchetti specifici ClearOS - yum: name="{{ item }}" state=present - sudo: yes - with_items: clearos_pkgs - register: cleanos_install diff --git a/roles/setup/tasks/main.yml b/roles/setup/tasks/main.yml index 0380459..7675a30 100644 --- a/roles/setup/tasks/main.yml +++ b/roles/setup/tasks/main.yml @@ -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 diff --git a/roles/setup/tasks/neth_pkgs.yml b/roles/setup/tasks/neth_pkgs.yml new file mode 100644 index 0000000..5ad6d60 --- /dev/null +++ b/roles/setup/tasks/neth_pkgs.yml @@ -0,0 +1,6 @@ +--- + +- name: Installazione pacchetti neth + yum: name="{{ item }}" state=present + sudo: yes + with_items: neth_pkgs diff --git a/roles/setup/vars/main.yml b/roles/setup/vars/main.yml index fdc4807..5e39907 100644 --- a/roles/setup/vars/main.yml +++ b/roles/setup/vars/main.yml @@ -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