Browse Source

extract NTP logic

Joost Baaij 11 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
   apt: pkg=unattended-upgrades state=installed
32
   apt: pkg=unattended-upgrades state=installed
33
   when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
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
 - name: Apticron email configuration
35
 - name: Apticron email configuration
44
   template: src=apticron.conf.j2 dest=/etc/apticron/apticron.conf
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
 - name: Disable default Apache site
38
 - name: Disable default Apache site
50
   command: a2dissite 000-default removes=/etc/apache2/sites-enabled/000-default
39
   command: a2dissite 000-default removes=/etc/apache2/sites-enabled/000-default
51
   notify: restart apache
40
   notify: restart apache
59
 - include: ssl.yml tags=ssl
48
 - include: ssl.yml tags=ssl
60
 - include: ufw.yml tags=ufw
49
 - include: ufw.yml tags=ufw
61
 - include: security.yml tags=security
50
 - include: security.yml tags=security
51
+- include: ntp.yml tags=ntp

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

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