Task:
While troubleshooting one of the issue on app servers in Stratos Datacenter DevOps team identified the root cause that the time isn't synchronized properly among all app servers which cause issues sometimes. So team has decided to use a specific time server for all app servers so that they all remain in sync. This task needs to be done using Puppet so as per details mentioned below please compete the task:
Create a puppet programming file apps.pp under /etc/puppetlabs/code/environments/production/manifests directory on puppet master node i.e on Jump Server. Within the programming file define a custom class ntpconfig to install and configure ntp server on all app servers.
Also add NTP Server server 1.africa.pool.ntp.org in default configuration file on all app servers.
Please note that do not try to start/restart/stop ntp service as we already have a scheduled restart for this service tonight and we don't want these changes to be applied right now.
Note: Please perform this task using apps.pp only, do not try to create any separate inventory file.
Step 1) Create puppet class file apps.pp on jump host where puppet master is running
root@jump_host /etc/puppetlabs/code/environments/production/manifests# cat apps.pp
class ntpconfig {
#Installing NTP Package
package {"ntp":
ensure => 'present',
}
#Add content to ntp configuration file
file {"/etc/ntp.conf":
ensure => "present",
content => "server 1.africa.pool.ntp.org",
}
#Start NTP Services
service {"ntpd":
ensure => "running",
}
}
node 'stapp01.stratos.xfusioncorp.com', 'stapp02.stratos.xfusioncorp.com', 'stapp03.stratos.xfusioncorp.com' {
include ntpconfig
}
Step 2) Validate the syntax
root@jump_host /etc/puppetlabs/code/environments/production/manifests# puppet parser validate apps.pp
Step 3) Run puppet agent -tv on app server 1, Server 2 and Server 3 and validate if ntp server is running.
[root@stapp01 ~]# puppet agent -tv
[root@stapp01 ~]# ps -ef | grep ntp
ntp 413 1 0 00:50 ? 00:00:00 /usr/sbin/ntpd -u ntp:ntp -g
root 416 164 0 00:50 pts/0 00:00:00 grep --color=auto ntp
[root@stapp02 ~]# puppet agent -tv
[root@stapp02 ~]# ps -ef | grep ntp
ntp 413 1 0 00:50 ? 00:00:00 /usr/sbin/ntpd -u ntp:ntp -g
root 416 164 0 00:50 pts/0 00:00:00 grep --color=auto ntp
[root@stapp03 ~]# puppet agent -tv
[root@stapp03 ~]# ps -ef | grep ntp
ntp 413 1 0 00:50 ? 00:00:00 /usr/sbin/ntpd -u ntp:ntp -g
root 416 164 0 00:50 pts/0 00:00:00 grep --color=auto ntp
No comments:
Post a Comment