diff --git a/roles/base/tasks/apt-sources.yml b/roles/base/tasks/apt-sources.yml
index 46ee695..e0bf876 100644
--- a/roles/base/tasks/apt-sources.yml
+++ b/roles/base/tasks/apt-sources.yml
@@ -9,7 +9,7 @@
- name: Adding/changing ansible ppa local mirror
get_url:
- url: "http://{{ serverfqdn }}/ks/ansible-ansible-trusty.list"
+ url: "http://{{ ansible_local.domain.serverfqdn }}/ks/ansible-ansible-trusty.list"
dest: /etc/apt/sources.list.d/ansible-ansible-trusty.list
owner: root
group: root
diff --git a/roles/base/tasks/audio.yml b/roles/base/tasks/audio.yml
index 3f7352e..619d465 100644
--- a/roles/base/tasks/audio.yml
+++ b/roles/base/tasks/audio.yml
@@ -31,14 +31,14 @@
- name: Copying script to manage users in pulse and pulse-access
copy:
src: pulseaudio-perms.sh
- dest: '/var/lib/{{ domainfull }}/bin/pulseaudio-perms.sh'
+ dest: '/var/lib/{{ ansible_local.domain.domainfull }}/bin/pulseaudio-perms.sh'
mode: 0755
owner: root
group: root
- name: Adding pulseaudio fixing script at reboot.
lineinfile:
- line: '@reboot root /var/lib/{{ domainfull }}/bin/pulseaudio-perms.sh >/dev/null 2>&1'
+ line: '@reboot root /var/lib/{{ ansible_local.domain.domainfull }}/bin/pulseaudio-perms.sh >/dev/null 2>&1'
dest: /etc/cron.d/pulseaudio-perms
create: yes
state: present
diff --git a/roles/base/templates/ansible-ansible-trusty.list b/roles/base/templates/ansible-ansible-trusty.list
index aac68e7..b3a40a2 100644
--- a/roles/base/templates/ansible-ansible-trusty.list
+++ b/roles/base/templates/ansible-ansible-trusty.list
@@ -1,2 +1,2 @@
-deb http://{{ mirrorpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main
-# deb-src http://{{ mirrorpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main
+deb http://{{ ansible_local.domain.mirrorpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main
+# deb-src http://{{ ansible_local.domain.mirrorpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main
diff --git a/roles/base/templates/sources.list b/roles/base/templates/sources.list
index ae40b90..fb5be0f 100644
--- a/roles/base/templates/sources.list
+++ b/roles/base/templates/sources.list
@@ -2,55 +2,55 @@
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty main restricted
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty main restricted
+deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty main restricted
+deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates main restricted
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates main restricted
+deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates main restricted
+deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates universe
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates universe
+deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe
+deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe
+deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates universe
+deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates multiverse
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates multiverse
+deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse
+deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse
+deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates multiverse
+deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
+deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
+deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
-deb http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted
-deb-src http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted
-deb http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe
-deb-src http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe
-deb http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security multiverse
-deb-src http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security multiverse
+deb http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted
+deb-src http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted
+deb http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe
+deb-src http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe
+deb http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security multiverse
+deb-src http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
-# deb http://{{ mirrorpath }}archive.canonical.com/ubuntu trusty partner
-# deb-src http://{{ mirrorpath }}archive.canonical.com/ubuntu trusty partner
+# deb http://{{ ansible_local.domain.mirrorpath }}archive.canonical.com/ubuntu trusty partner
+# deb-src http://{{ ansible_local.domain.mirrorpath }}archive.canonical.com/ubuntu trusty partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
-deb http://{{ mirrorpath }}extras.ubuntu.com/ubuntu trusty main
-deb-src http://{{ mirrorpath }}extras.ubuntu.com/ubuntu trusty main
+deb http://{{ ansible_local.domain.mirrorpath }}extras.ubuntu.com/ubuntu trusty main
+deb-src http://{{ ansible_local.domain.mirrorpath }}extras.ubuntu.com/ubuntu trusty main
diff --git a/roles/client/tasks/epoptes.yml b/roles/client/tasks/epoptes.yml
index 944be3b..9290840 100644
--- a/roles/client/tasks/epoptes.yml
+++ b/roles/client/tasks/epoptes.yml
@@ -3,7 +3,7 @@
- name: Getting epoptes server name
get_url:
- url: "http://{{ serverfqdn }}:3000/epoptes-srv"
+ url: "http://{{ ansible_local.domain.serverfqdn }}:3000/epoptes-srv"
dest: /tmp/epoptes-srv
register: get_epo_srv_name
diff --git a/roles/docenti/tasks/epoptes.yml b/roles/docenti/tasks/epoptes.yml
index cc1783a..7f508a2 100644
--- a/roles/docenti/tasks/epoptes.yml
+++ b/roles/docenti/tasks/epoptes.yml
@@ -4,5 +4,5 @@
- name: Configuring the Epoptes server
lineinfile:
dest: /etc/default/epoptes
- line: 'SOCKET_GROUP="{{ domainshort }}\docenti"'
+ line: 'SOCKET_GROUP="{{ ansible_local.domain.domainshort }}\docenti"'
state: present
diff --git a/roles/domain/tasks/smb_config.yml b/roles/domain/tasks/smb_config.yml
index d878279..b35780b 100644
--- a/roles/domain/tasks/smb_config.yml
+++ b/roles/domain/tasks/smb_config.yml
@@ -13,7 +13,7 @@
replace:
dest: /etc/apparmor.d/tunables/home
regexp: '^@\{HOMEDIRS\}=/home/$'
- replace: '@{HOMEDIRS}=/home/ /home/{{ domainshort }}/'
+ replace: '@{HOMEDIRS}=/home/ /home/{{ ansible_local.domain.domainshort }}/'
- name: SAMBA restart
shell: restart smbd
@@ -27,7 +27,7 @@
- name: Creating home base
file:
- path: '/home/{{ domainshort }}'
+ path: '/home/{{ ansible_local.domain.domainshort }}'
owner: root
group: root
state: directory
diff --git a/roles/domain/tasks/sslproxy.yml b/roles/domain/tasks/sslproxy.yml
index 3a4e330..82d8622 100644
--- a/roles/domain/tasks/sslproxy.yml
+++ b/roles/domain/tasks/sslproxy.yml
@@ -8,12 +8,12 @@
state: directory
with_items:
- '/usr/lib/firefox/browser/defaults/profile'
- - '/usr/local/share/ca-certificates/{{ domainfull }}'
+ - '/usr/local/share/ca-certificates/{{ ansible_local.domain.domainfull }}'
- name: Getting SSL transparent proxy certificate
get_url:
- url: 'http://{{ serverfqdn }}/proxy.crt'
- dest: '/usr/local/share/ca-certificates/{{ domainfull }}/ca.crt'
+ url: 'http://{{ ansible_local.domain.serverfqdn }}/proxy.crt'
+ dest: '/usr/local/share/ca-certificates/{{ ansible_local.domain.domainfull }}/ca.crt'
register: proxycrt_dwnl
- name: Adding certificate sto the ones used by the system
@@ -23,5 +23,5 @@
- name: Firefox settings to include certificate
get_url:
- url: 'http://{{ serverfqdn }}/ks/cert8.db'
+ url: 'http://{{ ansible_local.domain.serverfqdn }}/ks/cert8.db'
dest: /usr/lib/firefox/browser/defaults/profile
diff --git a/roles/domain/templates/apt/sources.list b/roles/domain/templates/apt/sources.list
deleted file mode 100644
index ae40b90..0000000
--- a/roles/domain/templates/apt/sources.list
+++ /dev/null
@@ -1,56 +0,0 @@
-#deb cdrom:[Edubuntu 14.04 LTS _Trusty Tahr_ - Release i386 (20140417)]/ trusty main multiverse restricted universe
-
-# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
-# newer versions of the distribution.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty main restricted
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty main restricted
-
-## Major bug fix updates produced after the final release of the
-## distribution.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates main restricted
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates main restricted
-
-## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
-## team. Also, please note that software in universe WILL NOT receive any
-## review or updates from the Ubuntu security team.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates universe
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates universe
-
-## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
-## team, and may not be under a free licence. Please satisfy yourself as to
-## your rights to use the software. Also, please note that software in
-## multiverse WILL NOT receive any review or updates from the Ubuntu
-## security team.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates multiverse
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates multiverse
-
-## N.B. software from this repository may not have been tested as
-## extensively as that contained in the main release, although it includes
-## newer versions of some applications which may provide useful features.
-## Also, please note that software in backports WILL NOT receive any review
-## or updates from the Ubuntu security team.
-deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
-deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
-
-deb http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted
-deb-src http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted
-deb http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe
-deb-src http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe
-deb http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security multiverse
-deb-src http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security multiverse
-
-## Uncomment the following two lines to add software from Canonical's
-## 'partner' repository.
-## This software is not part of Ubuntu, but is offered by Canonical and the
-## respective vendors as a service to Ubuntu users.
-# deb http://{{ mirrorpath }}archive.canonical.com/ubuntu trusty partner
-# deb-src http://{{ mirrorpath }}archive.canonical.com/ubuntu trusty partner
-
-## This software is not part of Ubuntu, but is offered by third-party
-## developers who want to ship their latest software.
-deb http://{{ mirrorpath }}extras.ubuntu.com/ubuntu trusty main
-deb-src http://{{ mirrorpath }}extras.ubuntu.com/ubuntu trusty main
diff --git a/roles/domain/templates/pam_mount.conf.xml b/roles/domain/templates/pam_mount.conf.xml
index 77e04ad..0e39b65 100644
--- a/roles/domain/templates/pam_mount.conf.xml
+++ b/roles/domain/templates/pam_mount.conf.xml
@@ -13,10 +13,10 @@ processed in a single pass from top-to-bottom
diff --git a/roles/domain/templates/smb.conf b/roles/domain/templates/smb.conf
index a3e587e..2eabbca 100644
--- a/roles/domain/templates/smb.conf
+++ b/roles/domain/templates/smb.conf
@@ -2,8 +2,8 @@
[global]
security = domain
netbios name = {{ ansible_hostname }}
- password server = {{ serverfqdn }}
- workgroup = {{ domainshort }}
+ password server = {{ ansible_local.domain.serverfqdn }}
+ workgroup = {{ ansible_local.domain.domainshort }}
idmap uid = 10000000-19999999
idmap gid = 10000000-19999999
winbind use default domain = yes
diff --git a/roles/domain/templates/sudoers.d b/roles/domain/templates/sudoers.d
index 27d779e..762cfc9 100644
--- a/roles/domain/templates/sudoers.d
+++ b/roles/domain/templates/sudoers.d
@@ -1,6 +1,6 @@
# {{ ansible_managed }}
# Autorizzazione per gli utenti di dominio
%domain\ admins ALL=(ALL:ALL) NOPASSWD:ALL
-%{{ domainshort }}\\domain\ admins ALL=(ALL:ALL) NOPASSWD:ALL
+%{{ ansible_local.domain.domainshort }}\\domain\ admins ALL=(ALL:ALL) NOPASSWD:ALL
%domopers ALL=(ALL:ALL) ALL
-%{{ domainshort }}\\domopers ALL=(ALL:ALL) ALL
+%{{ ansible_local.domain.domainshort }}\\domopers ALL=(ALL:ALL) ALL
diff --git a/roles/prereq/files/domain.fact b/roles/prereq/files/domain.fact
new file mode 100644
index 0000000..7f4612c
--- /dev/null
+++ b/roles/prereq/files/domain.fact
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+from yaml import load
+from json import dumps
+
+with open('/etc/domain.yml') as file:
+ print(dumps(load(file)))
diff --git a/roles/prereq/tasks/prereq.yml b/roles/prereq/tasks/prereq.yml
index 73aa40d..0a5f205 100644
--- a/roles/prereq/tasks/prereq.yml
+++ b/roles/prereq/tasks/prereq.yml
@@ -1,13 +1,33 @@
---
-- name: Download impostazioni dominio
+- name: Domain settings download
get_url:
url: "http://{{ ansible_default_ipv4.gateway }}:3000/domain"
dest: /etc/domain.yml
owner: root
mode: 0644
-- name: Carico le variabili di dominio nel playbook per l'uso
- include_vars: /etc/domain.yml
- tags:
- - load_domain_vars
+- name: Creating ansible facts directory
+ file:
+ path: /etc/ansible/facts.d
+ state: directory
+ owner: root
+ group: root
+ mode: 0755
+
+- name: Assuring python-yaml is installed
+ apt:
+ name: python-yaml
+ state: present
+
+- name: Creating facts.d script for the domain settings
+ copy:
+ src: domain.fact
+ dest: /etc/ansible/facts.d/domain.fact
+ owner: root
+ group: root
+ mode: 0755
+
+- name: Loading domain variables
+ setup:
+ filter: ansible_local
diff --git a/roles/vagrantbox/tasks/vagrantbox.yml b/roles/vagrantbox/tasks/vagrantbox.yml
index 3556095..97af71f 100644
--- a/roles/vagrantbox/tasks/vagrantbox.yml
+++ b/roles/vagrantbox/tasks/vagrantbox.yml
@@ -33,7 +33,7 @@
- name: Autorizzo chiave pubblica di amgmt del server
authorized_key:
user: vagrant
- key: "{{ 'http://' + serverfqdn + ':3000/mgmtkey' }}"
+ key: "{{ 'http://' + ansible_local.domain.serverfqdn + ':3000/mgmtkey' }}"
sudo: yes
- name: Utilizzo il task di cleanup della box, prima di spegnere