From 02dd0eed95c66a6920a95e465c3ad997e896e2e5 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Tue, 24 Oct 2017 21:44:42 +0200 Subject: [PATCH 1/6] Issue #23: downloading the client repository by init-ansible.sh. --- roles/ansible-pull/templates/init-ansible.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/roles/ansible-pull/templates/init-ansible.sh b/roles/ansible-pull/templates/init-ansible.sh index 34b8e19..7f968fd 100644 --- a/roles/ansible-pull/templates/init-ansible.sh +++ b/roles/ansible-pull/templates/init-ansible.sh @@ -1,14 +1,26 @@ #!/bin/bash +# Fixing base variables. +basedir=/var/lib/{{ ansible_local.domain.domainfull }} +url=git://{{ ansible_local.domain.serverfqdn }}/client-pull-installation.git +branch={{ ansible_local.domain.client_gitbranch }} + # Creo directory dipendenti 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 }} +/usr/bin/install -d -o root -g users ${basedir}/bin + +# Workaround issue #23 - ansible-pull won't pull out of remote the first time. +if [[ ! -f ${basedir}/config/local.yml ]]; then + /usr/bin/git clone -b ${branch} ${url} ${basedir}/config +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 -chmod a+x /var/lib/{{ ansible_local.domain.domainfull }}/bin/ansible-pull.sh +/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-pull/ansible-pull.sh -O ${basedir}/bin/ansible-pull.sh +chmod a+x ${basedir}/bin/ansible-pull.sh + +# Fixing permissions on the main directory +/bin/chown -R root:users ${basedir} # Installo il cronjob per ansible-pull echo "$(date --rfc-3339=seconds) Creating crontab" From 125c72e136f999d8513b06f340766a5692ed246f Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Tue, 24 Oct 2017 22:30:19 +0200 Subject: [PATCH 2/6] Fix issue #27: try to honor domain.yml mirror_host variable. --- roles/preseed/defaults/main.yml | 1 + roles/preseed/tasks/main.yml | 1 + roles/preseed/tasks/mirror-cfg.yml | 27 +++++++++++-------- .../preseed/templates/repoconfig/sources.list | 20 +++++++------- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/roles/preseed/defaults/main.yml b/roles/preseed/defaults/main.yml index 265a1ed..7424348 100644 --- a/roles/preseed/defaults/main.yml +++ b/roles/preseed/defaults/main.yml @@ -8,5 +8,6 @@ mirror_security_host: security.ubuntu.com mirror_security_path: /ubuntu mirror_localpath: /ks/mirror execpath: "" +execsecurepath: "" execmirrorpath: "" development: false diff --git a/roles/preseed/tasks/main.yml b/roles/preseed/tasks/main.yml index 3c3499b..4f7b83b 100644 --- a/roles/preseed/tasks/main.yml +++ b/roles/preseed/tasks/main.yml @@ -3,6 +3,7 @@ - include: mirror-cfg.yml tags: - preseed + - repoconfig - include: preseed.yml tags: diff --git a/roles/preseed/tasks/mirror-cfg.yml b/roles/preseed/tasks/mirror-cfg.yml index 9c4d40e..79310fe 100644 --- a/roles/preseed/tasks/mirror-cfg.yml +++ b/roles/preseed/tasks/mirror-cfg.yml @@ -6,19 +6,27 @@ when: "ansible_local.domain.mirror_mode is defined" - name: Determining mirror_host - set_fact: mirror_host="{{ ansible_local.domain.mirror_host }}" + set_fact: + mirror_host: "{{ ansible_local.domain.mirror_host }}" + orig_mirror_host: "{{ ansible_local.domain.mirror_host }}" when: ansible_local.domain.mirror_host is defined - name: Determining mirror_path - set_fact: mirror_path="{{ ansible_local.domain.mirror_path }}" + set_fact: + mirror_path: "{{ ansible_local.domain.mirror_path }}" + orig_mirror_path: "{{ ansible_local.domain.mirror_path }}" when: ansible_local.domain.mirror_path is defined - name: Determining mirror_security_host - set_fact: mirror_security_host="{{ ansible_local.domain.mirror_security_host }}" + set_fact: + mirror_security_host: "{{ ansible_local.domain.mirror_security_host }}" + orig_mirror_security_host: "{{ ansible_local.domain.mirror_security_host }}" when: ansible_local.domain.mirror_security_host is defined - name: Determining mirror_security_path - set_fact: mirror_security_path="{{ ansible_local.domain.mirror_security_path }}" + set_fact: + mirror_security_path: "{{ ansible_local.domain.mirror_security_path }}" + orig_mirror_security_path: "{{ ansible_local.domain.mirror_security_path }}" when: ansible_local.domain.mirror_security_path is defined - name: Determining mirror_localpath @@ -28,16 +36,13 @@ # The remote option is already configured as it is. # Configuring correctly local mirror -- name: Determining variables for local and nfs mode +- name: Altering paths set_fact: - orig_mirror_path: ”{{ mirror_path }}" - orig_mirror_host: "{{ mirror_host }}" - orig_mirror_security_path: "{{ mirror_security_path }}" - orig_mirror_security_host: "{{ mirror_security_host }}" - execmirrorpath: ”{{ mirror_host }}{{ mirror_path }}" + execmirrorpath: "{{ mirror_host }}{{ mirror_path }}" + execsecurepath: "{{ mirror_security_host }}{{ mirror_security_path }}" execpath: "{{ ansible_local.domain.serverfqdn }}{{ mirror_localpath }}/" mirror_path: "{{ mirror_localpath }}/{{ mirror_host }}{{ mirror_path }}" mirror_host: "{{ ansible_local.domain.serverfqdn }}" - mirror_security_path: "{{ mirror_localpath }}/{{ mirror_security_host }}{{mirror_security_path }}" + mirror_security_path: "{{ mirror_localpath }}/{{ mirror_security_host }}{{ mirror_security_path }}" mirror_security_host: "{{ ansible_local.domain.serverfqdn }}" when: mirror_mode != 'remote' diff --git a/roles/preseed/templates/repoconfig/sources.list b/roles/preseed/templates/repoconfig/sources.list index b705988..f02d5fe 100644 --- a/roles/preseed/templates/repoconfig/sources.list +++ b/roles/preseed/templates/repoconfig/sources.list @@ -1,18 +1,18 @@ # Base repositories for Ubuntu 14.04 - Trusty Tahr -deb http://{{ execpath }}{{ host }}{{ path }} trusty main restricted universe multiverse -deb http://{{ execpath }}{{ host }}{{ path }} trusty-security main restricted universe multiverse -deb http://{{ execpath }}{{ host }}{{ path }} trusty-updates main restricted universe multiverse -deb http://{{ execpath }}{{ host }}{{ path }} trusty-backports main restricted universe multiverse +deb http://{{ mirror_host }}{{ mirror_path }} trusty main restricted universe multiverse +deb http://{{ mirror_host }}{{ mirror_path }} trusty-security main restricted universe multiverse +deb http://{{ mirror_host }}{{ mirror_path }} trusty-updates main restricted universe multiverse +deb http://{{ mirror_host }}{{ mirror_path }} trusty-backports main restricted universe multiverse # Sources -#deb-src http://{{ execpath }}{{ host }}{{ path }} trusty main restricted universe multiverse -#deb-src http://{{ execpath }}{{ host }}{{ path }} trusty-security main restricted universe multiverse -#deb-src http://{{ execpath }}{{ host }}{{ path }} trusty-updates main restricted universe multiverse -#deb-src http://{{ execpath }}{{ host }}{{ path }} trusty-backports main restricted universe multiverse +#deb-src http://{{ mirror_host }}{{ mirror_path }} trusty main restricted universe multiverse +#deb-src http://{{ mirror_host }}{{ mirror_path }} trusty-security main restricted universe multiverse +#deb-src http://{{ mirror_host }}{{ mirror_path }} trusty-updates main restricted universe multiverse +#deb-src http://{{ mirror_host }}{{ mirror_path }} trusty-backports main restricted universe multiverse # Security -deb http://{{ execpath }}{{ shost }}{{ spath }} trusty-security main restricted universe multiverse -#deb-src http://{{ execpath }}{{ shost }}{{ spath }} trusty-security main restricted universe multiverse +deb http://{{ mirror_security_host }}{{ mirror_security_path }} trusty-security main restricted universe multiverse +#deb-src http://{{ mirror_security_host }}{{ mirror_security_path }} trusty-security main restricted universe multiverse # Extras deb http://{{ execpath }}extras.ubuntu.com/ubuntu trusty main From df1dcc532b6dbd3497f79acc2b81a564e9455e54 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Sat, 12 Nov 2016 12:20:37 +0100 Subject: [PATCH 3/6] Modifiche per Salerno 3. --- domain.yml | 36 +++++++++---------- hosts | 2 +- .../templates/preseed/client-trusty.seed | 2 +- .../templates/preseed/dev/client-trusty.seed | 2 +- .../templates/preseed/dev/docenti-trusty.seed | 2 +- .../templates/preseed/docenti-trusty.seed | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/domain.yml b/domain.yml index c92dac3..945f993 100644 --- a/domain.yml +++ b/domain.yml @@ -1,31 +1,31 @@ --- # Configurazione dominio -ntpserver: pdc.topolin.ia +ntpserver: pdc.salerno3.ilariaalpi.edu server: pdc -serverip: 172.16.254.1 +serverip: 192.168.5.1 servernetmask: 255.255.255.0 -servernet: 172.16.254.0 -servergw: 172.16.254.1 -serverfqdn: pdc.topolin.ia -domainshort: TOPOLIN -domainfull: topolin.ia -dhcprange_start: 172.16.254.10 -dhcprange_end: 172.16.254.50 +servernet: 192.168.5.0 +servergw: 192.168.5.1 +serverfqdn: pdc.salerno3.ilariaalpi.edu +domainshort: SALERNO3 +domainfull: salerno3.ilariaalpi.edu +dhcprange_start: 192.168.5.10 +dhcprange_end: 192.168.5.60 extdnsserver1: 208.67.222.222 extdnsserver2: 208.67.220.220 -org_email: info@bglug.it -org_company: Accademia di SuperPippo -org_countrycode: IA -org_department: "Laboratorio 1" -org_city: Topolinia -org_phone: "313 113 176-167" -org_street: "Piazza la bomba e scappa" +org_email: miic8dz008@istruzione.it +org_company: Istituto Comprensivo Ilaria Alpi +org_countrycode: IT +org_department: "Laboratorio 1 - via Salerno, 3" +org_city: Milano +org_phone: 02 88444696 +org_street: Via Salerno, 3 edu_package: secondary -mirror_mode: remote +mirror_mode: local #mirror_nfs_share: 192.168.255.1:/var/spool/apt-mirror/mirror mirror_host: it.archive.ubuntu.com #mirror_path: /ubuntu #mirror_security_host: security.ubuntu.com #mirror_security_path: /ubuntu -client_gitbranch: master +client_gitbranch: ilariaalpi #client_gitrepo: "https://github.com/bglug-it/client-pull-installation.git" diff --git a/hosts b/hosts index 48a520d..ae9e99c 100644 --- a/hosts +++ b/hosts @@ -2,4 +2,4 @@ host_key_checking=false [server] -172.16.254.1 ansible_ssh_user=amgmt +172.16.123.167 ansible_ssh_user=amgmt diff --git a/roles/preseed/templates/preseed/client-trusty.seed b/roles/preseed/templates/preseed/client-trusty.seed index 5d04438..c776024 100644 --- a/roles/preseed/templates/preseed/client-trusty.seed +++ b/roles/preseed/templates/preseed/client-trusty.seed @@ -66,7 +66,7 @@ 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 password $6$S8u22loyR$RJZUtmnqmadvas13BxjPkBjdcF1o6P0xGtweZ9MkUCKIbyzmzQFxvwPTwoX1AaPgRyNmvdevyUgs/AMRGH8O./ +d-i passwd/user-password-crypted password $6$K8JQcf/LF$BiEHLimL5qsiPeOx/xfdV/uzvS4lSlo/sN5L2b.5QE93XkejiReKOMqS8nr0Who5tw5Imsn522vzF6QdrJJLb/ # Partitioning d-i partman-auto/init_automatically_partition select biggest_free diff --git a/roles/preseed/templates/preseed/dev/client-trusty.seed b/roles/preseed/templates/preseed/dev/client-trusty.seed index ae50a40..1fb766c 100644 --- a/roles/preseed/templates/preseed/dev/client-trusty.seed +++ b/roles/preseed/templates/preseed/dev/client-trusty.seed @@ -62,7 +62,7 @@ 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 password $6$S8u22loyR$RJZUtmnqmadvas13BxjPkBjdcF1o6P0xGtweZ9MkUCKIbyzmzQFxvwPTwoX1AaPgRyNmvdevyUgs/AMRGH8O./ +d-i passwd/user-password-crypted string $6$K8JQcf/LF$BiEHLimL5qsiPeOx/xfdV/uzvS4lSlo/sN5L2b.5QE93XkejiReKOMqS8nr0Who5tw5Imsn522vzF6QdrJJLb/ # Partitioning d-i partman-auto/init_automatically_partition select biggest_free diff --git a/roles/preseed/templates/preseed/dev/docenti-trusty.seed b/roles/preseed/templates/preseed/dev/docenti-trusty.seed index c9ea221..5bc717e 100644 --- a/roles/preseed/templates/preseed/dev/docenti-trusty.seed +++ b/roles/preseed/templates/preseed/dev/docenti-trusty.seed @@ -62,7 +62,7 @@ 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 password $6$S8u22loyR$RJZUtmnqmadvas13BxjPkBjdcF1o6P0xGtweZ9MkUCKIbyzmzQFxvwPTwoX1AaPgRyNmvdevyUgs/AMRGH8O./ +d-i passwd/user-password-crypted string $6$K8JQcf/LF$BiEHLimL5qsiPeOx/xfdV/uzvS4lSlo/sN5L2b.5QE93XkejiReKOMqS8nr0Who5tw5Imsn522vzF6QdrJJLb/ # Partitioning d-i partman-auto/init_automatically_partition select biggest_free diff --git a/roles/preseed/templates/preseed/docenti-trusty.seed b/roles/preseed/templates/preseed/docenti-trusty.seed index 5624bbc..faf53d4 100644 --- a/roles/preseed/templates/preseed/docenti-trusty.seed +++ b/roles/preseed/templates/preseed/docenti-trusty.seed @@ -66,7 +66,7 @@ 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 password $6$S8u22loyR$RJZUtmnqmadvas13BxjPkBjdcF1o6P0xGtweZ9MkUCKIbyzmzQFxvwPTwoX1AaPgRyNmvdevyUgs/AMRGH8O./ +d-i passwd/user-password-crypted password $6$K8JQcf/LF$BiEHLimL5qsiPeOx/xfdV/uzvS4lSlo/sN5L2b.5QE93XkejiReKOMqS8nr0Who5tw5Imsn522vzF6QdrJJLb/ # Partitioning d-i partman-auto/init_automatically_partition select biggest_free From 3a0035c61ece4e6f2d7f90e1290bf78a8d586c7b Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Tue, 17 Jan 2017 17:23:14 +0100 Subject: [PATCH 4/6] Piccola modifica su hosts per gestione in remoto. --- hosts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts b/hosts index ae9e99c..fcc335c 100644 --- a/hosts +++ b/hosts @@ -2,4 +2,4 @@ host_key_checking=false [server] -172.16.123.167 ansible_ssh_user=amgmt +192.168.5.1 ansible_ssh_user=amgmt From 0dbe53a796ac188fe82b32b1b0f2af8710264495 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Tue, 21 Feb 2017 22:18:29 +0100 Subject: [PATCH 5/6] Fixing latest differences with origin/master. --- roles/nethcfg/tasks/samba.yml | 4 ++-- roles/preseed/templates/preseed/aula-trusty.seed | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/nethcfg/tasks/samba.yml b/roles/nethcfg/tasks/samba.yml index a0fcd1c..de3baf8 100644 --- a/roles/nethcfg/tasks/samba.yml +++ b/roles/nethcfg/tasks/samba.yml @@ -13,7 +13,7 @@ # SAMBA -- name: "Verifying modifications on templates-custom." +- name: Verifying modifications on templates-custom. shell: grep -q 'server signing = mandatory' /etc/e-smith/templates-custom/etc/samba/smb.conf/10global register: check_tempcust changed_when: check_tempcust.rc != 0 @@ -21,7 +21,7 @@ - name: "Create directory structure for templates-custom" file: - path: "/etc/e-smith/templates-custom/etc/samba/smb.conf" + path: /etc/e-smith/templates-custom/etc/samba/smb.conf owner: root group: root mode: 0755 diff --git a/roles/preseed/templates/preseed/aula-trusty.seed b/roles/preseed/templates/preseed/aula-trusty.seed index 5e64442..26bac4c 100644 --- a/roles/preseed/templates/preseed/aula-trusty.seed +++ b/roles/preseed/templates/preseed/aula-trusty.seed @@ -66,7 +66,7 @@ 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 password $6$S8u22loyR$RJZUtmnqmadvas13BxjPkBjdcF1o6P0xGtweZ9MkUCKIbyzmzQFxvwPTwoX1AaPgRyNmvdevyUgs/AMRGH8O./ +d-i passwd/user-password-crypted password $6$K8JQcf/LF$BiEHLimL5qsiPeOx/xfdV/uzvS4lSlo/sN5L2b.5QE93XkejiReKOMqS8nr0Who5tw5Imsn522vzF6QdrJJLb/ # Partitioning d-i partman-auto/init_automatically_partition select biggest_free From 2881d042d96441c367e6556e1996e35d4d8f0104 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Tue, 24 Oct 2017 23:33:22 +0200 Subject: [PATCH 6/6] Using ip from VPN instead of the LAN one. --- hosts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts b/hosts index fcc335c..e62cc45 100644 --- a/hosts +++ b/hosts @@ -2,4 +2,4 @@ host_key_checking=false [server] -192.168.5.1 ansible_ssh_user=amgmt +172.16.99.22 ansible_ssh_user=amgmt