[Spacewalk-list] Configuration Files Deployment + Remote Command on Action Chain

Rick van der Linde rick at rilp.nl
Sat Oct 18 08:57:34 UTC 2014


True, I get the point,

 
 
I managed to do something similar by deploying configuration files (scripts aclually) with a configuration channel. The chalange however is that you want the client to act on this. In short I found two way to do this. 

 
First a script can be developed that is ran every period of time (by cronjob). make sure that the deployed files only run once when it gets deployed. You can remove the file or log the script in a file and detect a script has ran before and skip it. I use a script that detects when a script has been (re-)deployed (by timestamp) and runs it once. It will re-run the script when it gets re-deployed.

 
the second alternative, which in my opinion is a more neat one is to use inotify to detect when a file/directory changes. When something changes it should do an action (for example run it). This will allow instant run of scripts when they get (re-)deployed. Disadvantage of this is that the clients need to run an extra daemon to detect file/directory changes.

 
For single time actions I use SSM and remote command. Foor more often actions I use the script (part of a defaul config channel) that is a cronjob (every 5 mins).

 
Hope this helps.

 
 
Rick
 
-----Oorspronkelijk bericht-----
Aan: spacewalk-list at redhat.com; 
Van: Dewangga Bachrul Alam <dewanggaba at xtremenitro.org>
Verzonden: vr 17-10-2014 19:23
Onderwerp: Re: [Spacewalk-list] Configuration Files Deployment + Remote Command on Action Chain
Hi rick,

Yes, it can be easily handled by remote command, but the question is.
Action chain is only temporary for a scheduled action only. And, action
chain couldn't be saved with configuration files.

So I must create a new chain, if I want to deploy the selected files.

And yes you're right, it can be done only using remote command and use
sed, select the correct systems. But, you will need much time to do that.

CMIIW.

