Skip to content

Commit

Permalink
Disable monlist in NTP & fixed failed_when in /etc/ntp.keys replace
Browse files Browse the repository at this point in the history
  • Loading branch information
pyllyukko committed Nov 9, 2023
1 parent 95fab29 commit b5f4316
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions tasks/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,26 @@
Storage: none
ProcessSizeMax: 0

- name: Comment out default keys from /etc/ntp.keys
- name: NTP
become: true
register: result
failed_when:
- result.failed == true
- result.state != "absent"
tags:
- ntp
ansible.builtin.replace:
path: /etc/ntp.keys
regexp: '^((1|65535)\s+M\s+(akey|pass))$'
replace: '#\g<1>'
tags: ntp
block:
- name: Comment out default keys from /etc/ntp.keys
register: result
failed_when:
- result.failed
- result.msg != "Path /etc/ntp.keys does not exist !"
ansible.builtin.replace:
path: /etc/ntp.keys
regexp: '^((1|65535)\s+M\s+(akey|pass))$'
replace: '#\g<1>'
- name: Disable monlist in NTP
ansible.builtin.lineinfile:
path: /etc/ntp.conf
regexp: '^disable\s+monitor$'
line: disable monitor
create: false
register: result
failed_when:
- result.failed
- result.msg != "Destination /etc/ntp.conf does not exist !"

0 comments on commit b5f4316

Please sign in to comment.