Browse Source

extract NTP logic

Joost Baaij 10 years ago
parent
commit
4837d2e87a
2 changed files with 15 additions and 11 deletions
  1. 1
    11
      roles/common/tasks/main.yml
  2. 14
    0
      roles/common/tasks/ntp.yml

+ 1
- 11
roles/common/tasks/main.yml View File

@@ -32,20 +32,9 @@
32 32
   apt: pkg=unattended-upgrades state=installed
33 33
   when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
34 34
 
35
-- name: Install ntp
36
-  apt: pkg=ntp state=installed
37
-
38
-- name: Configure ntp
39
-  template: src=ntp.conf.j2 dest=/etc/ntp.conf
40
-  notify:
41
-    - restart ntp
42
-
43 35
 - name: Apticron email configuration
44 36
   template: src=apticron.conf.j2 dest=/etc/apticron/apticron.conf
45 37
 
46
-- name: Ensure ntpd is running and enabled
47
-  service: name=ntp state=started enabled=yes
48
-
49 38
 - name: Disable default Apache site
50 39
   command: a2dissite 000-default removes=/etc/apache2/sites-enabled/000-default
51 40
   notify: restart apache
@@ -59,3 +48,4 @@
59 48
 - include: ssl.yml tags=ssl
60 49
 - include: ufw.yml tags=ufw
61 50
 - include: security.yml tags=security
51
+- include: ntp.yml tags=ntp

+ 14
- 0
roles/common/tasks/ntp.yml View File

@@ -0,0 +1,14 @@
1
+---
2
+# Defines tasks applicable for NTP (Network Time Protocol)
3
+
4
+- name: Install ntp
5
+  apt: pkg=ntp state=installed
6
+
7
+- name: Configure ntp
8
+  template: src=ntp.conf.j2 dest=/etc/ntp.conf
9
+  notify:
10
+    - restart ntp
11
+
12
+- name: Ensure ntpd is running and enabled
13
+  service: name=ntp state=started enabled=yes
14
+

Loading…
Cancel
Save