Puppet agent daemon should not start during startup - puppet

I have installed puppet agent in my servers.
1.My agent is running automatically and is stopping my apache which is installed via puppet.
puppet agent --configprint runinterval
1800
2.I can kill the process but do not want this process to start during server reboot.
Can someone have any ideas?

Hmm. After installing my agent for the first time, I ran it the first time, to request a certificate from master with
sudo puppet agent --verbose --no-daemonize --onetime
Which (among other things) instructs the agent to not continue running as a daemon.
Then after signing the cert on master I am able to run the agent on demand with.
sudo puppet agent -t
The -t (--test) flag on the agent effectively adds --onetime --verbose --no-daemonize --no-usecacheonfailure --detailed-exitcodes --no-splay --show_diff --no-use_cached_catalog to the agent run. Therefore this way the agent is always run --nodaemonize, and I have not run into the problem of the agent running automatically.
Not sure if this addresses your use case.

Related

How can I run Puppet 6 on-demand against multiple remote Linux nodes?

On Puppet 3, I used to use sudo mco puppet runonce -I /hostname-pattern-1/ -I /hostname-pattern-2/ to run Puppet agents on-demand against any node matching one of the hostname patterns.
As of Puppet 5.5.4, MCollective is deprecated, so I can no longer use the mco command.
With Puppet 6, how can I do what I used to be able to do with the mco command?
My server and all my nodes are running Ubuntu 20 (Linux). I'm specifically using Puppet 6.19.1 and Puppet Server 6.14.1.
I know puppet agent -t can be used to run Puppet on-demand, but that has to be done locally on each node, so how can I apply that command (or something equivalent) from the Puppet server to any node matching a pattern?
I know I could hardcode a bunch of hostnames in a Bash script and use SSH to remotely execute the command, but hardcoding hostnames is not as convenient as specifying hostname patterns.
Have you checked choria?
Puppet Bolt might be another alternative, you could write a task to do something more complex, or just run ad-hoc commands
e.g.
bolt command run 'puppet agent -t' --targets servers
You connect bolt to your puppetdb so you won't have to create and update a static inventory

How to create a httpd container in docker through jenkins job?

I need help in creating the container through Jenkins job.
Let me know the steps to be followed: I have already created 3 jobs in Jenkins, and I want to create httpd container through the jobs created.
Should I install any plugins or write any script ?
Assuling we are not talking about Jenkins in docker, or Jenkins agents in Docker, you need to create your http container manually first, without Jenkins.
That means:
validate your SSH access to the remote server
Check it has Docker installed
execute docker commands to run an http container, s described in Docker httpd
Once that is working, you can replicate the process in a Jenkins Job, provided your remote server (the one with Docker, where you want to run your httpd container) is declared as agent to the main Jenkins controller.

what does puppet do when a service's status fails?

I have this in my event log for one of my nodes in the puppet dash board:
Changed (1)
Service[openstack-keystone] (/etc/puppetlabs/puppet/modules/keystone/manifests/init.pp:129)
Property Message
ensure ensure changed 'stopped' to 'running'
But how can I see what actually command puppet is using to change the service's state from stopped to running?
And how can I change it, if I don't think puppet is doing the correct thing?
You can run puppet agent -t --debug to manually start a puppet run and see the commands being run.
To change the commands, you can consider specifying the provider or the start, stop, status, and restart commands on the service resource. Check out the type reference for more information on the service type's parameters.
1)If you want to see the background work of puppet means how it is applying the catalog.
step1) Stop the puppet master and client daemon. eg:/etc/init.d/puppetmaster stop.
step2) Run the puppet master and puppet agent as a foreground process to see the
- puppet master --no-daemonize (run master as foreground process)
- puppet master --debug --no-daemonize (To debug the puppet master)
- puppet agent --no-daemonize (run agent as foreground)
- puppet agent --debug --no-daemonize (run as foreground and debug)
2) If you think puppet is not doing this properly, you can write your own DSL with puppet types and provider or go with the EXEC to execute commands.Even though if you feel that it is not working as yo then you can write the script to execute on agent nodes.

Puppet agent on Debian client does not start on boot

I have a Debian VM with puppet client installed.
All is well when I manually run:
puppet agent
after I run it, I can see using "service puppet status" that the process is running OK.
I want this process (starting the puppet agent) to happen automatically on system boot.
I followed the instructions of changing /etc/init.d/puppet so that it starts
START=yes
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/puppet
DAEMON_OPTS=""
NAME=agent
DESC="puppet agent"
PIDFILE="/var/run/puppet/${NAME}.pid"
BUT - when I boot the system, this service does not start !
What am I doing wrong ?
I
You need to set START=yes in /etc/default/puppet instead of right in the initscript.
As an aside, this question would be more suitable on ServerFault.

Unable to restart rogue Jenkins on Ubuntu

I was configuring Jenkins last night to run some reporting plugins (codestyle, findbugs, cobertura). When I ran my build job it got hung up somewhere in codestyle, and the server ui became unresponsive.
Today I logged in to the server and the Jenkins log is reporting errors that look like the server ran out of memory, but more than that, I cannot seem to stop or restart the server. I have limited experience with services in linux.
Jenkins was installed on Ubuntu with atp. I have tried $ sudo /etc/init.d/jenkins restart but it reports
* Starting Jenkins Continuous Integration Server jenkins
The selected http port (8080) seems to be in use by another program
Please select another port to use for jenkins
When I try to run service jenkins status to get a pid to kill i get
2 instances of jenkins are running at the moment
but the pidfile /var/run/jenkins/jenkins.pid is missing
Running netstat and ps has identified the port being held by a jenkins instance.
How can I recover from this?
Mostly I was concerned about abruptly killing the Jenkins server while it has gone rogue. Something this tied into process with server connections and plugins makes me wary of taking a shotgun to the process.
That's exactly what I did. server jenkins status didn't work, so I got the process id from netstat -tulpn. kill -15 didn't work so I did kill -9, waited a respectful grieving period, then restarted the Jenkins service.
I will next be investigating the root problem of running out of memory in my Jenkins installation so hopefully this doesn't happen again while I am firewalled away from my server.
Where is your server hosted?
I had the same issue with AWS EC2 server.
Command lines did not work to reboot the server.
However, on AWS admin console, I did: EC2 -> restart and it works like a charm.
This may not be a solution but a workaround.
I was able to do
sudo ps aux | grep jenkins
To find a list of jenkins processes. Then I ran
sudo kill <pid>
And then finally
sudo service jenkins restart

Resources