Failed 'Puppet Setup NTP Server' task... Buggy?

Hi all,

@Inderpreet

I failed this task, but I’d like to know if it is because I missed a step or because it is buggy.

  1. I needed to revoke the certificates from the Jump_host (Puppet Master) so the App Servers running the Puppet Agent could connect to it. After doing this, the App Servers could successfully connect using ‘puppet agent -t’ with the Puppet Master. No further complains about this point but I’m not sure if this step is really intended to be performed as part of the task.

Behavior seen in the 3 App Servers.

  1. The Manifest in the Puppet master looks like below, but I kept getting the following error messages on the App servers when running ‘puppet agent -t’.

Error: Could not prefetch package provider ‘yum’: The yum provider can only be used as root
Error: Failed to apply catalog: The yum provider can only be used as root

I tried running ‘puppet agent -t’ as root on the App Servers but a bunch of error messages flooded the screen so it wasn’t even possible to connect with the Puppet Master. Also, I do not think it is intended to run the Agent as ‘root’.

Behavior seen in the 3 App Servers.

Did I miss anything in the Puppet Manifest?

[root@jump_host manifests]# cat beta.pp
class ntpconfig {
package {“ntp”:
ensure=> “present”,
}
file {"/etc/ntp.conf":
ensure=> “present”,
content=> “server 1.sg.pool.ntp.org\n”,
}
}
include ntpconfig

I even tried replacing the last line with the one below but another error showed up when trying to apply the manifest with ‘puppet apply beta.pp’

node ‘stapp01.stratos.xfusioncorp.com’,‘stapp02.stratos.xfusioncorp.com’,‘stapp03.stratos.xfusioncorp.com’{
include ntpconfig
}

  1. Finally the error message generated as output for the failed task refers to http when the task is about ntp (see screenshot)

Thoughts?




I think you forgot to use sudo or access from root user.

Thanks but I don’t think that was the case. Commands on Jump_host (Puppet Master) were running all in ‘root’. I did try on App Servers (Puppet Agents) running the commands with ‘sudo’ and/or moving to ‘root’ user but it gave me the same bunch of error messages on both cases. I didn’t capture that screenshot though.

FYI I passed that task succesfully using the ntp class :
Sources:
https://aeria.gitbooks.io/puppet-quest-guide/content/quests/ntp.html
https://fullstack-puppet-docs.readthedocs.io/en/latest/puppet_modules.html
https://stackoverflow.com/questions/27237285/puppet-call-another-pp
https://www.diycode.cc/projects/puppetlabs/puppetlabs-ntp
https://github.com/puppetlabs/puppetlabs-ntp
https://puppet.com/docs/puppet/latest/quick_start_ntp.html
https://forge.puppet.com/puppetlabs/ntp
https://www.edureka.co/community/53038/managing-a-ntp-service-using-puppet
https://www.arctiq.ca/our-blog/2017/11/13/creating-puppet-modules-for-satellite-with-smart-class-parameters/

1 Like

Thank you. I first found the “native” ntp class that is available for Puppet. However, I didn’t use it because tasks’ instructions explicitly say “define a custom class ntpconfig”. Therefore, I went that route.
Shouldn’t the instructions change so we can confidently use the Puppet’s “native” ntp class to perform this task?

One more reason I think this task is a bit buggy is because the Task Status - Failed log package httpd as seen in the screenshot. Is the validation script really looking for the httpd service on the App Servers? If so, it must be fixed.
Although, I must agree that because “Error: Could not prefetch package provider ‘yum’: The yum provider can only be used as root” the ntp configs were not in the App Servers at the moment I submitted the task. Perhaps, this ‘yum’ error message wouldn’t have appeared by using Puppet’s ‘native’ ntp class but again, instructions were explicit here.

Can you share sources for archive resource for zip file? @Goldenor

I did’nt use any archive resource, just I install ntp module and I define a class that calls the ntp class

Are we allowed to use ntp module ?.. as the task instructed to use the custom class.

This is the same confusion I had. :thinking:

Yeah But before that we have to install that module in the node right to perform tasks? :thinking:

That module install part will come if I would have tried to use it.

I agree with @gustavos86 that the question is misleading.

Thanks @player001 for the clarification.

One more thing to clarify, please don’t mind if its a basic question… how to define custom class ntpconfig using ntp module? I checked the links that @Goldenor shared but its everywhere class ntp but the question says to use class ntpconfig. What does that mean?

Is it okay. We are learning so no words of ‘dont’ mind’ comes in b/w. Btw what kind of links you are talking about? I haven’t share yet i guess? or point me out where i have shared?

@kleansoul Question explicitly says “define custom class” and not “install ntp module”, so…

It made me think that the below was what it wanted me to do.

https://www.guru99.com/puppet-tutorial.html

#Class Definition

class ntpconfig {
# Installing NTP Package
package {“ntp”:
ensure=> “present”,
}
# Configuring NTP configuration file
file {"/etc/ntp.conf":
ensure=> “present”,
content=> “server 0.centos.pool.ntp.org iburst\n”,
}
# Starting NTP services
service {“ntpd”:
ensure=> “running”,
}
}

@gustavos86 Your solution seems like what the task asked for … except that the task point 3 specifically states not to manage the service.

I wonder how @Goldenor passed the same task using ntp class?

service should be enable okay but don’t start/stop/restart service of ntp.

@kleansoul @player001
I agree. What I did was (see screenshot in the opening question of this post)

[root@jump_host manifests]# cat beta.pp
class ntpconfig {
package {“ntp”:
ensure=> “present”
}
file {"/etc/ntp.conf":
ensure=> “present”,
content=> “server 1.sg.pool.ntp.org\n”
}
}
include ntpconfig

@mmumshad, @Inderpreet, @KodeKloud, @kodekloud-support3

I don’t know if I have permissions to share the solution, but it works like that :

puppet module install puppetlabs-ntp

class { ntp:
servers => [ 2.cn.pool.ntp.org ],
}
class ntpconfig {
include ntp
}

node stapp01.stratos.xfusioncorp.com,stapp02.stratos.xfusioncorp.com,stapp03.stratos.xfusioncorp.com {
include ntpconfig
}

2 Likes

@Goldenor Thanks :heart_eyes: :+1:

1 Like

he he he @Goldenor Not all time.


I dont know what is my problem with puppet. All ansible tasks have been passed, but puppet no.
what why nginx is required in ntp server!!!