Javi
2012-Jul-18 13:55 UTC
[Puppet Users] Start puppet with a non root user different than default ''puppet''
Good evening. I tried: cd /set sudo chown -R myuser:myuser puppet sudo vim /etc/puppet/puppet.conf Add: [main] ... user myuser And: [main] ... user myuser sudo /etc/init.d/pupettmaster restart But no luck. Any idea? Thanks -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/bL6rk1MjzrUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jan
2012-Jul-18 15:39 UTC
Re: [Puppet Users] Start puppet with a non root user different than default ''puppet''
Hi, On 07/18/2012 03:55 PM Javi wrote:> Add: > > [main] > ... > user myuser > > And: > > [main] > ... > user myuser > > sudo /etc/init.d/pupettmaster restart > > But no luck. Any idea?which distribution you''re running on? The user might be set by the init script by passing the necessary parameters directly to the process and AFAIK those parameters always take precedence for those specified within /etc/puppet/puppet.conf .. Kill the process and try starting it directly: ------------------------------------>8------------------------------------ # sudo /etc/init.d/pupettmaster stop; # sudo su -; # puppetmasterd --config=/etc/puppet.conf; # ps aux | grep ''puppet''; ------------------------------------8<------------------------------------ Cheers - Jan
Javi Legido
2012-Jul-20 10:30 UTC
Re: [Puppet Users] Start puppet with a non root user different than default ''puppet''
Thanks for reply, but your fix didn''t worked.
I use debian, and below packages versions:
ii puppet 2.6.2-5+squeeze5
Centralized configuration management - agent startup and compatibility
scripts
ii puppet-common 2.6.2-5+squeeze5
Centralized configuration management
ii puppetmaster 2.6.2-5+squeeze5
Centralized configuration management - master startup and
compatibility scripts
Do you know how to pass the user as a parameter to the puppet script?
Below content of the /etc/init.d/puppetmaster script:
#! /bin/sh
### BEGIN INIT INFO
# Provides: puppetmaster
# Required-Start: $network $named $remote_fs $syslog
# Required-Stop: $network $named $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/puppet
DAEMON_OPTS=""
NAME=master
DESC="puppet master"
test -x $DAEMON || exit 0
[ -r /etc/default/puppetmaster ] && . /etc/default/puppetmaster
. /lib/lsb/init-functions
if [ ! -d /var/run/puppet ]; then
mkdir -p /var/run/puppet
fi
chown puppet:puppet /var/run/puppet
is_true() {
if [ "x$1" = "xtrue" -o "x$1" =
"xyes" -o "x$1" = "x0" ] ; then
return 0
else
return 1
fi
}
start_puppet_master() {
if is_true "$START" ; then
if [ "$SERVERTYPE" = "mongrel" ]
then
DAEMON_OPTS="$DAEMON_OPTS --servertype=mongrel"
NUMSTART=0
STARTPORT=$PORT
while [ $NUMSTART -lt $PUPPETMASTERS ]; do
start-stop-daemon --start --quiet
--pidfile=/var/run/puppet/${NAME}-${STARTPORT}.pid \
--startas $DAEMON -- $NAME $DAEMON_OPTS
--masterport=$STARTPORT
--pidfile=/var/run/puppet/${NAME}-${STARTPORT}.pid
STARTPORT=$(($STARTPORT + 1))
NUMSTART=$(($NUMSTART + 1))
done
else
start-stop-daemon --start --quiet --pidfile
/var/run/puppet/${NAME}.pid \
--startas $DAEMON -- $NAME $DAEMON_OPTS --masterport=$PORT
fi
else
echo ""
echo "puppetmaster not configured to start, please edit
/etc/default/puppetmaster to enable"
fi
}
stop_puppet_master() {
if [ "$SERVERTYPE" = "mongrel" ]
then
NUMSTART=0
STOPPORT=$PORT
while [ $NUMSTART -lt $PUPPETMASTERS ]; do
start-stop-daemon --stop --quiet --oknodo --pidfile
/var/run/puppet/${NAME}-${STOPPORT}.pid
rm -f /var/run/puppet/${NAME}-${STOPPORT}.pid
STOPPORT=$(($STOPPORT + 1))
NUMSTART=$(($NUMSTART + 1))
done
else
start-stop-daemon --stop --quiet --oknodo --pidfile
/var/run/puppet/${NAME}.pid
fi
}
status_puppet_master() {
if is_true "$START" ; then
if [ "$SERVERTYPE" = "mongrel" ]
then
NUMSTART=0
STARTPORT=$PORT
while [ $NUMSTART -lt $PUPPETMASTERS ]; do
status_of_proc -p
"/var/run/puppet/${NAME}-${STARTPORT}.pid" \
"${DAEMON}" "${NAME}-${STARTPORT}"
STARTPORT=$(($STARTPORT + 1))
NUMSTART=$(($NUMSTART + 1))
done
else
status_of_proc -p "/var/run/puppet/${NAME}.pid"
"${DAEMON}" "${NAME}"
fi
else
echo ""
echo "puppetmaster not configured to start"
fi
}
case "$1" in
start)
log_begin_msg "Starting $DESC"
start_puppet_master
log_end_msg $?
;;
stop)
log_begin_msg "Stopping $DESC"
stop_puppet_master
log_end_msg $?
;;
reload)
# Do nothing, as Puppetmaster rechecks its config automatically
;;
status)
status_puppet_master
;;
restart|force-reload)
log_begin_msg "Restarting $DESC"
stop_puppet_master
sleep 1
start_puppet_master
log_end_msg $?
;;
*)
echo "Usage: $0 {start|stop|status|restart|force-reload}"
>&2
exit 1
;;
esac
2012/7/18 Jan <jan@agetty.de>:> Hi,
>
> On 07/18/2012 03:55 PM Javi wrote:
>> Add:
>>
>> [main]
>> ...
>> user myuser
>>
>> And:
>>
>> [main]
>> ...
>> user myuser
>>
>> sudo /etc/init.d/pupettmaster restart
>>
>> But no luck. Any idea?
>
> which distribution you''re running on? The user might be set by the
init
> script by passing the necessary parameters directly to the process and
> AFAIK those parameters always take precedence for those specified within
> /etc/puppet/puppet.conf ..
>
> Kill the process and try starting it directly:
>
>
------------------------------------>8------------------------------------
> # sudo /etc/init.d/pupettmaster stop;
> # sudo su -;
> # puppetmasterd --config=/etc/puppet.conf;
> # ps aux | grep ''puppet'';
>
------------------------------------8<------------------------------------
>
> Cheers
> - Jan
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Javi Legido
2012-Jul-20 10:36 UTC
[Puppet Users] [RESOLVED] Start puppet with a non root user different than default ''puppet''
Fixed changing below line: chown my_user:my_user /var/run/puppet Regards 2012/7/20 Javi Legido <javi@legido.com>:> Thanks for reply, but your fix didn''t worked. > > I use debian, and below packages versions: > > ii puppet 2.6.2-5+squeeze5 > Centralized configuration management - agent startup and compatibility > scripts > ii puppet-common 2.6.2-5+squeeze5 > Centralized configuration management > ii puppetmaster 2.6.2-5+squeeze5 > Centralized configuration management - master startup and > compatibility scripts > > Do you know how to pass the user as a parameter to the puppet script? > > Below content of the /etc/init.d/puppetmaster script: > > #! /bin/sh > ### BEGIN INIT INFO > # Provides: puppetmaster > # Required-Start: $network $named $remote_fs $syslog > # Required-Stop: $network $named $remote_fs $syslog > # Default-Start: 2 3 4 5 > # Default-Stop: 0 1 6 > ### END INIT INFO > > PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin > DAEMON=/usr/bin/puppet > DAEMON_OPTS="" > NAME=master > DESC="puppet master" > > test -x $DAEMON || exit 0 > > [ -r /etc/default/puppetmaster ] && . /etc/default/puppetmaster > > . /lib/lsb/init-functions > > if [ ! -d /var/run/puppet ]; then > mkdir -p /var/run/puppet > fi > > chown puppet:puppet /var/run/puppet > > is_true() { > if [ "x$1" = "xtrue" -o "x$1" = "xyes" -o "x$1" = "x0" ] ; then > return 0 > else > return 1 > fi > } > > start_puppet_master() { > if is_true "$START" ; then > if [ "$SERVERTYPE" = "mongrel" ] > then > DAEMON_OPTS="$DAEMON_OPTS --servertype=mongrel" > NUMSTART=0 > STARTPORT=$PORT > while [ $NUMSTART -lt $PUPPETMASTERS ]; do > start-stop-daemon --start --quiet > --pidfile=/var/run/puppet/${NAME}-${STARTPORT}.pid \ > --startas $DAEMON -- $NAME $DAEMON_OPTS > --masterport=$STARTPORT > --pidfile=/var/run/puppet/${NAME}-${STARTPORT}.pid > STARTPORT=$(($STARTPORT + 1)) > NUMSTART=$(($NUMSTART + 1)) > done > else > start-stop-daemon --start --quiet --pidfile > /var/run/puppet/${NAME}.pid \ > --startas $DAEMON -- $NAME $DAEMON_OPTS --masterport=$PORT > fi > else > echo "" > echo "puppetmaster not configured to start, please edit > /etc/default/puppetmaster to enable" > fi > } > > stop_puppet_master() { > if [ "$SERVERTYPE" = "mongrel" ] > then > NUMSTART=0 > STOPPORT=$PORT > while [ $NUMSTART -lt $PUPPETMASTERS ]; do > start-stop-daemon --stop --quiet --oknodo --pidfile > /var/run/puppet/${NAME}-${STOPPORT}.pid > rm -f /var/run/puppet/${NAME}-${STOPPORT}.pid > STOPPORT=$(($STOPPORT + 1)) > NUMSTART=$(($NUMSTART + 1)) > done > else > start-stop-daemon --stop --quiet --oknodo --pidfile > /var/run/puppet/${NAME}.pid > fi > } > > status_puppet_master() { > if is_true "$START" ; then > if [ "$SERVERTYPE" = "mongrel" ] > then > NUMSTART=0 > STARTPORT=$PORT > while [ $NUMSTART -lt $PUPPETMASTERS ]; do > status_of_proc -p "/var/run/puppet/${NAME}-${STARTPORT}.pid" \ > "${DAEMON}" "${NAME}-${STARTPORT}" > STARTPORT=$(($STARTPORT + 1)) > NUMSTART=$(($NUMSTART + 1)) > done > else > status_of_proc -p "/var/run/puppet/${NAME}.pid" > "${DAEMON}" "${NAME}" > fi > else > echo "" > echo "puppetmaster not configured to start" > fi > } > > case "$1" in > start) > log_begin_msg "Starting $DESC" > start_puppet_master > log_end_msg $? > ;; > stop) > log_begin_msg "Stopping $DESC" > stop_puppet_master > log_end_msg $? > ;; > reload) > # Do nothing, as Puppetmaster rechecks its config automatically > ;; > status) > status_puppet_master > ;; > restart|force-reload) > log_begin_msg "Restarting $DESC" > stop_puppet_master > sleep 1 > start_puppet_master > log_end_msg $? > ;; > *) > echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2 > exit 1 > ;; > esac > > > 2012/7/18 Jan <jan@agetty.de>: >> Hi, >> >> On 07/18/2012 03:55 PM Javi wrote: >>> Add: >>> >>> [main] >>> ... >>> user myuser >>> >>> And: >>> >>> [main] >>> ... >>> user myuser >>> >>> sudo /etc/init.d/pupettmaster restart >>> >>> But no luck. Any idea? >> >> which distribution you''re running on? The user might be set by the init >> script by passing the necessary parameters directly to the process and >> AFAIK those parameters always take precedence for those specified within >> /etc/puppet/puppet.conf .. >> >> Kill the process and try starting it directly: >> >> ------------------------------------>8------------------------------------ >> # sudo /etc/init.d/pupettmaster stop; >> # sudo su -; >> # puppetmasterd --config=/etc/puppet.conf; >> # ps aux | grep ''puppet''; >> ------------------------------------8<------------------------------------ >> >> Cheers >> - Jan >>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Javi Legido
2012-Jul-20 10:47 UTC
Re: [Puppet Users] [RESOLVED] Start puppet with a non root user different than default ''puppet''
Correction: below actions are needed: /etc/puppet/puppet.conf [main] ... user=my_user /etc/init.d/puppetmaster ... chown my_user:my_user /var/run/puppet Cheers 2012/7/20 Javi Legido <javi@legido.com>:> Fixed changing below line: > > chown my_user:my_user /var/run/puppet > > Regards > > 2012/7/20 Javi Legido <javi@legido.com>: >> Thanks for reply, but your fix didn''t worked. >> >> I use debian, and below packages versions: >> >> ii puppet 2.6.2-5+squeeze5 >> Centralized configuration management - agent startup and compatibility >> scripts >> ii puppet-common 2.6.2-5+squeeze5 >> Centralized configuration management >> ii puppetmaster 2.6.2-5+squeeze5 >> Centralized configuration management - master startup and >> compatibility scripts >> >> Do you know how to pass the user as a parameter to the puppet script? >> >> Below content of the /etc/init.d/puppetmaster script: >> >> #! /bin/sh >> ### BEGIN INIT INFO >> # Provides: puppetmaster >> # Required-Start: $network $named $remote_fs $syslog >> # Required-Stop: $network $named $remote_fs $syslog >> # Default-Start: 2 3 4 5 >> # Default-Stop: 0 1 6 >> ### END INIT INFO >> >> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin >> DAEMON=/usr/bin/puppet >> DAEMON_OPTS="" >> NAME=master >> DESC="puppet master" >> >> test -x $DAEMON || exit 0 >> >> [ -r /etc/default/puppetmaster ] && . /etc/default/puppetmaster >> >> . /lib/lsb/init-functions >> >> if [ ! -d /var/run/puppet ]; then >> mkdir -p /var/run/puppet >> fi >> >> chown puppet:puppet /var/run/puppet >> >> is_true() { >> if [ "x$1" = "xtrue" -o "x$1" = "xyes" -o "x$1" = "x0" ] ; then >> return 0 >> else >> return 1 >> fi >> } >> >> start_puppet_master() { >> if is_true "$START" ; then >> if [ "$SERVERTYPE" = "mongrel" ] >> then >> DAEMON_OPTS="$DAEMON_OPTS --servertype=mongrel" >> NUMSTART=0 >> STARTPORT=$PORT >> while [ $NUMSTART -lt $PUPPETMASTERS ]; do >> start-stop-daemon --start --quiet >> --pidfile=/var/run/puppet/${NAME}-${STARTPORT}.pid \ >> --startas $DAEMON -- $NAME $DAEMON_OPTS >> --masterport=$STARTPORT >> --pidfile=/var/run/puppet/${NAME}-${STARTPORT}.pid >> STARTPORT=$(($STARTPORT + 1)) >> NUMSTART=$(($NUMSTART + 1)) >> done >> else >> start-stop-daemon --start --quiet --pidfile >> /var/run/puppet/${NAME}.pid \ >> --startas $DAEMON -- $NAME $DAEMON_OPTS --masterport=$PORT >> fi >> else >> echo "" >> echo "puppetmaster not configured to start, please edit >> /etc/default/puppetmaster to enable" >> fi >> } >> >> stop_puppet_master() { >> if [ "$SERVERTYPE" = "mongrel" ] >> then >> NUMSTART=0 >> STOPPORT=$PORT >> while [ $NUMSTART -lt $PUPPETMASTERS ]; do >> start-stop-daemon --stop --quiet --oknodo --pidfile >> /var/run/puppet/${NAME}-${STOPPORT}.pid >> rm -f /var/run/puppet/${NAME}-${STOPPORT}.pid >> STOPPORT=$(($STOPPORT + 1)) >> NUMSTART=$(($NUMSTART + 1)) >> done >> else >> start-stop-daemon --stop --quiet --oknodo --pidfile >> /var/run/puppet/${NAME}.pid >> fi >> } >> >> status_puppet_master() { >> if is_true "$START" ; then >> if [ "$SERVERTYPE" = "mongrel" ] >> then >> NUMSTART=0 >> STARTPORT=$PORT >> while [ $NUMSTART -lt $PUPPETMASTERS ]; do >> status_of_proc -p "/var/run/puppet/${NAME}-${STARTPORT}.pid" \ >> "${DAEMON}" "${NAME}-${STARTPORT}" >> STARTPORT=$(($STARTPORT + 1)) >> NUMSTART=$(($NUMSTART + 1)) >> done >> else >> status_of_proc -p "/var/run/puppet/${NAME}.pid" >> "${DAEMON}" "${NAME}" >> fi >> else >> echo "" >> echo "puppetmaster not configured to start" >> fi >> } >> >> case "$1" in >> start) >> log_begin_msg "Starting $DESC" >> start_puppet_master >> log_end_msg $? >> ;; >> stop) >> log_begin_msg "Stopping $DESC" >> stop_puppet_master >> log_end_msg $? >> ;; >> reload) >> # Do nothing, as Puppetmaster rechecks its config automatically >> ;; >> status) >> status_puppet_master >> ;; >> restart|force-reload) >> log_begin_msg "Restarting $DESC" >> stop_puppet_master >> sleep 1 >> start_puppet_master >> log_end_msg $? >> ;; >> *) >> echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2 >> exit 1 >> ;; >> esac >> >> >> 2012/7/18 Jan <jan@agetty.de>: >>> Hi, >>> >>> On 07/18/2012 03:55 PM Javi wrote: >>>> Add: >>>> >>>> [main] >>>> ... >>>> user myuser >>>> >>>> And: >>>> >>>> [main] >>>> ... >>>> user myuser >>>> >>>> sudo /etc/init.d/pupettmaster restart >>>> >>>> But no luck. Any idea? >>> >>> which distribution you''re running on? The user might be set by the init >>> script by passing the necessary parameters directly to the process and >>> AFAIK those parameters always take precedence for those specified within >>> /etc/puppet/puppet.conf .. >>> >>> Kill the process and try starting it directly: >>> >>> ------------------------------------>8------------------------------------ >>> # sudo /etc/init.d/pupettmaster stop; >>> # sudo su -; >>> # puppetmasterd --config=/etc/puppet.conf; >>> # ps aux | grep ''puppet''; >>> ------------------------------------8<------------------------------------ >>> >>> Cheers >>> - Jan >>>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.