forked from LibreSchool/server-config
Gestite meglio dipendenze per l'installazione sul client. Non c'è più bisogno dei ruoli di test, basta usare i tag.
This commit is contained in:
parent
8e3d941deb
commit
3ef50580c8
5
roles/client-install/meta/main.yml
Normal file
5
roles/client-install/meta/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
dependencies:
|
||||
- { role: pxe, tags: [ 'client-install' ] }
|
||||
- { role: ubuntu-mirror, tags: [ 'client-install' ] }
|
||||
- { role: mac2hostname, tags: [ 'client-install' ] }
|
60
roles/mac2hostname/tasks/mac2hostname.yml
Normal file
60
roles/mac2hostname/tasks/mac2hostname.yml
Normal file
@ -0,0 +1,60 @@
|
||||
---
|
||||
# Installa e configura il servizio per rinominare il client
|
||||
# Grazie per il servizio a Enrico Bacis
|
||||
|
||||
- name: Installazione dipendenze Python
|
||||
yum: pkg=python-bottle state=present
|
||||
sudo: yes
|
||||
|
||||
- name: Check installazione + versione mac2hostname
|
||||
shell: rpm -q mac2hostname
|
||||
ignore_errors: yes
|
||||
register: check_mac2hostname_pkg
|
||||
changed_when: check_mac2hostname_pkg.rc != 0 or check_mac2hostname_pkg.stdout.find('2.0.0-1') == -1
|
||||
|
||||
- name: Installazione mac2hostname
|
||||
yum: pkg=http://syntaxerrormmm.zapto.org/downloads/rpm/mac2hostname-2.0.0-1.el6.noarch.rpm state=present
|
||||
when: check_mac2hostname_pkg|changed
|
||||
sudo: yes
|
||||
|
||||
- name: Verifica aggiunta servizi
|
||||
shell: /sbin/e-smith/db configuration show mac2hostname
|
||||
sudo: yes
|
||||
register: chk_mac2hostname_srv
|
||||
changed_when: chk_mac2hostname_srv.rc != 0
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Aggiungo il servizio ai servizi gestiti da NethServer
|
||||
shell: /sbin/e-smith/db configuration set mac2hostname service status enabled TCPPort 3000 access private
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Default per NetServer - Cartella defaults
|
||||
shell: mkdir -p /etc/e-smith/db/configuration/defaults/mac2hostname
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Default per NethServer - Tipo
|
||||
shell: echo "service" > /etc/e-smith/db/configuration/defaults/mac2hostname/type
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Default per NethServer - Stato
|
||||
shell: echo "enabled" > /etc/e-smith/db/configuration/defaults/mac2hostname/status
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Aggiunta servizio
|
||||
shell: /sbin/e-smith/signal-event runlevel-adjust
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Aggiunta servizio di rete e cambio firewall
|
||||
shell: /sbin/e-smith/signal-event firewall-adjust
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Avvio di mac2hostname
|
||||
shell: service mac2hostname start
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
@ -1,60 +1,4 @@
|
||||
---
|
||||
# Installa e configura il servizio per rinominare il client
|
||||
# Grazie per il servizio a Enrico Bacis
|
||||
|
||||
- name: Installazione dipendenze Python
|
||||
yum: pkg=python-bottle state=present
|
||||
sudo: yes
|
||||
|
||||
- name: Check installazione + versione mac2hostname
|
||||
shell: rpm -q mac2hostname
|
||||
ignore_errors: yes
|
||||
register: check_mac2hostname_pkg
|
||||
changed_when: check_mac2hostname_pkg.rc != 0 or check_mac2hostname_pkg.stdout.find('2.0.0-1') == -1
|
||||
|
||||
- name: Installazione mac2hostname
|
||||
yum: pkg=http://syntaxerrormmm.zapto.org/downloads/rpm/mac2hostname-2.0.0-1.el6.noarch.rpm state=present
|
||||
when: check_mac2hostname_pkg|changed
|
||||
sudo: yes
|
||||
|
||||
- name: Verifica aggiunta servizi
|
||||
shell: /sbin/e-smith/db configuration show mac2hostname
|
||||
sudo: yes
|
||||
register: chk_mac2hostname_srv
|
||||
changed_when: chk_mac2hostname_srv.rc != 0
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Aggiungo il servizio ai servizi gestiti da NethServer
|
||||
shell: /sbin/e-smith/db configuration set mac2hostname service status enabled TCPPort 3000 access private
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Default per NetServer - Cartella defaults
|
||||
shell: mkdir -p /etc/e-smith/db/configuration/defaults/mac2hostname
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Default per NethServer - Tipo
|
||||
shell: echo "service" > /etc/e-smith/db/configuration/defaults/mac2hostname/type
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Default per NethServer - Stato
|
||||
shell: echo "enabled" > /etc/e-smith/db/configuration/defaults/mac2hostname/status
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Aggiunta servizio
|
||||
shell: /sbin/e-smith/signal-event runlevel-adjust
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Aggiunta servizio di rete e cambio firewall
|
||||
shell: /sbin/e-smith/signal-event firewall-adjust
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
|
||||
- name: Avvio di mac2hostname
|
||||
shell: service mac2hostname start
|
||||
sudo: yes
|
||||
when: chk_mac2hostname_srv|changed
|
||||
- include: mac2hostname.yml
|
||||
tags:
|
||||
- "client-install"
|
||||
|
@ -3,8 +3,14 @@
|
||||
|
||||
# Installo pacchetti addizionali
|
||||
- include: neth_pkgs.yml
|
||||
tags:
|
||||
- nethcfg
|
||||
|
||||
- include: reconfig_nic.yml
|
||||
when: ansible_product_name == "VirtualBox"
|
||||
tags:
|
||||
- nethcfg
|
||||
|
||||
- include: reconfig_srv.yml
|
||||
tags:
|
||||
- netcfg
|
||||
|
@ -1,141 +1,4 @@
|
||||
---
|
||||
# Configurazione dell'ambiente di boot via rete per i client
|
||||
|
||||
- name: Verifica configurazione tftp
|
||||
shell: /sbin/e-smith/db configuration getprop dnsmasq dhcp-boot
|
||||
register: chk_tftp_enabled
|
||||
changed_when: "'pxelinux.0' not in chk_tftp_enabled.stdout"
|
||||
ignore_errors: yes
|
||||
sudo: yes
|
||||
|
||||
- name: Configuro tftp
|
||||
shell: /sbin/e-smith/db configuration setprop dnsmasq tftp-status enabled dhcp-boot pxelinux.0
|
||||
when: chk_tftp_enabled|changed
|
||||
sudo: yes
|
||||
|
||||
- name: Attivo tftp
|
||||
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
|
||||
when: chk_tftp_enabled|changed
|
||||
sudo: yes
|
||||
|
||||
- name: Verifica configurazione ibay kickstart
|
||||
shell: /sbin/e-smith/db accounts show ks
|
||||
register: chk_ks_created
|
||||
changed_when: chk_ks_created.rc != 0
|
||||
ignore_errors: yes
|
||||
sudo: yes
|
||||
|
||||
- name: Configurazione web kickstart
|
||||
shell: /sbin/e-smith/db accounts set ks ibay Description "Kickstart share" GroupAccess rw HttpAccess private HttpAliasType default HttpAllowOverrideStatus disabled HttpForceSslStatus disabled HttpPasswordStatus disabled HttpStatus enabled HttpVirtualHost __ANY__ OtherAccess r OwningGroup locals SmbAuditStatus disabled SmbStatus disabled
|
||||
when: chk_ks_created|failed
|
||||
sudo: yes
|
||||
|
||||
- name: Attivazione web kickstart
|
||||
shell: /sbin/e-smith/signal-event ibay-create ks
|
||||
when: chk_ks_created|failed
|
||||
sudo: yes
|
||||
|
||||
- name: Verifica presenza directory mirror
|
||||
file: path=/var/spool/apt-mirror/mirror state=directory
|
||||
register: chk_mirror_dir
|
||||
ignore_errors: yes
|
||||
sudo: yes
|
||||
|
||||
- name: Collegamento directory mirror
|
||||
file: path=/var/lib/nethserver/ibay/ks/mirror src=/var/spool/apt-mirror/mirror state=link
|
||||
sudo: yes
|
||||
when: chk_mirror_dir|success
|
||||
|
||||
- name: Creo directory necessarie
|
||||
file: path={{ item }} state=directory
|
||||
with_items:
|
||||
- /var/lib/tftpboot/pxelinux.cfg
|
||||
- /var/lib/tftpboot/ubuntu/14.04/i386
|
||||
- /var/lib/tftpboot/ubuntu/14.04/amd64
|
||||
- /var/lib/tftpboot/utils/memtest86
|
||||
sudo: yes
|
||||
|
||||
- name: pxelinux.0
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/pxelinux.0
|
||||
dest: /var/lib/tftpboot/pxelinux.0
|
||||
sudo: yes
|
||||
|
||||
- name: pxelinux.cfg/default
|
||||
template: src=pxelinux.cfg/default dest=/var/lib/tftpboot/pxelinux.cfg/default
|
||||
sudo: yes
|
||||
|
||||
- name: bglug.png
|
||||
copy: src=bglug.png dest=/var/lib/tftpboot/utils/bglug.png
|
||||
sudo: yes
|
||||
|
||||
- name: vesamenu.c32
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/ubuntu-installer/i386/boot-screens/vesamenu.c32
|
||||
dest: /var/lib/tftpboot/utils/vesamenu.c32
|
||||
sudo: yes
|
||||
|
||||
- name: linux i386
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/ubuntu-installer/i386/linux
|
||||
dest: /var/lib/tftpboot/ubuntu/14.04/i386/linux
|
||||
sudo: yes
|
||||
|
||||
- name: initrd.gz i386
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/ubuntu-installer/i386/initrd.gz
|
||||
dest: /var/lib/tftpboot/ubuntu/14.04/i386/initrd.gz
|
||||
sudo: yes
|
||||
|
||||
- name: linux amd64
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux
|
||||
dest: /var/lib/tftpboot/ubuntu/14.04/amd64/linux
|
||||
sudo: yes
|
||||
|
||||
- name: initrd.gz amd64
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz
|
||||
dest: /var/lib/tftpboot/ubuntu/14.04/amd64/initrd.gz
|
||||
sudo: yes
|
||||
|
||||
- name: memdisk
|
||||
get_url:
|
||||
url: http://syntaxerrormmm.zapto.org/pxe-bootimg/memdisk
|
||||
dest: /var/lib/tftpboot/utils/memdisk
|
||||
sudo: yes
|
||||
|
||||
- name: memtest86
|
||||
get_url:
|
||||
url: http://syntaxerrormmm.zapto.org/pxe-bootimg/memtest86/vmlinuz
|
||||
dest: /var/lib/tftpboot/utils/memtest86/vmlinuz
|
||||
sudo: yes
|
||||
|
||||
- name: hdt
|
||||
get_url:
|
||||
url: http://syntaxerrormmm.zapto.org/pxe-bootimg/hdt.img
|
||||
dest: /var/lib/tftpboot/utils/hdt.img
|
||||
sudo: yes
|
||||
|
||||
- name: Sovrascrivo la variabile mirrorpath se è su Virtualbox
|
||||
set_fact: oldmirrorpath="{{ mirrorpath }}" mirrorpath=""
|
||||
when: ansible_bios_version == "VirtualBox"
|
||||
|
||||
- name: Copia configurazioni kickstart
|
||||
template: src=ks/{{ item }} dest=/var/lib/nethserver/ibay/ks/{{ item }}
|
||||
sudo: yes
|
||||
with_items:
|
||||
- client-trusty.cfg
|
||||
- docenti-trusty.cfg
|
||||
- ubuntu-trusty.cfg
|
||||
- post-ks.sh
|
||||
- ansible-pull.sh
|
||||
- ansible-pull-crontab
|
||||
|
||||
- name: Copio logrotate per configurazione pull
|
||||
copy: src=ansible-pull-logrotate dest=/var/lib/nethserver/ibay/ks/ansible-pull-logrotate
|
||||
sudo: yes
|
||||
|
||||
- name: Ripristino impostazioni mirrorpath
|
||||
set_fact: mirrorpath="{{ oldmirrorpath }}"
|
||||
when: ansible_bios_version == "VirtualBox"
|
||||
- include: pxe.yml
|
||||
tags:
|
||||
- "client-install"
|
||||
|
141
roles/pxe/tasks/pxe.yml
Normal file
141
roles/pxe/tasks/pxe.yml
Normal file
@ -0,0 +1,141 @@
|
||||
---
|
||||
# Configurazione dell'ambiente di boot via rete per i client
|
||||
|
||||
- name: Verifica configurazione tftp
|
||||
shell: /sbin/e-smith/db configuration getprop dnsmasq dhcp-boot
|
||||
register: chk_tftp_enabled
|
||||
changed_when: "'pxelinux.0' not in chk_tftp_enabled.stdout"
|
||||
ignore_errors: yes
|
||||
sudo: yes
|
||||
|
||||
- name: Configuro tftp
|
||||
shell: /sbin/e-smith/db configuration setprop dnsmasq tftp-status enabled dhcp-boot pxelinux.0
|
||||
when: chk_tftp_enabled|changed
|
||||
sudo: yes
|
||||
|
||||
- name: Attivo tftp
|
||||
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
|
||||
when: chk_tftp_enabled|changed
|
||||
sudo: yes
|
||||
|
||||
- name: Verifica configurazione ibay kickstart
|
||||
shell: /sbin/e-smith/db accounts show ks
|
||||
register: chk_ks_created
|
||||
changed_when: chk_ks_created.rc != 0
|
||||
ignore_errors: yes
|
||||
sudo: yes
|
||||
|
||||
- name: Configurazione web kickstart
|
||||
shell: /sbin/e-smith/db accounts set ks ibay Description "Kickstart share" GroupAccess rw HttpAccess private HttpAliasType default HttpAllowOverrideStatus disabled HttpForceSslStatus disabled HttpPasswordStatus disabled HttpStatus enabled HttpVirtualHost __ANY__ OtherAccess r OwningGroup locals SmbAuditStatus disabled SmbStatus disabled
|
||||
when: chk_ks_created|failed
|
||||
sudo: yes
|
||||
|
||||
- name: Attivazione web kickstart
|
||||
shell: /sbin/e-smith/signal-event ibay-create ks
|
||||
when: chk_ks_created|failed
|
||||
sudo: yes
|
||||
|
||||
- name: Verifica presenza directory mirror
|
||||
file: path=/var/spool/apt-mirror/mirror state=directory
|
||||
register: chk_mirror_dir
|
||||
ignore_errors: yes
|
||||
sudo: yes
|
||||
|
||||
- name: Collegamento directory mirror
|
||||
file: path=/var/lib/nethserver/ibay/ks/mirror src=/var/spool/apt-mirror/mirror state=link
|
||||
sudo: yes
|
||||
when: chk_mirror_dir|success
|
||||
|
||||
- name: Creo directory necessarie
|
||||
file: path={{ item }} state=directory
|
||||
with_items:
|
||||
- /var/lib/tftpboot/pxelinux.cfg
|
||||
- /var/lib/tftpboot/ubuntu/14.04/i386
|
||||
- /var/lib/tftpboot/ubuntu/14.04/amd64
|
||||
- /var/lib/tftpboot/utils/memtest86
|
||||
sudo: yes
|
||||
|
||||
- name: pxelinux.0
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/pxelinux.0
|
||||
dest: /var/lib/tftpboot/pxelinux.0
|
||||
sudo: yes
|
||||
|
||||
- name: pxelinux.cfg/default
|
||||
template: src=pxelinux.cfg/default dest=/var/lib/tftpboot/pxelinux.cfg/default
|
||||
sudo: yes
|
||||
|
||||
- name: bglug.png
|
||||
copy: src=bglug.png dest=/var/lib/tftpboot/utils/bglug.png
|
||||
sudo: yes
|
||||
|
||||
- name: vesamenu.c32
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/ubuntu-installer/i386/boot-screens/vesamenu.c32
|
||||
dest: /var/lib/tftpboot/utils/vesamenu.c32
|
||||
sudo: yes
|
||||
|
||||
- name: linux i386
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/ubuntu-installer/i386/linux
|
||||
dest: /var/lib/tftpboot/ubuntu/14.04/i386/linux
|
||||
sudo: yes
|
||||
|
||||
- name: initrd.gz i386
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/ubuntu-installer/i386/initrd.gz
|
||||
dest: /var/lib/tftpboot/ubuntu/14.04/i386/initrd.gz
|
||||
sudo: yes
|
||||
|
||||
- name: linux amd64
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux
|
||||
dest: /var/lib/tftpboot/ubuntu/14.04/amd64/linux
|
||||
sudo: yes
|
||||
|
||||
- name: initrd.gz amd64
|
||||
get_url:
|
||||
url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz
|
||||
dest: /var/lib/tftpboot/ubuntu/14.04/amd64/initrd.gz
|
||||
sudo: yes
|
||||
|
||||
- name: memdisk
|
||||
get_url:
|
||||
url: http://syntaxerrormmm.zapto.org/pxe-bootimg/memdisk
|
||||
dest: /var/lib/tftpboot/utils/memdisk
|
||||
sudo: yes
|
||||
|
||||
- name: memtest86
|
||||
get_url:
|
||||
url: http://syntaxerrormmm.zapto.org/pxe-bootimg/memtest86/vmlinuz
|
||||
dest: /var/lib/tftpboot/utils/memtest86/vmlinuz
|
||||
sudo: yes
|
||||
|
||||
- name: hdt
|
||||
get_url:
|
||||
url: http://syntaxerrormmm.zapto.org/pxe-bootimg/hdt.img
|
||||
dest: /var/lib/tftpboot/utils/hdt.img
|
||||
sudo: yes
|
||||
|
||||
- name: Sovrascrivo la variabile mirrorpath se è su Virtualbox
|
||||
set_fact: oldmirrorpath="{{ mirrorpath }}" mirrorpath=""
|
||||
when: ansible_bios_version == "VirtualBox"
|
||||
|
||||
- name: Copia configurazioni kickstart
|
||||
template: src=ks/{{ item }} dest=/var/lib/nethserver/ibay/ks/{{ item }}
|
||||
sudo: yes
|
||||
with_items:
|
||||
- client-trusty.cfg
|
||||
- docenti-trusty.cfg
|
||||
- ubuntu-trusty.cfg
|
||||
- post-ks.sh
|
||||
- ansible-pull.sh
|
||||
- ansible-pull-crontab
|
||||
|
||||
- name: Copio logrotate per configurazione pull
|
||||
copy: src=ansible-pull-logrotate dest=/var/lib/nethserver/ibay/ks/ansible-pull-logrotate
|
||||
sudo: yes
|
||||
|
||||
- name: Ripristino impostazioni mirrorpath
|
||||
set_fact: mirrorpath="{{ oldmirrorpath }}"
|
||||
when: ansible_bios_version == "VirtualBox"
|
@ -1,10 +1,4 @@
|
||||
---
|
||||
# Configurazione del server come repo
|
||||
|
||||
- name: Installazione apt-mirror
|
||||
yum: pkg=apt-mirror state=present
|
||||
sudo: yes
|
||||
|
||||
- name: Installazione configurazione apt-mirror
|
||||
copy: src=apt-mirror.list dest=/etc/apt-mirror.list
|
||||
sudo: yes
|
||||
- include: ubuntu-mirror.yml
|
||||
tags:
|
||||
- "client-install"
|
||||
|
10
roles/ubuntu-mirror/tasks/ubuntu-mirror.yml
Normal file
10
roles/ubuntu-mirror/tasks/ubuntu-mirror.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
# Configurazione del server come repo
|
||||
|
||||
- name: Installazione apt-mirror
|
||||
yum: pkg=apt-mirror state=present
|
||||
sudo: yes
|
||||
|
||||
- name: Installazione configurazione apt-mirror
|
||||
copy: src=apt-mirror.list dest=/etc/apt-mirror.list
|
||||
sudo: yes
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
- hosts: server
|
||||
vars_files:
|
||||
- domain.yml
|
||||
roles:
|
||||
- nethcfg
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
- hosts: server
|
||||
vars_files:
|
||||
- domain.yml
|
||||
roles:
|
||||
- pxe
|
||||
- ubuntu-mirror
|
||||
- mac2hostname
|
Loading…
x
Reference in New Issue
Block a user