This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
129 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
# ericsysmin.chrony | ||
|
||
This role enables users to install and configure chrony on their hosts. | ||
|
||
## Build Status | ||
|
||
[![Build Status](https://travis-ci.org/ericsysmin/ansible-role-chrony.svg?branch=master)](https://travis-ci.org/ericsysmin/ansible-role-chrony) | ||
|
||
## Requirements | ||
|
||
None | ||
|
||
## Role Variables | ||
|
||
| Variable | Required | Default | Comments | | ||
| -------- | -------- | ------- | -------- | | ||
| `chrony_pkg_state` | No | `present` | Set pkg `enabled`, `disabled`, `latest` | | ||
| `chrony_service_state` | No | `started` | Set service state, started, enabled or disabled | | ||
| `chrony_service_enabled` | No | `yes` | A list of NTP servers to use. | | ||
| `chrony_config_server` | No | `[{"0.pool.ntp.org", "options": [{"option":"iburst"}]}, {"1.pool.ntp.org", "options": [{"option":"iburst"}]}, {"2.pool.ntp.org", "options": [{"option":"iburst"}]}, {"3.pool.ntp.org", "options": [{"option":"iburst"}]}]` | A list of NTP servers, or list of maps of NTP servers and options to use (see example in defaults/main.yml). | | ||
| `chrony_config_logdir` | No | `/var/log/chrony` | A list of NTP servers to use. | | ||
| `chrony_config_extra_options` | No | `{}` | A dict of extra config options. | | ||
|
||
## Examples | ||
|
||
1) Install chrony and use the default settings. | ||
```yaml | ||
- hosts: all | ||
roles: | ||
- role: ericsysmin.chrony | ||
``` | ||
2) Install chrony and use custom servers. | ||
```yaml | ||
- hosts: all | ||
roles: | ||
- role: ericsysmin.chrony | ||
chrony_config_server: | ||
- 0.pool.ntp.org | ||
- 2.pool.ntp.org | ||
``` | ||
## License | ||
MIT | ||
## Author Information | ||
[ericsysmin](https://ericsysmin.com) | ||
# ericsysmin.chrony | ||
|
||
This role enables users to install and configure chrony on their hosts. | ||
|
||
## Build Status | ||
|
||
[![Build Status](https://travis-ci.org/ericsysmin/ansible-role-chrony.svg?branch=master)](https://travis-ci.org/ericsysmin/ansible-role-chrony) | ||
|
||
## Requirements | ||
|
||
None | ||
|
||
## Role Variables | ||
|
||
| Variable | Required | Default | Comments | | ||
| -------- | -------- | ------- | -------- | | ||
| `chrony_pkg_state` | No | `present` | Set pkg `enabled`, `disabled`, `latest` | | ||
| `chrony_service_state` | No | `started` | Set service state, started, enabled or disabled | | ||
| `chrony_service_enabled` | No | `yes` | A list of NTP servers to use. | | ||
| `chrony_config_server` | No | `[{"0.pool.ntp.org", "options": [{"option":"iburst"}]}, {"1.pool.ntp.org", "options": [{"option":"iburst"}]}, {"2.pool.ntp.org", "options": [{"option":"iburst"}]}, {"3.pool.ntp.org", "options": [{"option":"iburst"}]}]` | A list of NTP servers, or list of maps of NTP servers and options to use (see example in defaults/main.yml). | | ||
| `chrony_config_logdir` | No | `/var/log/chrony` | A list of NTP servers to use. | | ||
| `chrony_config_extra_options` | No | `{}` | A dict of extra config options. | | ||
|
||
## Examples | ||
|
||
1) Install chrony and use the default settings. | ||
```yaml | ||
- hosts: all | ||
roles: | ||
- role: ericsysmin.chrony | ||
``` | ||
2) Install chrony and use custom servers. | ||
```yaml | ||
- hosts: all | ||
roles: | ||
- role: ericsysmin.chrony | ||
chrony_config_server: | ||
- 0.pool.ntp.org | ||
- 2.pool.ntp.org | ||
``` | ||
## License | ||
MIT | ||
## Author Information | ||
[ericsysmin](https://ericsysmin.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
--- | ||
chrony_pkg_state: present | ||
chrony_service_state: started | ||
chrony_service_enabled: yes | ||
chrony_config_server: | ||
- server: 0.pool.ntp.org | ||
options: | ||
- option: iburst | ||
- server: 1.pool.ntp.org | ||
options: | ||
- option: iburst | ||
- server: 2.pool.ntp.org | ||
options: | ||
- option: iburst | ||
- server: 3.pool.ntp.org | ||
options: | ||
- option: iburst | ||
|
||
# See also an example of chrony_config_server with options in option\val pairs: | ||
#chrony_config_server: | ||
# - server: 0.pool.ntp.org | ||
# options: | ||
# - option: iburst | ||
# - option: minpoll | ||
# val: 8 | ||
# - server: 1.pool.ntp.org | ||
# options: | ||
# - option: iburst | ||
# - option: minpoll | ||
# val: 8 | ||
# - server: 2.pool.ntp.org | ||
# options: | ||
# - option: iburst | ||
# - option: minpoll | ||
# val: 8 | ||
# - server: 3.pool.ntp.org | ||
# options: | ||
# - option: iburst | ||
# - option: minpoll | ||
# val: 8 | ||
chrony_config_logdir: /var/log/chrony | ||
chrony_config_extra_options: {} | ||
--- | ||
chrony_pkg_state: present | ||
chrony_service_state: started | ||
chrony_service_enabled: yes | ||
chrony_config_server: | ||
- server: 0.pool.ntp.org | ||
options: | ||
- option: iburst | ||
- server: 1.pool.ntp.org | ||
options: | ||
- option: iburst | ||
- server: 2.pool.ntp.org | ||
options: | ||
- option: iburst | ||
- server: 3.pool.ntp.org | ||
options: | ||
- option: iburst | ||
|
||
# See also an example of chrony_config_server with options in option\val pairs: | ||
#chrony_config_server: | ||
# - server: 0.pool.ntp.org | ||
# options: | ||
# - option: iburst | ||
# - option: minpoll | ||
# val: 8 | ||
# - server: 1.pool.ntp.org | ||
# options: | ||
# - option: iburst | ||
# - option: minpoll | ||
# val: 8 | ||
# - server: 2.pool.ntp.org | ||
# options: | ||
# - option: iburst | ||
# - option: minpoll | ||
# val: 8 | ||
# - server: 3.pool.ntp.org | ||
# options: | ||
# - option: iburst | ||
# - option: minpoll | ||
# val: 8 | ||
chrony_config_logdir: /var/log/chrony | ||
chrony_config_extra_options: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,38 @@ | ||
# {{ ansible_managed }} | ||
|
||
# List of NTP servers to use. | ||
{% for item in chrony_config_server %} | ||
{% if item['options'] is not defined %} | ||
server {{ item['server'] }} | ||
{% elif item['options'] is defined %} | ||
server {{ item['server'] }}{% for opt in item['options'] %} {{ opt['option'] }}{% if opt['val'] is defined %} {{ opt['val'] }}{% endif %}{% endfor %} | ||
|
||
{% endif %} | ||
{% endfor %} | ||
|
||
# This directive specify the location of the file containing ID/key pairs for | ||
# NTP authentication. | ||
keyfile {{ chrony_config_keyfile }} | ||
|
||
# This directive specify the file into which chronyd will store the rate | ||
# information. | ||
driftfile {{ chrony_config_driftfile }} | ||
|
||
# Uncomment the following line to turn logging on. | ||
#log tracking measurements statistics | ||
|
||
# Log files location. | ||
logdir {{chrony_config_logdir }} | ||
|
||
# Stop bad estimates upsetting machine clock. | ||
maxupdateskew 100.0 | ||
|
||
# This directive enables kernel synchronisation (every 11 minutes) of the | ||
# real-time clock. Note that it can't be used along with the 'rtcfile' directive. | ||
rtcsync | ||
|
||
# Step the system clock instead of slewing it if the adjustment is larger than | ||
# one second, but only in the first three clock updates. | ||
makestep 1 3 | ||
|
||
# Extra options | ||
{% for k, v in chrony_config_extra_options.items() %} | ||
{{ k }} {{ v }} | ||
{% endfor %} | ||
# {{ ansible_managed }} | ||
|
||
# List of NTP servers to use. | ||
{% for item in chrony_config_server %} | ||
|
||
server {{ item['server'] }} {% if item['options'] is defined -%} {% for opt in item['options'] %} {{ opt['option'] }}{% if opt['val'] is defined %} {{ opt['val'] }}{% endif %}{% endfor %} | ||
{%- endif %} | ||
{% endfor %} | ||
|
||
# This directive specify the location of the file containing ID/key pairs for | ||
# NTP authentication. | ||
keyfile {{ chrony_config_keyfile }} | ||
|
||
# This directive specify the file into which chronyd will store the rate | ||
# information. | ||
driftfile {{ chrony_config_driftfile }} | ||
|
||
# Uncomment the following line to turn logging on. | ||
#log tracking measurements statistics | ||
|
||
# Log files location. | ||
logdir {{chrony_config_logdir }} | ||
|
||
# Stop bad estimates upsetting machine clock. | ||
maxupdateskew 100.0 | ||
|
||
# This directive enables kernel synchronisation (every 11 minutes) of the | ||
# real-time clock. Note that it can't be used along with the 'rtcfile' directive. | ||
rtcsync | ||
|
||
# Step the system clock instead of slewing it if the adjustment is larger than | ||
# one second, but only in the first three clock updates. | ||
makestep 1 3 | ||
|
||
# Extra options | ||
{% for k, v in chrony_config_extra_options.items() %} | ||
{{ k }} {{ v }} | ||
{% endfor %} |