Puppet agent on Debian client does not start on boot - puppet

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.

Related

Puppet agent daemon should not start during startup

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.

If a daemon.sh executed faild while system booting can cause Linux start failed?

I would like to make tomcat auto start with a non-root user while system booting. I have created a daemon.sh under folder /etc/init.d . And I executed chkconfig tomcat on. The linux server is in another city. I access it by ssh. And I cannot reboot server to test it.
The problem is if tomcat start failed while booting, I am afraid that linux server cannot not be start succesfully. That whould be a disaster for me. Perhaps my worry is unnecessary.
How to avoid this problem?

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.

How to ensure machine reboot after the puppet run

is there a way how to ensure the reboot of the linux machine after puppet run?
Can take advantage of reboot or shutdown -r commands and to typical patern resurce - subscribe pattern but that doesn't ensure that exec shutdown resource will be synchronized as a last one.
Could someone please advice the best approach?

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