mirror of
https://github.com/roles-ansible/ansible_role_ntp.git
synced 2024-08-16 12:59:49 +02:00
Compare commits
15 commits
Author | SHA1 | Date | |
---|---|---|---|
c3fabc5fc6 | |||
1dc572a323 | |||
|
59d5fa615a | ||
|
1191c064fc | ||
262d12ab23 | |||
|
0dabbd7c42 | ||
09864d03a2 | |||
b65dfe4504 | |||
cac94e5c60 | |||
ca0c9f60b5 | |||
5adecb3a0e | |||
48fcac7e4c | |||
bc84cec5fb | |||
a3ac34e33d | |||
7a6b87da63 |
20 changed files with 87 additions and 24 deletions
2
.github/workflows/ansible-linting-check.yml
vendored
2
.github/workflows/ansible-linting-check.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Run ansible-lint
|
- name: Run ansible-lint
|
||||||
uses: ansible-actions/ansible-lint-action@v1.0.2
|
uses: ansible-actions/ansible-lint-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
target: "./"
|
target: "./"
|
||||||
collections_yml: "requirements.yml"
|
collections_yml: "requirements.yml"
|
||||||
|
|
2
.github/workflows/galaxy.yml
vendored
2
.github/workflows/galaxy.yml
vendored
|
@ -19,6 +19,6 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: 'Release on galaxy'
|
- name: 'Release on galaxy'
|
||||||
uses: ansible-actions/ansible-galaxy-action@v1.1.1
|
uses: ansible-actions/ansible-galaxy-action@v1.2.0
|
||||||
with:
|
with:
|
||||||
galaxy_api_key: ${{ secrets.galaxy_api_key }}
|
galaxy_api_key: ${{ secrets.galaxy_api_key }}
|
||||||
|
|
2
.github/workflows/yamllint-check.yml
vendored
2
.github/workflows/yamllint-check.yml
vendored
|
@ -17,6 +17,6 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Run yamllint
|
- name: Run yamllint
|
||||||
uses: ansible-actions/yamllint-action@v0.0.1
|
uses: ansible-actions/yamllint-action@v0.0.2
|
||||||
with:
|
with:
|
||||||
target: "./"
|
target: "./"
|
||||||
|
|
|
@ -38,6 +38,10 @@ ntp_servers:
|
||||||
ntp_set_time_zone: false
|
ntp_set_time_zone: false
|
||||||
ntp_timezone: 'Europe/Berlin'
|
ntp_timezone: 'Europe/Berlin'
|
||||||
|
|
||||||
|
# Leap seconds definition provided by tzdata
|
||||||
|
ntp_leap: true
|
||||||
|
ntp_leapfile: '/usr/share/zoneinfo/leap-seconds.list'
|
||||||
|
|
||||||
# Enable or disable ntp statistics
|
# Enable or disable ntp statistics
|
||||||
ntp_statistics: false
|
ntp_statistics: false
|
||||||
|
|
||||||
|
@ -83,6 +87,9 @@ You can install it with this command:
|
||||||
ansible-galaxy collection install -r requirements.yml --upgrade
|
ansible-galaxy collection install -r requirements.yml --upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
This role is tested on debian stable. It should work on other operating systems. Please Report issues if it does not work.
|
||||||
|
|
||||||
## Author Information
|
## Author Information
|
||||||
|
|
||||||
+ This role was created in 2018 by diodonfrost.
|
+ This role was created in 2018 by diodonfrost.
|
||||||
|
|
|
@ -20,10 +20,19 @@ ntp_servers:
|
||||||
|
|
||||||
# Enable or disable ntp statistics
|
# Enable or disable ntp statistics
|
||||||
ntp_statistics: false
|
ntp_statistics: false
|
||||||
|
ntp_ntpstats_dir: '/var/log/ntpstats/'
|
||||||
|
ntp_statistics_overview:
|
||||||
|
- 'clockstats'
|
||||||
|
- 'peerstats'
|
||||||
|
- 'loopstats'
|
||||||
|
|
||||||
# optionally set timezone
|
# optionally set timezone
|
||||||
ntp_set_time_zone: false
|
ntp_set_time_zone: false
|
||||||
ntp_timezone: 'Europe/Berlin'
|
ntp_timezone: 'Europe/Berlin'
|
||||||
|
|
||||||
|
# Leap seconds definition provided by tzdata
|
||||||
|
ntp_leap: true
|
||||||
|
ntp_leapfile: '/usr/share/zoneinfo/leap-seconds.list'
|
||||||
|
|
||||||
# version check for this playbook (true is recomended)
|
# version check for this playbook (true is recomended)
|
||||||
submodules_versioncheck: false
|
submodules_versioncheck: false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: Restart ntp daemons on Linux
|
- name: Restart ntp daemons on Linux
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.service:
|
ansible.builtin.systemd:
|
||||||
name: "{{ ntp_service }}"
|
name: "{{ ntp_service }}"
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,13 @@
|
||||||
group: "{{ ntp_configfile_group }}"
|
group: "{{ ntp_configfile_group }}"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: "Restart ntp daemons on {{ ansible_system }}"
|
notify: "Restart ntp daemons on {{ ansible_system }}"
|
||||||
|
|
||||||
|
- name: Create logging folder
|
||||||
|
become: true
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ ntp_ntpstats_dir }}"
|
||||||
|
state: directory
|
||||||
|
recurse: true
|
||||||
|
mode: 'u=rwX,g=rX,o=rX'
|
||||||
|
owner: "{{ ntp_user }}"
|
||||||
|
notify: "Restart ntp daemons on {{ ansible_system }}"
|
||||||
|
|
|
@ -16,7 +16,13 @@
|
||||||
when: ansible_os_family == "Gentoo"
|
when: ansible_os_family == "Gentoo"
|
||||||
tags: 'skip_ansible_lint'
|
tags: 'skip_ansible_lint'
|
||||||
|
|
||||||
- name: Install ntp daemon on Linux
|
- name: Remove ntp legacy daemon on Linux
|
||||||
|
become: true
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: "{{ ntp_package_absent }}"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Install ntpsec daemon on Linux
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name: "{{ ntp_package }}"
|
name: "{{ ntp_package }}"
|
||||||
|
@ -24,7 +30,7 @@
|
||||||
|
|
||||||
- name: Service ntp on Linux
|
- name: Service ntp on Linux
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.service:
|
ansible.builtin.systemd:
|
||||||
name: "{{ ntp_service }}"
|
name: "{{ ntp_service }}"
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
- name: Check playbook version
|
- name: Check playbook version
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.slurp:
|
ansible.builtin.slurp:
|
||||||
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
src: "/etc/.ansible-version/{{ ntp__playbook_version_path }}"
|
||||||
register: playbook_version
|
register: playbook_version
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
content: "{{ playbook_version_number }}"
|
content: "{{ playbook_version_number }}"
|
||||||
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
|
dest: "/etc/.ansible-version/{{ ntp__playbook_version_path }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
tags: skip_ansible_lint_template-instead-of-copy
|
tags: skip_ansible_lint_template-instead-of-copy
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
#####################################
|
######################################################
|
||||||
## ##
|
## ##
|
||||||
## THIS FILE IS MANAGED BY ANSIBLE ##
|
## THIS FILE IS MANAGED BY ANSIBLE ##
|
||||||
## ##
|
## ##
|
||||||
## It is about time ##
|
## It is about time ##
|
||||||
## ##
|
## ##
|
||||||
#####################################
|
######################################################
|
||||||
# > galaxy.ansible.com/do1jlr/ntp < #
|
# > galaxy.ansible.com/ui/repo/published/l3d/time/ < #
|
||||||
driftfile {{ ntp_driftfile }}
|
driftfile {{ ntp_driftfile }}
|
||||||
|
|
||||||
|
{% if ntp_leap %}
|
||||||
|
# Leap seconds definition provided by tzdata
|
||||||
|
leapfile {{ ntp_leapfile }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% for restrict_ip in ntp_restrict %}
|
{% for restrict_ip in ntp_restrict %}
|
||||||
restrict {{ restrict_ip }}
|
restrict {{ restrict_ip }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -17,5 +22,13 @@ server {{ pool_server }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if ntp_statistics | bool %}
|
{% if ntp_statistics | bool %}
|
||||||
statistics clockstats cryptostats loopstats peerstats
|
statistics {{ ntp_statistics_overview | join(' ') }}
|
||||||
|
|
||||||
|
# Enable this if you want statistics to be logged.
|
||||||
|
statsdir {{ ntp_ntpstats_dir }}
|
||||||
|
|
||||||
|
{% for stat in ntp_statistics_overview %}
|
||||||
|
filegen {{ stat }} file {{ stat }} type day enable
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
---
|
---
|
||||||
ntp_package: ntp
|
ntp_package: 'ntpsec'
|
||||||
|
ntp_package_absent: 'ntp'
|
||||||
ntp_service: ntpd
|
ntp_service: ntpd
|
||||||
|
ntp_user: 'ntpsec'
|
||||||
|
|
||||||
ntp_configfile: /etc/ntp.conf
|
ntp_configfile: /etc/ntpsec/ntp.conf
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
ntp_configfile_group: root
|
ntp_configfile_group: root
|
||||||
ntp_driftfile: /var/lib/ntp/drift
|
ntp_driftfile: /var/lib/ntp/drift
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
ntp_package:
|
ntp_package: ntp
|
||||||
ntp_service: ntp
|
ntp_service: ntp
|
||||||
|
ntp_package_absent: []
|
||||||
|
ntp_user: 'ntp'
|
||||||
|
|
||||||
ntp_configfile: /private/etc/ntp.conf
|
ntp_configfile: /private/etc/ntp.conf
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
---
|
---
|
||||||
ntp_package: ntp
|
ntp_package: 'ntpsec'
|
||||||
ntp_service: ntp
|
ntp_package_absent: 'ntp'
|
||||||
|
ntp_service: 'ntpsec'
|
||||||
|
ntp_user: 'ntpsec'
|
||||||
|
|
||||||
ntp_configfile: /etc/ntp.conf
|
ntp_configfile: '/etc/ntpsec/ntp.conf'
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
ntp_configfile_group: root
|
ntp_configfile_group: root
|
||||||
ntp_driftfile: /var/lib/ntp/drift
|
ntp_driftfile: /var/lib/ntp/drift
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
ntp_package: ntp
|
ntp_package: ntp
|
||||||
|
ntp_package_absent: []
|
||||||
ntp_service: ntpd
|
ntp_service: ntpd
|
||||||
|
ntp_user: 'ntp'
|
||||||
|
|
||||||
ntp_configfile: /etc/ntp.conf
|
ntp_configfile: /etc/ntp.conf
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
ntp_package: net-misc/ntp
|
ntp_package: net-misc/ntp
|
||||||
|
ntp_package_absent: []
|
||||||
ntp_service: ntp-client
|
ntp_service: ntp-client
|
||||||
|
ntp_user: 'ntp'
|
||||||
|
|
||||||
ntp_configfile: /etc/ntp.conf
|
ntp_configfile: /etc/ntp.conf
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
ntp_package: ntp
|
ntp_package: ntp
|
||||||
|
ntp_package_absent: []
|
||||||
ntp_service: ntpd
|
ntp_service: ntpd
|
||||||
|
ntp_user: 'ntp'
|
||||||
|
|
||||||
ntp_configfile: /etc/ntp.conf
|
ntp_configfile: /etc/ntp.conf
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
ntp_package: ntp
|
ntp_package: ntp
|
||||||
|
ntp_package_absent: []
|
||||||
ntp_service: ntpd
|
ntp_service: ntpd
|
||||||
|
ntp_user: 'ntp'
|
||||||
|
|
||||||
ntp_configfile: /etc/ntp.conf
|
ntp_configfile: /etc/ntp.conf
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
ntp_package: ntp
|
ntp_package: ntp
|
||||||
|
ntp_package_absent: []
|
||||||
ntp_service: ntpd
|
ntp_service: ntpd
|
||||||
|
ntp_user: 'ntp'
|
||||||
|
|
||||||
ntp_configfile: /etc/ntp.conf
|
ntp_configfile: /etc/ntp.conf
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
ntp_package: ntp
|
ntp_package: ntp
|
||||||
|
ntp_package_absent: []
|
||||||
ntp_service: ntp
|
ntp_service: ntp
|
||||||
|
ntp_user: 'ntp'
|
||||||
|
|
||||||
ntp_configfile: /etc/ntp.conf
|
ntp_configfile: /etc/ntp.conf
|
||||||
ntp_configfile_user: root
|
ntp_configfile_user: root
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
playbook_version_number: 2059
|
playbook_version_number: 2062
|
||||||
ntp__playbook_version_path: 'role-ntp_chaos-bodensee_github.com.version'
|
ntp__playbook_version_path: 'role-ntp_chaos-bodensee_github.com.version'
|
||||||
|
|
||||||
ntp__vars:
|
ntp__vars:
|
||||||
|
|
Loading…
Add table
Reference in a new issue