diff --git a/domain.yml b/domain.yml index 5cdfcbf..8265929 100644 --- a/domain.yml +++ b/domain.yml @@ -21,6 +21,6 @@ org_city: Caravaggio org_phone: "+39 0363 50598" org_street: "Via Zenale e Butinone, 20" mirror_mode: nfs -remote_mirror: ubuntu.fastbull.org +#remote_mirror: ubuntu.fastbull.org mirror_nfs_share: 192.168.255.1:/var/spool/apt-mirror/mirror -mirrorpath: pdc.mastri.edu/ks/mirror/ +client_gitbranch: master diff --git a/roles/ansible-pull/templates/ansible-pull.sh b/roles/ansible-pull/templates/ansible-pull.sh index 5aef85c..81e63bf 100644 --- a/roles/ansible-pull/templates/ansible-pull.sh +++ b/roles/ansible-pull/templates/ansible-pull.sh @@ -16,7 +16,7 @@ echo "$(date --rfc-3339=seconds) Loading and running init-ansible.sh" url=git://{{ ansible_local.domain.serverfqdn }}/client-pull-installation.git repo=/var/lib/{{ ansible_local.domain.domainfull }}/config logfile=/var/lib/ansible-pull.log -branch=master +branch={{ ansible_local.domain.client_gitbranch }} playbook=local.yml echo "$(date --rfc-3339=seconds) Getting vault password" diff --git a/roles/ansible-pull/templates/init-ansible.sh b/roles/ansible-pull/templates/init-ansible.sh index 2ee5cf5..35b66a0 100644 --- a/roles/ansible-pull/templates/init-ansible.sh +++ b/roles/ansible-pull/templates/init-ansible.sh @@ -1,11 +1,16 @@ #!/bin/bash # Creo directory dipendenti -echo "$(date --rfc-3339=seconds) Installing config directory" -/usr/bin/install -d -o root -g users /var/lib/{{ ansible_local.domain.domainfull }}/config +echo "$(date --rfc-3339=seconds) Installing bin directory." /usr/bin/install -d -o root -g users /var/lib/{{ ansible_local.domain.domainfull }}/bin /bin/chown -R root:users /var/lib/{{ ansible_local.domain.domainfull }} +# Prepopulating the config folder to allow correct first run of ansible-pull. +echo "$(date --rfc-3339=seconds) Prepopulating config folder." +if [[ ! -f /var/lib/{{ ansible_local.domain.domainfull }}/config/local.yml ]]; then + git clone -b {{ ansible_local.domain.client_gitbranch }} git://{{ ansible_local.domain.serverfqdn }}/client-pull-installation.git +fi + # Installo ansible-pull.sh echo "$(date --rfc-3339=seconds) Creating ansible-pull.sh." /usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/ansible-pull.sh -O /var/lib/{{ ansible_local.domain.domainfull }}/bin/ansible-pull.sh diff --git a/roles/preseed/defaults/main.yml b/roles/preseed/defaults/main.yml index 24d8b2f..798bb27 100644 --- a/roles/preseed/defaults/main.yml +++ b/roles/preseed/defaults/main.yml @@ -8,3 +8,4 @@ mirror_security_path: /ubuntu mirror_localpath: /ks/mirror execpath: "" execmirrorpath: "" +development: false diff --git a/roles/preseed/tasks/preseed.yml b/roles/preseed/tasks/preseed.yml index c3aa47e..bfc6c25 100644 --- a/roles/preseed/tasks/preseed.yml +++ b/roles/preseed/tasks/preseed.yml @@ -44,6 +44,15 @@ - docenti-trusty.seed become: yes +- name: Preseeding profiles - development + template: + src: 'preseed/dev/{{ item }}' + dest: '/var/lib/nethserver/ibay/ks/preseed/dev/{{ item }}' + with_items: + - client-trusty.seed + - docenti-trusty.seed + become: yes + - name: Copia script post-installazione template: src: 'preseed/{{ item }}' diff --git a/roles/preseed/templates/preseed/dev/client-trusty.seed b/roles/preseed/templates/preseed/dev/client-trusty.seed new file mode 100644 index 0000000..344d333 --- /dev/null +++ b/roles/preseed/templates/preseed/dev/client-trusty.seed @@ -0,0 +1,125 @@ +# No questions if possible +debconf debconf/priority string critical + +# Localization - Italiano +d-i debian-installer/locale string it_IT.UTF-8 +d-i debian-installer/supported-locales multiselect it_IT it_IT@euro en_US en_US.UTF-8 + +# Keyboard settings +d-i console-setup/ask_detect boolean false +d-i keyboard-configuration/layoutcode string it + +# Network +d-i netcfg/choose_interface select auto + +# Adjust the default hostname. +d-i netcfg/hostname string kickseed + +# Enabling non-free firmware +d-i hw-detect/load_firmware boolean true + +# Setting up repositories from local mirror +d-i mirror/country string manual +d-i mirror/protocol string http +d-i mirror/http/hostname string {{ mirror_host }} +d-i mirror/http/directory string {{ mirror_path }} +d-i mirror/http/proxy string +d-i mirror/suite string trusty + +# Apt-setup additional repos +d-i apt-setup/extras boolean false +d-i apt-setup/restricted boolean true +d-i apt-setup/universe boolean true +d-i apt-setup/backports boolean true +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true +d-i apt-setup/services-select multiselect security, updates +d-i apt-setup/security_host string {{ mirror_security_host }} +d-i apt-setup/security_path string {{ mirror_security_path }} + +# Setup and enable libreoffice PPA +d-i apt-setup/local0/repository string http://{{ execpath }}ppa.launchpad.net/libreoffice/libreoffice-5-0/ubuntu trusty main +d-i apt-setup/local0/comment string LibreOffice Official PPA +d-i apt-setup/local0/key string http://keyserver.ubuntu.com:11371/pks/lookup?search=0x36E81C9267FD1383FCC4490983FBA1751378B444&op=get + +# Setup and enable ansible PPA +d-i apt-setup/local1/repository string http://{{ execpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main +d-i apt-setup/local1/comment string Ansible Official PPA +d-i apt-setup/local1/key string http://keyserver.ubuntu.com:11371/pks/lookup?search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367&op=get + +# Time and date +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Rome +d-i clock-setup/ntp boolean true +d-i clock-setup/ntp-server string {{ ansible_local.domain.ntpserver }} + +# User creation +d-i passwd/user-fullname string BgLUG User +d-i passwd/username string bglug +d-i passwd/user-password-crypted string $1$33bB/LIt$MEHmvzVIgYRJs/5L4z34L/ + +# Partitioning +d-i partman-auto/init_automatically_partition select biggest_free +d-i partman-auto/disk string /dev/sda +d-i partman-auto/method string regular +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-auto/choose_recipe select atomic +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman/mount_style select uuid +d-i user-setup/encrypt-home boolean false + +# Kernel installation +d-i base-installer/kernel/image string linux-generic + +# Install the Edubuntu desktop. +tasksel tasksel/first multiselect edubuntu-desktop-gnome + +# No asking for installation in language +d-i pkgsel/install-language-support boolean true +d-i pkgsel/ignore-incomplete-language-support boolean true +d-i localechooser/translation/warn-severe boolean true +d-i localechooser/translation/warn-light boolean true + +# Policy to upgrade: none +d-i pkgsel/update-policy select none + +# UPgrade after installation: no +d-i pkgsel/upgrade select none + +# Language pack selection +d-i pkgsel/language-packs multiselect it, en + +# Disable popularity contest +popularity-contest popularity-contest/participate boolean false + +# Install both GNOME and KDE translation packages. +d-i pkgsel/language-pack-patterns string language-pack-gnome-$LL language-pack-kde-$LL kde-i18n-$LL libreoffice-help-$LL libreoffice-l10n-$LL firefox-locale-$LL gimp-help-$LL thunderbird-locale-$LL + +# Adding libreoffice and ansible +{% if ansible_bios_version == 'VirtualBox' %} +d-i pkgsel/include string epoptes-client dialog vim screen cifs-utils curl git openssh-server software-properties-common sshpass ubuntu-edu-secondary python3-uno libreoffice ansible libnss-myhostname sysv-rc-conf unattended-upgrades update-notifier-common aptitude virtualbox-guest-dkms +{% else %} +d-i pkgsel/include string epoptes-client dialog vim screen cifs-utils curl git openssh-server software-properties-common sshpass ubuntu-edu-secondary python3-uno libreoffice ansible libnss-myhostname sysv-rc-conf unattended-upgrades update-notifier-common aptitude +{% endif %} + +# Post installation tasks +# Update system +d-i preseed/late_command string in-target apt-get -y upgrade; \ + in-target apt-get -y dist-upgrade; \ + in-target apt-get -y purge libnss-mdns unity-webapps-common zeitgeist-core zeitgeist-datahub epoptes; \ + in-target apt-get -y autoremove; \ + sed -i'' -e 's/ubuntu/gnome-fallback/g' /target/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf; \ + in-target /bin/bash -c "/usr/bin/curl -sSL4 http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/postseed-client.sh | /bin/bash >/root/postseed.log 2>&1"; + +# Grub installation on MBR +d-i grub-installer/only_debian boolean true +d-i grub-installer/bootdev string /dev/sda + +# No reboot message +d-i finish-install/reboot_in_progress note +# Powering off machine. +d-i debian-installer/exit/poweroff boolean true diff --git a/roles/preseed/templates/preseed/dev/docenti-trusty.seed b/roles/preseed/templates/preseed/dev/docenti-trusty.seed new file mode 100644 index 0000000..57e6974 --- /dev/null +++ b/roles/preseed/templates/preseed/dev/docenti-trusty.seed @@ -0,0 +1,125 @@ +# No questions if possible +debconf debconf/priority string critical + +# Localization - Italiano +d-i debian-installer/locale string it_IT.UTF-8 +d-i debian-installer/supported-locales multiselect it_IT it_IT@euro en_US en_US.UTF-8 + +# Keyboard settings +d-i console-setup/ask_detect boolean false +d-i keyboard-configuration/layoutcode string it + +# Network +d-i netcfg/choose_interface select auto + +# Adjust the default hostname. +d-i netcfg/hostname string kickseed + +# Enabling non-free firmware +d-i hw-detect/load_firmware boolean true + +# Setting up repositories from local mirror +d-i mirror/country string manual +d-i mirror/protocol string http +d-i mirror/http/hostname string {{ mirror_host }} +d-i mirror/http/directory string {{ mirror_path }} +d-i mirror/http/proxy string +d-i mirror/suite string trusty + +# Apt-setup additional repos +d-i apt-setup/extras boolean false +d-i apt-setup/restricted boolean true +d-i apt-setup/universe boolean true +d-i apt-setup/backports boolean true +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true +d-i apt-setup/services-select multiselect security, updates +d-i apt-setup/security_host string {{ mirror_security_host }} +d-i apt-setup/security_path string {{ mirror_security_path }} + +# Setup and enable libreoffice PPA +d-i apt-setup/local0/repository string http://{{ execpath }}ppa.launchpad.net/libreoffice/libreoffice-5-0/ubuntu trusty main +d-i apt-setup/local0/comment string LibreOffice Official PPA +d-i apt-setup/local0/key string http://keyserver.ubuntu.com:11371/pks/lookup?search=0x36E81C9267FD1383FCC4490983FBA1751378B444&op=get + +# Setup and enable ansible PPA +d-i apt-setup/local1/repository string http://{{ execpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main +d-i apt-setup/local1/comment string Ansible Official PPA +d-i apt-setup/local1/key string http://keyserver.ubuntu.com:11371/pks/lookup?search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367&op=get + +# Time and date +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Rome +d-i clock-setup/ntp boolean true +d-i clock-setup/ntp-server string {{ ansible_local.domain.ntpserver }} + +# User creation +d-i passwd/user-fullname string BgLUG User +d-i passwd/username string bglug +d-i passwd/user-password-crypted string $1$33bB/LIt$MEHmvzVIgYRJs/5L4z34L/ + +# Partitioning +d-i partman-auto/init_automatically_partition select biggest_free +d-i partman-auto/disk string /dev/sda +d-i partman-auto/method string regular +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-auto/choose_recipe select atomic +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman/mount_style select uuid +d-i user-setup/encrypt-home boolean false + +# Kernel installation +d-i base-installer/kernel/image string linux-generic + +# Install the Edubuntu desktop. +tasksel tasksel/first multiselect edubuntu-desktop-gnome + +# No asking for installation in language +d-i pkgsel/install-language-support boolean true +d-i pkgsel/ignore-incomplete-language-support boolean true +d-i localechooser/translation/warn-severe boolean true +d-i localechooser/translation/warn-light boolean true + +# Policy to upgrade: none +d-i pkgsel/update-policy select none + +# UPgrade after installation: no +d-i pkgsel/upgrade select none + +# Language pack selection +d-i pkgsel/language-packs multiselect it, en + +# Disable popularity contest +popularity-contest popularity-contest/participate boolean false + +# Install both GNOME and KDE translation packages. +d-i pkgsel/language-pack-patterns string language-pack-gnome-$LL language-pack-kde-$LL kde-i18n-$LL libreoffice-help-$LL libreoffice-l10n-$LL firefox-locale-$LL gimp-help-$LL thunderbird-locale-$LL + +# Adding libreoffice and ansible +{% if ansible_bios_version == 'VirtualBox' %} +d-i pkgsel/include string epoptes dialog vim screen cifs-utils curl git openssh-server software-properties-common sshpass ubuntu-edu-secondary python3-uno libreoffice ansible libnss-myhostname sysv-rc-conf unattended-upgrades update-notifier-common aptitude virtualbox-guest-dkms +{% else %} +d-i pkgsel/include string epoptes dialog vim screen cifs-utils curl git openssh-server software-properties-common sshpass ubuntu-edu-secondary python3-uno libreoffice ansible libnss-myhostname sysv-rc-conf unattended-upgrades update-notifier-common aptitude +{% endif %} + +# Post installation tasks +# Update system +d-i preseed/late_command string in-target apt-get -y upgrade; \ + in-target apt-get -y dist-upgrade; \ + in-target apt-get -y purge libnss-mdns unity-webapps-common zeitgeist-core zeitgeist-datahub epoptes-client; \ + in-target apt-get -y autoremove; \ + sed -i'' -e 's/ubuntu/gnome-fallback/g' /target/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf; \ + in-target bash -c "/usr/bin/curl -sSL4 http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/postseed-docenti.sh | /bin/bash >/root/postseed.log 2>&1"; + +# Grub installation on MBR +d-i grub-installer/only_debian boolean true +d-i grub-installer/bootdev string /dev/sda + +# No reboot message +d-i finish-install/reboot_in_progress note +# Halting machine once created. +d-i debian-installer/exit/poweroff boolean true diff --git a/roles/pxe/defaults/main.yml b/roles/pxe/defaults/main.yml new file mode 100644 index 0000000..af23948 --- /dev/null +++ b/roles/pxe/defaults/main.yml @@ -0,0 +1,2 @@ +--- +development: false diff --git a/roles/pxe/tasks/pxe.yml b/roles/pxe/tasks/pxe.yml index 8d12856..d79d4e1 100644 --- a/roles/pxe/tasks/pxe.yml +++ b/roles/pxe/tasks/pxe.yml @@ -36,6 +36,14 @@ - name: pxelinux.cfg/default template: src=pxelinux.cfg/default dest=/var/lib/tftpboot/pxelinux.cfg/default become: yes + when: development is not defined or development|bool == false + +- name: pxelinux.cfg/default - development + template: + src: pxelinux.cfg/default.dev + dest: /var/lib/tftpboot/pxelinux.cfg/default + become: yes + when: development is defined and development|bool - name: bglug.png copy: src=bglug.png dest=/var/lib/tftpboot/utils/bglug.png diff --git a/roles/pxe/templates/pxelinux.cfg/default.dev b/roles/pxe/templates/pxelinux.cfg/default.dev new file mode 100644 index 0000000..bf45d83 --- /dev/null +++ b/roles/pxe/templates/pxelinux.cfg/default.dev @@ -0,0 +1,92 @@ +UI /utils/vesamenu.c32 +DEFAULT local +TIMEOUT 30 + +MENU TITLE BgLUG PXE Boot +MENU BACKGROUND /utils/bglug.png + +LABEL local + MENU LABEL Avvia dal primo disco locale + KERNEL /utils/chain.c32 + APPEND hd0 + +MENU SEPARATOR + +LABEL client + MENU LABEL Installa nuova macchina CLIENT + LINUX /ubuntu/14.04/amd64/linux + INITRD /ubuntu/14.04/amd64/initrd.gz + APPEND vga=normal auto=true hostname=kickseed url=http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/client-trusty.seed -- quiet + +LABEL docenti + MENU LABEL Installa nuova macchina DOCENTI + LINUX /ubuntu/14.04/amd64/linux + INITRD /ubuntu/14.04/amd64/initrd.gz + APPEND vga=normal auto=true hostname=kickseed url=http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/docenti-trusty.seed -- quiet + +MENU SEPARATOR +MENU BEGIN +MENU TITLE !!! Development !!! +LABEL client + MENU LABEL Installa nuova macchina CLIENT - Spegni + LINUX /ubuntu/14.04/amd64/linux + INITRD /ubuntu/14.04/amd64/initrd.gz + APPEND vga=normal auto=true hostname=kickseed url=http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/dev/client-trusty.seed -- quiet + +LABEL docenti + MENU LABEL Installa nuova macchina DOCENTI - Spegni + LINUX /ubuntu/14.04/amd64/linux + INITRD /ubuntu/14.04/amd64/initrd.gz + APPEND vga=normal auto=true hostname=kickseed url=http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/dev/docenti-trusty.seed -- quiet + +LABEL return-edu + MENU LABEL ^Torna al menu principale + MENU EXIT +MENU END + +MENU SEPARATOR + +MENU BEGIN +MENU TITLE Edubuntu Classica + +LABEL edubuntu-64 + MENU LABEL Installa Edubuntu 64 bit + LINUX /ubuntu/14.04/amd64/linux + INITRD /ubuntu/14.04/amd64/initrd.gz + APPEND auto=true url=http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/edubuntu.seed quiet + +LABEL edubuntu-32 + MENU LABEL Installa Edubuntu 32 bit + LINUX /ubuntu/14.04/i386/linux + INITRD /ubuntu/14.04/i386/initrd.gz + APPEND auto=true url=http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/edubuntu.seed quiet + +MENU SEPARATOR + +LABEL return-edu + MENU LABEL ^Torna al menu principale + MENU EXIT +MENU END + +MENU SEPARATOR + +MENU BEGIN +MENU TITLE Utilities + +LABEL hdt + MENU LABEL ^HDT - Hardware Diagnostic Tool + KERNEL /utils/memdisk + INITRD /utils/hdt.img + APPEND floppy + +LABEL memtest + MENU LABEL ^memtest86 - Test della RAM + KERNEL /utils/memtest86/vmlinuz + +MENU SEPARATOR + +LABEL return + MENU LABEL ^Torna al menu principale + MENU EXIT + +MENU END