On 10/17/2014 10:26 PM, Rick van der Linde wrote:
> Hi,
> 
>  
> Probably a good way would be to select a set of systems to manage (those you want to correct) and then run a remote command that does what you want (sed and a service restart),
> 
>  
> Hope this helps.
> 
>  
> RIck
>  
> -----Oorspronkelijk bericht-----
> Aan: spacewalk-list at redhat.com; 
> Van: Dewangga Bachrul Alam <dewanggaba at xtremenitro.org>
> Verzonden: vr 17-10-2014 17:13
> Onderwerp: Re: [Spacewalk-list] Configuration Files Deployment + Remote Command on Action Chain
> So, what if I want to change the line on /etc/nginx/conf.d/ssl.conf and
> restart the nginx.
> 
> Origin:
> ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
> 
> Latest:
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
> 
> And reload the nginx.
> 
> Should I rebuild the nginx and make the rpm then resubmit it to
> spacewalk server? Is it worth?
> 
> 
> On 10/16/2014 06:56 PM, Waldirio Manhães Pinheiro wrote:
>> Hello, good morning
>>
>> About big effort, not so much and this is the cost to execute
>> automatically. :-), in fact you will create this script when you need some
>> action after deploy, just on this cases.
>>
>> About el7, sure will not, you have to change to system control.
>>
>> ps.: You can create a single script and inside else you will use "case" for
>> example. Case el6 do ..., case el7 do ...
>>
>> B'Regards
>>
>> ______________
>> Atenciosamente
>> Waldirio
>> msn: waldirio at gmail.com
>> Skype: waldirio
>> Site: www.waldirio.com.br
>> Blog: blog.waldirio.com.br
>> LinkedIn: http://br.linkedin.com/pub/waldirio-pinheiro/22/b21/646
>> PGP: www.waldirio.com.br/public.html
>>
>> On Thu, Oct 16, 2014 at 2:56 AM, Dewangga Bachrul Alam <
>> dewanggaba at xtremenitro.org> wrote:
>>
>>> Hi Waldirio,
>>>
>>> Thanks for your help, but I think it will be make big effort every
>>> create/changes deployment on each files. Isn't it?
>>>
>>> IMHO & CMIIW, your scripts won't work on el7.
>>>
>>> On 10/16/2014 11:20 AM, Waldirio Manhães Pinheiro wrote:
>>>> Dewangga
>>>>
>>>> Just to add information, about your question, the command to restart
>>>> service should be after else
>>>>
>>>> ###
>>>> #!/bin/bash
>>>> if [ -f /var/log/ref_teste ]; then
>>>>   echo "Script was defined - $(date)"           | tee -a
>>> /var/log/messages
>>>>   echo "Removing $0 from /etc/cron.hourly"      | tee -a
>>> /var/log/messages
>>>>   echo "### rm -rf /etc/cron.hourly/$0"         | tee -a
>>> /var/log/messages
>>>> else
>>>>   echo "TEST ### $(date) ###"                   | tee -a
>>> /var/log/messages
>>>>
>>>>   # Command here !!!!
>>>>   service xpto_daemon restart
>>>>
>>>>   touch /var/log/ref_teste
>>>> fi
>>>> ###
>>>>
>>>> ______________
>>>> Atenciosamente
>>>> Waldirio
>>>> msn: waldirio at gmail.com
>>>> Skype: waldirio
>>>> Site: www.waldirio.com.br
>>>> Blog: blog.waldirio.com.br
>>>> LinkedIn: http://br.linkedin.com/pub/waldirio-pinheiro/22/b21/646
>>>> PGP: www.waldirio.com.br/public.html
>>>>
>>>> On Thu, Oct 16, 2014 at 1:18 AM, Waldirio Manhães Pinheiro <
>>>> waldirio at gmail.com> wrote:
>>>>
>>>>> Hello Dewangga and list friends, good morning
>>>>>
>>>>> By default the Spacewalk don't have this feature, btw you can do things
>>>>> like bellow:
>>>>>
>>>>> 1. Create a rpm just to do what you need, so you configure in conf.
>>>>> channel the package and the command will be executed (I know, I don't
>>> like
>>>>> too, but it work).
>>>>>
>>>>> 2. Create a script like bellow in /etc/cron.hourly. Sure you will
>>> change,
>>>>> remove comments and define to your environment, but this will work too.
>>> The
>>>>> command will not be execute at the same time of deploy, but on the next
>>> 01
>>>>> minute of next hour.
>>>>>
>>>>> ###
>>>>> #!/bin/bash
>>>>> if [ -f /var/log/ref_teste ]; then
>>>>>   echo "Script was defined - $(date)"           | tee -a
>>> /var/log/messages
>>>>>   echo "Removing $0 from /etc/cron.hourly"      | tee -a
>>> /var/log/messages
>>>>>   echo "### rm -rf /etc/cron.hourly/$0"         | tee -a
>>> /var/log/messages
>>>>> else
>>>>>   echo "TEST ### $(date) ###"                   | tee -a
>>> /var/log/messages
>>>>>   touch /var/log/ref_teste
>>>>> fi
>>>>> ###
>>>>>
>>>>> I'll prepare a real sample and create a post in my blog. Good question!
>>> ;-)
>>>>>
>>>>> Take Care and let me know if work to you.
>>>>>
>>>>> ______________
>>>>> Atenciosamente
>>>>> Waldirio
>>>>> msn: waldirio at gmail.com
>>>>> Skype: waldirio
>>>>> Site: www.waldirio.com.br
>>>>> Blog: blog.waldirio.com.br
>>>>> LinkedIn: http://br.linkedin.com/pub/waldirio-pinheiro/22/b21/646
>>>>> PGP: www.waldirio.com.br/public.html
>>>>>
>>>>> On Thu, Oct 16, 2014 at 12:19 AM, Dewangga Bachrul Alam <
>>>>> dewanggaba at xtremenitro.org> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I've try to centralize SSL Configuration Files, (eg.
>>>>>> /etc/nginx/conf.d/ssl.conf), but, after changes that files, I should
>>>>>> reload the nginx automatically after deployed the files.
>>>>>>
>>>>>> I add action chaining manually to deployment schedule, is it possible
>>> to
>>>>>> automate them? I mean that remote command `service nginx reload` saved
>>>>>> on configuration files too.
>>>>>>
>>>>>> Is it possible?
>>>>>>
>>>>>> _______________________________________________
>>>>>> Spacewalk-list mailing list
>>>>>> Spacewalk-list at redhat.com
>>>>>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Spacewalk-list mailing list
>>>> Spacewalk-list at redhat.com
>>>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>>>>
>>>
>>> _______________________________________________
>>> Spacewalk-list mailing list
>>> Spacewalk-list at redhat.com
>>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>>>
>>
>>
>>
>> _______________________________________________
>> Spacewalk-list mailing list
>> Spacewalk-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>>
> 
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
> 
> 
> 
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
> 

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20141018/091fe4a0/attachment.htm>


More information about the Spacewalk-list mailing list