summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Geerling <geerlingguy@mac.com>2014-03-16 21:17:40 -0500
committerJeff Geerling <geerlingguy@mac.com>2014-03-16 21:17:40 -0500
commit649b209845a576ddf29228db5bd340ebd6a7daf6 (patch)
tree2e96783a102fb2aad8c963df8cc14dd0e3468d67
parent748800e7f09118e7f0775062eb5c79bac42a77e9 (diff)
downloadntp-649b209845a576ddf29228db5bd340ebd6a7daf6.tar.gz
ntp-649b209845a576ddf29228db5bd340ebd6a7daf6.tar.bz2
ntp-649b209845a576ddf29228db5bd340ebd6a7daf6.tar.xz
ntp-649b209845a576ddf29228db5bd340ebd6a7daf6.zip
Add support for Debian/Ubuntu systems.
-rw-r--r--meta/main.yml6
-rw-r--r--tasks/main.yml13
-rw-r--r--vars/Debian.yml2
-rw-r--r--vars/RedHat.yml2
4 files changed, 20 insertions, 3 deletions
diff --git a/meta/main.yml b/meta/main.yml
index 7477ddf..6d19fee 100644
--- a/meta/main.yml
+++ b/meta/main.yml
@@ -11,5 +11,11 @@ galaxy_info:
- name: EL
versions:
- 6
+ - name: Debian
+ versions:
+ - all
+ - name: Ubuntu
+ versions:
+ - all
categories:
- system
diff --git a/tasks/main.yml b/tasks/main.yml
index 11211c2..0e39a79 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -1,10 +1,17 @@
---
-# Date and timezone (NTP).
+- name: Include OS-specific variables.
+ include_vars: "{{ ansible_os_family }}.yml"
+
- name: Set the correct timezone.
file: src=/usr/share/zoneinfo/{{ ntp_timezone }} dest=/etc/localtime state=link force=yes
-- name: Install NTP.
+- name: Install NTP on RHEL flavors.
yum: name=ntp state=installed
+ when: ansible_os_family == 'RedHat'
+
+- name: Install NTP on Debian flavors.
+ apt: name=ntp state=installed
+ when: ansible_os_family == 'Debian'
- name: Ensure NTP is running.
- service: name=ntpd state=started enabled=yes
+ service: name={{ ntp_daemon }} state=started enabled=yes
diff --git a/vars/Debian.yml b/vars/Debian.yml
new file mode 100644
index 0000000..f0c5744
--- /dev/null
+++ b/vars/Debian.yml
@@ -0,0 +1,2 @@
+---
+ntp_daemon: ntp
diff --git a/vars/RedHat.yml b/vars/RedHat.yml
new file mode 100644
index 0000000..430d7d0
--- /dev/null
+++ b/vars/RedHat.yml
@@ -0,0 +1,2 @@
+---
+ntp_daemon: ntpd