Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ansible
common
Commits
0e33c704
Commit
0e33c704
authored
9 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
Added ntp sync handling for Debian and OpenBSD.
parent
64efa9bf
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
handlers/main.yml
+11
-0
11 additions, 0 deletions
handlers/main.yml
tasks/ntp.yml
+6
-0
6 additions, 0 deletions
tasks/ntp.yml
tasks/ntpd.yml
+34
-0
34 additions, 0 deletions
tasks/ntpd.yml
tasks/systemd-timesyncd.yml
+16
-0
16 additions, 0 deletions
tasks/systemd-timesyncd.yml
with
67 additions
and
0 deletions
handlers/main.yml
+
11
−
0
View file @
0e33c704
...
...
@@ -23,3 +23,14 @@
service
:
name
:
collectd
state
:
restarted
-
name
:
Restart ntpd
service
:
name
:
'
{{
"ntpd"
if
ansible_os_family
==
"OpenBSD"
else
omit
}}'
name
:
'
{{
"ntp"
if
ansible_os_family
==
"Debian"
else
omit
}}'
state
:
restarted
-
name
:
Restart systemd-timesyncd
service
:
name
:
systemd-timesyncd
state
:
restarted
This diff is collapsed.
Click to expand it.
tasks/ntp.yml
+
6
−
0
View file @
0e33c704
...
...
@@ -3,3 +3,9 @@
-
name
:
Assert
assert
:
that
:
ansible_os_family in [ 'Debian', 'OpenBSD' ]
-
include
:
ntp_OpenBSD.yml
when
:
ansible_os_family == 'OpenBSD' or not ansible_init == 'systemd'
-
include
:
systemd-timesyncd.yml
when
:
ansible_os_family == 'Debian' and ansible_init == 'systemd'
This diff is collapsed.
Click to expand it.
tasks/ntpd.yml
0 → 100644
+
34
−
0
View file @
0e33c704
---
-
assert
:
that
:
ansible_os_family in [ 'Debian', 'OpenBSD' ]
-
name
:
apt install ntpd
when
:
ansible_pkg_mgr == 'apt'
apt
:
name
:
ntp
state
:
present
update_cache
:
yes
cache_valid_time
:
3600
-
name
:
Configure ntpd
lineinfile
:
line
:
'
{{
"servers
pool.ntp.org"
if
ansible_os_family
==
"OpenBSD"
else
omit
}}'
line
:
'
{{
"server
debian.pool.ntp.org"
if
ansible_os_family
==
"OpenBSD"
else
omit
}}'
regexp
:
'
{{
"^servers
"
if
ansible_os_family
==
"OpenBSD"
else
omit
}}'
regexp
:
'
{{
"^server
"
if
ansible_os_family
==
"Debian"
else
omit
}}'
dest
:
'
{{
"/etc/ntpd.conf"
if
ansible_os_family
==
"OpenBSD"
else
omit
}}'
dest
:
'
{{
"/etc/ntp.conf"
if
ansible_os_family
==
"Debian"
else
omit
}}'
create
:
yes
owner
:
root
group
:
wheel
mode
:
'
0644'
notify
:
-
Restart ntpd
-
name
:
Enable ntpd
service
:
name
:
'
{{
"ntpd"
if
ansible_os_family
==
"OpenBSD"
else
omit
}}'
name
:
'
{{
"ntp"
if
ansible_os_family
==
"Debian"
else
omit
}}'
enabled
:
yes
state
:
started
This diff is collapsed.
Click to expand it.
tasks/systemd-timesyncd.yml
0 → 100644
+
16
−
0
View file @
0e33c704
---
-
name
:
Configure systemd-timesyncd
lineinfile
:
dest
:
/etc/systemd/timesyncd.conf
line
:
'
NTP=0.debian.pool.ntp.org
1.debian.pool.ntp.org
2.debian.pool.ntp.org
3.debian.pool.ntp.org'
regexp
:
'
^NTP='
state
:
present
notify
:
-
'
Restart
systemd-timesyncd'
-
name
:
Enable systemd-timesyncd
service
:
name
:
systemd-timesyncd
enabled
:
yes
state
:
started
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment