Local domain variables are loaded as part of local facts, as done with the server. Changed all tasks that require domain informations.

This commit is contained in:
Emiliano Vavassori 2015-09-21 01:29:34 +02:00
parent a4279e29fd
commit e9150df4ad
15 changed files with 76 additions and 105 deletions

View File

@ -9,7 +9,7 @@
- name: Adding/changing ansible ppa local mirror - name: Adding/changing ansible ppa local mirror
get_url: 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 dest: /etc/apt/sources.list.d/ansible-ansible-trusty.list
owner: root owner: root
group: root group: root

View File

@ -31,14 +31,14 @@
- name: Copying script to manage users in pulse and pulse-access - name: Copying script to manage users in pulse and pulse-access
copy: copy:
src: pulseaudio-perms.sh 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 mode: 0755
owner: root owner: root
group: root group: root
- name: Adding pulseaudio fixing script at reboot. - name: Adding pulseaudio fixing script at reboot.
lineinfile: 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 dest: /etc/cron.d/pulseaudio-perms
create: yes create: yes
state: present state: present

View File

@ -1,2 +1,2 @@
deb 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://{{ mirrorpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main # deb-src http://{{ ansible_local.domain.mirrorpath }}ppa.launchpad.net/ansible/ansible/ubuntu trusty main

View File

@ -2,55 +2,55 @@
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution. # newer versions of the distribution.
deb 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://{{ 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 ## Major bug fix updates produced after the final release of the
## distribution. ## distribution.
deb 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://{{ 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 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any ## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team. ## review or updates from the Ubuntu security team.
deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty universe
deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates universe deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://{{ 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 ## 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 ## 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 ## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu ## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team. ## security team.
deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse deb-src http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://{{ mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates multiverse deb http://{{ ansible_local.domain.mirrorpath }}archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://{{ 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 ## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes ## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features. ## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review ## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team. ## or updates from the Ubuntu security team.
deb 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://{{ 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 http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://{{ 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://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe deb http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe
deb-src http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe deb-src http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security universe
deb http://{{ mirrorpath }}security.ubuntu.com/ubuntu trusty-security multiverse deb http://{{ ansible_local.domain.mirrorpath }}security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://{{ 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 ## Uncomment the following two lines to add software from Canonical's
## 'partner' repository. ## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the ## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users. ## respective vendors as a service to Ubuntu users.
# deb http://{{ mirrorpath }}archive.canonical.com/ubuntu trusty partner # deb http://{{ ansible_local.domain.mirrorpath }}archive.canonical.com/ubuntu trusty partner
# deb-src http://{{ 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 ## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software. ## developers who want to ship their latest software.
deb http://{{ mirrorpath }}extras.ubuntu.com/ubuntu trusty main deb http://{{ ansible_local.domain.mirrorpath }}extras.ubuntu.com/ubuntu trusty main
deb-src http://{{ mirrorpath }}extras.ubuntu.com/ubuntu trusty main deb-src http://{{ ansible_local.domain.mirrorpath }}extras.ubuntu.com/ubuntu trusty main

View File

@ -3,7 +3,7 @@
- name: Getting epoptes server name - name: Getting epoptes server name
get_url: get_url:
url: "http://{{ serverfqdn }}:3000/epoptes-srv" url: "http://{{ ansible_local.domain.serverfqdn }}:3000/epoptes-srv"
dest: /tmp/epoptes-srv dest: /tmp/epoptes-srv
register: get_epo_srv_name register: get_epo_srv_name

View File

@ -4,5 +4,5 @@
- name: Configuring the Epoptes server - name: Configuring the Epoptes server
lineinfile: lineinfile:
dest: /etc/default/epoptes dest: /etc/default/epoptes
line: 'SOCKET_GROUP="{{ domainshort }}\docenti"' line: 'SOCKET_GROUP="{{ ansible_local.domain.domainshort }}\docenti"'
state: present state: present

View File

@ -13,7 +13,7 @@
replace: replace:
dest: /etc/apparmor.d/tunables/home dest: /etc/apparmor.d/tunables/home
regexp: '^@\{HOMEDIRS\}=/home/$' regexp: '^@\{HOMEDIRS\}=/home/$'
replace: '@{HOMEDIRS}=/home/ /home/{{ domainshort }}/' replace: '@{HOMEDIRS}=/home/ /home/{{ ansible_local.domain.domainshort }}/'
- name: SAMBA restart - name: SAMBA restart
shell: restart smbd shell: restart smbd
@ -27,7 +27,7 @@
- name: Creating home base - name: Creating home base
file: file:
path: '/home/{{ domainshort }}' path: '/home/{{ ansible_local.domain.domainshort }}'
owner: root owner: root
group: root group: root
state: directory state: directory

