Hi Keith

Might be worth looking into Ansible Galaxy Roles – following Link actually 
gives NTP as an example too:

https://www.linuxtechi.com/use-ansible-galaxy-roles-ansible-playbook/

Regards
Phil


From: ansible-project@googlegroups.com <ansible-project@googlegroups.com> On 
Behalf Of mills.kei...@gmail.com
Sent: 08 July 2019 14:52
To: Ansible Project <ansible-project@googlegroups.com>
Subject: [ansible-project] Ansible NTP Roles

My name is Keith and I'm a Systems Engineer with HPE, Houston, TX location. We 
use Ansible here for configuration management but I'm new to Ansible and would 
like your help with Ansible NTP Roles. This is what I have so far:

/roles/base/tasks/main.yml:

---



## PLAYBOOK TO INSTALL AND CONFIGURE NTP ON REDHAT/DEBIAN/SLES/UBUNTU SYSTEMS





---
## Playbook to Install and Configure NTP on RedHat/Debian/SLES/Ubuntu Systems

- hosts:
roles:
- ntp
...

vars:

Debian.yaml:

--- ntp_package: ntp ntp_service: ntp ntp_config: /etc/ntp.conf ntp_servers: - 
0.ubuntu.pool.ntp.org - 1.ubuntu.pool.ntp.org - 2.ubuntu.pool.ntp.org - 
3.ubuntu.pool.ntp.org ...

Redhat.yaml:

---
ntp_package: ntp
ntp_service: ntpd
ntp_config: /etc/ntp.conf
ntp_servers:
   - 0.redhat.pool.ntp.org iburst
   - 1.redhat.pool.ntp.org iburst
   - 2.redhat.pool.ntp.org iburst
   - 3.redhat.pool.ntp.org iburst
...

Sles.yaml:

--- ntp_package: ntp ntp_service: ntpd ntp_config: /etc/ntp.conf ntp_servers: - 
0.sles.pool.ntp.org iburst - 1.sles.pool.ntp.org iburst - 2.sles.pool.ntp.org 
iburst - 3.sles.pool.ntp.org iburst ...

Ubuntu.yaml:

--- ntp_package: ntp ntp_service: ntp ntp_config: /etc/ntp.conf ntp_servers: - 
0.ubuntu.pool.ntp.org - 1.ubuntu.pool.ntp.org - 2.ubuntu.pool.ntp.org - 
3.ubuntu.pool.ntp.org ...

handlers:

main.yaml:

--- # handlers file for ntp - name: restart ntp service: name: "{{ ntp_daemon 
}}" state: restarted when: ntp_enabled | bool ...

defaults:

main.yaml:

--- # defaults file for ntp ntp_enabled: true ntp_timezone: America/Denver # 
ntpdate_server: pool.ntp.org ntp_manage_config: false # NTP server area 
configuration (leave empty for 'Worldwide'). # See: 
http://support.ntp.org/bin/view/Servers/NTPPoolServers ntp_area: '' 
ntp_servers: - "0{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst" 
- "1{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst" - "2{{ '.' + 
ntp_area if ntp_area else '' }}.pool.ntp.org iburst" - "3{{ '.' + ntp_area if 
ntp_area else '' }}.pool.ntp.org iburst" ntp_restrict: - "127.0.0.1" - "::1" ...

I need Roles for RHEL 6/7; SLES 11/12/15; Debian 6/7/8/9; Ubuntu 12/14/16. I 
need the ntp state to be enabled! I don't know if I should use the ntp config 
file! I don't know if there is a ntp module that I should use! I would really 
appreciate your help! Some direction would be greatly appreciated!
Regards,

Keith
--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to 
ansible-project@googlegroups.com<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/68edd718-f193-463f-a103-f00f864c555f%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/68edd718-f193-463f-a103-f00f864c555f%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/69223b5457364037b34eeba92da33e8d%40bham.ac.uk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to