[Spacewalk-list] Configuration file changing/patching

Waldirio Manhães Pinheiro waldirio at gmail.com
Fri Aug 15 13:15:31 UTC 2014


Hello Uwe and friends from list

You can do this basically for two different ways. Let me show a sample,
imagine you have a environment like bellow and you would like to change
just the path_bin variable

###
[root at rheldesk01 scr]# cat /usr/apps/conf/xpto.conf
name=xpto
ver=2.0
path_bin=/usr/local/bin/xpto_32
conf_file=xpto.conf
###

--- Using Configuration Channel, Script and Remote Command

1. You can create a configuration channel and there insert a script like
bellow. This file will be deployed as /tmp/xpto_change for example
###
#!/bin/bash

FILE="/usr/apps/conf/xpto.conf"
# Variable to change - path_bin

Check=$(grep ^path_bin $FILE|wc -l)
NewPath="/usr/local/bin/xpto_64"

echo $Check

if [ $Check -eq 1 ]; then
  echo "There is Variable path_bin, changing ..."
  sed -i -e "s#path_bin=.*#path_bin=${NewPath}#g" /usr/apps/conf/xpto.conf
fi
###

2. Select the System or SSM and in Details - Remote Command
3. In the command, bash /tmp/xpto_change

The result
###
[root at rheldesk01 scr]# cat /usr/apps/conf/xpto.conf
name=xpto
ver=2.0
path_bin=/usr/local/bin/xpto_64
conf_file=xpto.conf
###

At this moment your file will be changed according your necessity.

--- Using Customized Channel and RPM Package
1. Just create a rpm package where you can create a script like example
before and in %post execute commands or execute everything in %post

In the second option, you will not use configuration channel but you will
create a workaround to change files. Pay attention, if you are using conf
channels do keep these conf files, on the next check about diff, will
appear in your list.

A didn't try combine puppet with spacewalk, maybe this can work.

Friends, if you have another way or one "workaround", we appreciate,
because this is very used in companies (small to large).

Have a great day !!

Waldirio


On Tue, Aug 5, 2014 at 9:08 AM, <Uwe.Poliak at amann.com> wrote:

>  Hi,
>
>
>
> I am new to this list and also new to spacewalk. For a solution I have
> checked this list and also checked various websites found via Google, but
> didn’t find any solution to my question.
>
> So I am sorry, if this topic has already been covered here.
>
>
>
> With Spacewalk I am able to publish configuration files, symlinks and
> directories from the Configuration Channels to the Client systems. This
> works fine.
>
>
>
> Is it also possible to change/patch configuration files, which are already
> existing on the Client system?
>
> I have some files on some client system, where only some lines of code
> must be added to or changed but the rest of the file should remain
> untouched.
>
>
>
> Is there any way to do this without using the “Remote Command” feature?
>
>
>
> Tia and Best Regards
>
> Uwe
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
>



-- 
______________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20140815/7e0a56d7/attachment.htm>


More information about the Spacewalk-list mailing list