Browse Source

Common: fix ntp template

Change timezone in /etc/timezone instead of debconf.

Moving the host_vars directory in root directory in order to respect http://docs.ansible.com/playbooks_best_practices.html#directory-layout
pull/1/head
nanowish 9 years ago
parent
commit
5313ab2864
5 changed files with 16 additions and 17 deletions
  1. +0
    -0
      host_vars/localhost.example
  2. +5
    -6
      postint.yml.README
  3. +4
    -1
      roles/common/handlers/main.yml
  4. +7
    -9
      roles/common/tasks/main.yml
  5. +0
    -1
      roles/common/templates/etc-ntp.conf.j2

etc/host_vars/localhost.example → host_vars/localhost.example View File


+ 5
- 6
postint.yml.README View File

@ -28,9 +28,9 @@ Après la description suivent des exemples de ces variables.
- default_packages_debian : la liste des packages debian a installer par defaut
- ansible_fqdn : le nom a donner au serveur
- description : La description du serveur (s'affichera a la connexion)
- ntp_server1 : le premier serveur NTP a utiliser
- ntp_server2 : le deuxième serveur ntp a installer
- ntp_servers : liste de serveurs NTP à utiliser
- disable_ipv6 : IPv6 doit il etre desactive ou non
- tzdata_timezone: Permet de définir une timezone personnalisée (Europe/Paris est définie par défaut)
### Exemples de variables ###
fichier : /etc/ansible/group_vars/all :
@ -48,9 +48,8 @@ ansible_fqdn: serveur-debian.exemple.com
description: Bienvenue sur ce serveur debian
ntp_server1: 0.fr.pool.ntp.org
ntp_server2: 1.fr.pool.ntp.org
ntp_servers:
- 0.fr.pool.ntp.org
- 1.fr.pool.ntp.org
disable_ipv6: yes

+ 4
- 1
roles/common/handlers/main.yml View File

@ -40,5 +40,8 @@
- name: apt-update
command: apt-get update
# vim: set textwidth=0 ft=yaml ts=2 sw=2 expandtab:
- name: update timezone
command: dpkg-reconfigure --frontend noninteractive tzdata
# vim: set textwidth=0 ft=yaml ts=2 sw=2 expandtab:

+ 7
- 9
roles/common/tasks/main.yml View File

@ -10,7 +10,6 @@
when: ansible_distribution == 'Debian'
# Check mandatory variables
- name: Check vars
fail: msg="Missing variable admin_ssh_keys"
when: admin_ssh_keys is not defined
@ -32,17 +31,16 @@
when: disable_ipv6 is not defined
# SSH
- name: Deploy SSH keys
tags: ssh_keys
authorized_key: user=root key="{{item}}"
with_items: "{{admin_ssh_keys}}"
with_items: admin_ssh_keys
# Packages
- name: Install default packages Debian.
apt: pkg={{item}} state=installed
with_items: "{{ default_packages_debian }}"
with_items: default_packages_debian
when: ansible_distribution == 'Debian'
# Configure NTP
@ -89,11 +87,11 @@
debconf: name=locales question='locales/locales_to_be_generated' value='fr_FR.UTF-8, UTF-8' vtype='multiselect'
when: ansible_distribution == 'Debian'
- name: Set the timezone
tags: environ
debconf: name=tzdata question='tzdata/Zones/Etc' value='UTC' vtype='select'
debconf: name=tzdata question='tzdata/Areas' value='Europe' vtype='select'
debconf: name=tzdata question='tzdata/Zones/Europe' value='Paris' vtype='select'
- name: Set timezone
copy: content='{{ tzdata_timezone | default('Europe/Paris') }}'
dest=/etc/timezone owner=root group=root mode=0644
notify:
- update timezone
when: ansible_distribution == 'Debian'
- name: Disable IPv6 (need reboot)

+ 0
- 1
roles/common/templates/etc-ntp.conf.j2 View File

@ -9,7 +9,6 @@ filegen clockstats file clockstats type day enable
{% for server in ntp_servers %}
server {{ server }}
restrict {{ server }} nomodify nopeer
restrict {{ server }} nomodify nopeer
{% endfor %}
restrict default ignore
restrict -6 default ignore

Loading…
Cancel
Save