View File

@ -8,12 +8,12 @@
state: directory state: directory
with_items: with_items:
- '/usr/lib/firefox/browser/defaults/profile' - '/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 - name: Getting SSL transparent proxy certificate
get_url: get_url:
url: 'http://{{ serverfqdn }}/proxy.crt' url: 'http://{{ ansible_local.domain.serverfqdn }}/proxy.crt'
dest: '/usr/local/share/ca-certificates/{{ domainfull }}/ca.crt' dest: '/usr/local/share/ca-certificates/{{ ansible_local.domain.domainfull }}/ca.crt'
register: proxycrt_dwnl register: proxycrt_dwnl
- name: Adding certificate sto the ones used by the system - name: Adding certificate sto the ones used by the system
@ -23,5 +23,5 @@
- name: Firefox settings to include certificate - name: Firefox settings to include certificate
get_url: get_url:
url: 'http://{{ serverfqdn }}/ks/cert8.db' url: 'http://{{ ansible_local.domain.serverfqdn }}/ks/cert8.db'
dest: /usr/lib/firefox/browser/defaults/profile dest: /usr/lib/firefox/browser/defaults/profile

View File

@ -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

View File

@ -13,10 +13,10 @@ processed in a single pass from top-to-bottom
<!-- Volume definitions --> <!-- Volume definitions -->
<volume user="*" sgrp="domain users" fstype="cifs" <volume user="*" sgrp="domain users" fstype="cifs"
server="{{ server }}" path="%(USER)" mountpoint="~" server="{{ ansible_local.domain.server }}" path="%(USER)" mountpoint="~"
options="iocharset=utf8,file_mode=0644,dir_mode=0755,cache=strict" /> options="iocharset=utf8,file_mode=0644,dir_mode=0755,cache=strict" />
<volume user="*" sgrp="domain users" fstype="cifs" <volume user="*" sgrp="domain users" fstype="cifs"
server="{{ server }}" path="shared" mountpoint="~/Condiviso" server="{{ ansible_local.domain.server }}" path="shared" mountpoint="~/Condiviso"
options="iocharset=utf8,file_mode=0664,dir_mode=0775,cache=strict" /> options="iocharset=utf8,file_mode=0664,dir_mode=0775,cache=strict" />
<!-- pam_mount parameters: General tunables --> <!-- pam_mount parameters: General tunables -->

View File

@ -2,8 +2,8 @@
[global] [global]
security = domain security = domain
netbios name = {{ ansible_hostname }} netbios name = {{ ansible_hostname }}
password server = {{ serverfqdn }} password server = {{ ansible_local.domain.serverfqdn }}
workgroup = {{ domainshort }} workgroup = {{ ansible_local.domain.domainshort }}
idmap uid = 10000000-19999999 idmap uid = 10000000-19999999
idmap gid = 10000000-19999999 idmap gid = 10000000-19999999
winbind use default domain = yes winbind use default domain = yes

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }} # {{ ansible_managed }}
# Autorizzazione per gli utenti di dominio # Autorizzazione per gli utenti di dominio
%domain\ admins ALL=(ALL:ALL) NOPASSWD:ALL %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 %domopers ALL=(ALL:ALL) ALL
%{{ domainshort }}\\domopers ALL=(ALL:ALL) ALL %{{ ansible_local.domain.domainshort }}\\domopers ALL=(ALL:ALL) ALL

View File

@ -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)))

View File

@ -1,13 +1,33 @@
--- ---
- name: Download impostazioni dominio - name: Domain settings download
get_url: get_url:
url: "http://{{ ansible_default_ipv4.gateway }}:3000/domain" url: "http://{{ ansible_default_ipv4.gateway }}:3000/domain"
dest: /etc/domain.yml dest: /etc/domain.yml
owner: root owner: root
mode: 0644 mode: 0644
- name: Carico le variabili di dominio nel playbook per l'uso - name: Creating ansible facts directory
include_vars: /etc/domain.yml file:
tags: path: /etc/ansible/facts.d
- load_domain_vars 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

View File

@ -33,7 +33,7 @@
- name: Autorizzo chiave pubblica di amgmt del server - name: Autorizzo chiave pubblica di amgmt del server
authorized_key: authorized_key:
user: vagrant user: vagrant
key: "{{ 'http://' + serverfqdn + ':3000/mgmtkey' }}" key: "{{ 'http://' + ansible_local.domain.serverfqdn + ':3000/mgmtkey' }}"
sudo: yes sudo: yes
- name: Utilizzo il task di cleanup della box, prima di spegnere - name: Utilizzo il task di cleanup della box, prima di spegnere