arrays with IP addresses

2010-02-11 Thread milo...@gmail.com
Hi,

I want to use an array for some settings in my mailserver. I used the
IP address of the node in the array, but it's not working, I guess
beacause of the '.' in the IP address. I use 3.0.3 community version.

vars:
"array[XX.YY.ZZ.19][example.com][bindip]" string => "XX.YY.ZZ.113";
"array[XX.YY.ZZ.19][example.com][helohost]" string =>
"10.mta.example.com";
"mailserver_domains" slist => getindices("mail_domain[$(sys.ipv4)]");


Error:

Function getindices was promised an array in scope "array[XX" but this
was not found


- Am I correct that this is because I use dot in the array definition?
- Is there any built-in function to eliminate the dots from an IP
address? I can find any replace function. I'm not sure how I could use
the built in hard class (ipv4_XX_YY_ZZ_AA) for that.



A more general question is that what's the best practice to match a
host with a role. For example I have webservers and emailservers. Some
system is webserver only, some emailserver only, some none, some both.

Right now I set up an slist and generate classes based on the IP address.

vars:
"webserver" slist => { "XX.YY.ZZ.21" };
classes:
"is_webserver" expression => reglist("@(webserver)","$(sys.ipv4)");
files:
is_webserver::
(do whatever)


Is there any better way to do that?

Thanks,

Miklos
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Linux Packages Cfengine 3

2010-02-20 Thread milo...@gmail.com
> For those who did not join the Cfengine Facebook group, Cfengine is now
> giving away Community Edition Packages for Linux distros on the Tech
> Corner, to assist users in upgrading. Login and go to MySpace.

Thanks for that, it makes upgrade/deployment much easier!

I set up some system with the community rpm for CentOS 5 x86-64 and I
noticed that "redhat-lsb" package is needed, but the cfengine
community package does not depend on it.

I wasn't able to find any .spec or src.rpm, so I can't send a patch against it.


Regards,

Miklos
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: arrays with IP addresses

2010-02-27 Thread milo...@gmail.com
2010/2/11  :
> Canonify might help you.
>

Hi Neil,

thanks for your answer.

For the first read I thought you totally misunderstood what my problem
was, but now I see that I was the one who totally misunderstood the
answer.

Regards,
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: lastseen confusion

2010-03-02 Thread milo...@gmail.com
> Why not include this in the documentation, then I wouldn't have had to ask
> these all these questions?

On the top of this page:

Cfengine 3.0.4

This hasn't been released yet, so it seems for me the guys work hard
to update they doc and Mark gave you an early access to the updated
doc.

Thank you CFengine team!
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Cfengine and Xen Configuration!

2010-03-02 Thread milo...@gmail.com
>
>
>  I wonder some one has any tutorial guide on that.
>
> Thanks in advance for help!
>
>
What are you looking for exactly?

As far as I know other than some build-in classes CFEngine does not really
care if it's a VM or a physical hardware.

I run CFEngine on KVM based VMs with no special settings without any
problem. I install my VMs with kickstart in the same way as normal physical
servers.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: lastseen confusion

2010-03-02 Thread milo...@gmail.com
> Which "updated doc" did I get early access to? I have searched the docs I

The one you got the example from.

> know of without finding too much on cf-report, but maybe I overlooked
> something? And I will happily joint in thanking the team, but there is
> always room for improvement.

That is very true. For everyone. In every aspects.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


cfengine edit_line - don't understand, must be something very basic

2010-03-25 Thread milo...@gmail.com
Hi,

in some cases I have to edit a file multiple times. I found that file
changes every time although it contains the required lines. I'm quite
sure I'm missing something very basic.

I've set up a small test file, please find it below.

I run the latest RPM of community edition.

cf-agent -V
This comprises cf-agent core community version 3.0.4p1 - (C) Cfengine AS 2008-


I have two questions:

1 - How to avoid to change the file every time?

2 - If I start with a file that have "#" lines the output will be like this:


# This file maintained by CFengine. Don't modify it directly!

#
...

I'd expect the same header than starting with empty/no file.
Why is this happening? Based on the doc this format should make sure
I'll have my lines in the same order than starting with an empty file.


Regards,

Miklos



TEST FILE:

body common control
{
any::
  bundlesequence  => {
 example
 };
}


bundle agent example
{
vars:
# binlog
"disk[mysql51_1][name]" string => "binlog";
"disk[mysql51_1][device]" string => "sdb";
"disk[mysql51_1][size]" string => "30G";
"disk[mysql51_1][user]" string => "mysql";
"disk[mysql51_1][group]" string => "mysql";
"disk[mysql51_1][mountoptions]" string => "ext3
defaults,noatime0 2";
# mysql51
"disk[mysql51_2][name]" string => "mysql51";
"disk[mysql51_2][device]" string => "sdc";
"disk[mysql51_2][size]" string => "300G";
"disk[mysql51_2][user]" string => "mysql";
"disk[mysql51_2][group]" string => "mysql";
"disk[mysql51_2][mountoptions]" string => "ext3
defaults,noatime0 2";

"index" slist => getindices("disk");


files:
  "/tmp/test.cfengine"

comment => "Add mount points",
edit_line =>
myedit("/dev/vg$(disk[$(index)][device])/$(disk[$(index)][name])
/vg/vg$(disk[$(index)][device])/lv$(disk[$(index)][name])/
$(disk[$(index)][mountoptions])",".*$(disk[$(index)][name]).*"),
create => "true",
classes => DefineIfChanged("fstab_has_changed");

reports:

fstab_has_changed::
"File has changed";
}


#***
bundle edit_line myedit(addline,delete)
{
vars:
"initial_comment" string =>
"$(const.n)#$(const.n)# This file
maintained by CFengine. Don't modify it
directly!$(const.n)#$(const.n)" ;

delete_lines:
"$(delete)";

insert_lines:

"$(addline)";
"$(initial_comment)" location => start;

# Removed to reduce the noise
#reports:
#
#linux::
#   "Added lines: $(addline)";

}

body classes DefineIfChanged(class) {
promise_repaired => { "$(class)" };
}

body location start

{
# If not line to match, applies to whole text body
before_after => "before";
}
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: install rpm from a file in cfengine 3?

2010-03-26 Thread milo...@gmail.com
On Thu, Mar 25, 2010 at 9:56 PM, Daniel Holth  wrote:
> In cfengine3, how do I use the packages: directive to either install an RPM
> directly from a file or URL, or define a class if the package isn't
> installed for use in commands: ?

In the standard library you can find tools to manage packages.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Cfengine Help: Re: cfengine edit_line - don't understand, must be something very basic

2010-03-26 Thread milo...@gmail.com
On Thu, Mar 25, 2010 at 9:54 PM, Todd Sayers  wrote:
> I should have clarified that I'm using version_2 (installed via a "Dag
> Wieers" RPM -- cfengine-2.2.3-1.el5.rf ).  I haven't seen "bundles" in
> CFengine v2.
>
> Thanks for your answer.  I don't think that it's relevant to v2 (and could
> be wrong about that).
>

In the standard library you can find tools to manage packages.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Cfengine Help: Re: cfengine edit_line - don't understand, must be something very basic

2010-03-26 Thread milo...@gmail.com
On Fri, Mar 26, 2010 at 9:01 AM, milo...@gmail.com  wrote:
> On Thu, Mar 25, 2010 at 9:54 PM, Todd Sayers  wrote:
>> I should have clarified that I'm using version_2 (installed via a "Dag
>> Wieers" RPM -- cfengine-2.2.3-1.el5.rf ).  I haven't seen "bundles" in
>> CFengine v2.
>>
>> Thanks for your answer.  I don't think that it's relevant to v2 (and could
>> be wrong about that).
>>

Sorry lads, seems it's too early for me.

You are right, this is a different thread, question about cf3.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Cfengine Help: Re: cfengine edit_line - don't understand, must be something very basic

2010-03-26 Thread milo...@gmail.com
>
> What you are doing byusing the getindices() list variable directly as an 
> arbument to the edit bundle is to iterate over the editing of the file 
> itself, i.e.  you are saying
>
> for each index do
>   edit file(...index )
>      edit lines
>
> You should pass the list as @(bundle.list) to the edit_line bundle and use 
> getindices() inside that bundle, so that you get
>
> edit file
>   for each index do
>     edit lines
>
> See an example like set_variable_values in the  COPBL

Thanks for your answer.

I (kind of) "feel" what you say but don't understand. What do you mean
" file(...index )"?

In my understanding my solution is less efficient, but should work as
well. No matter how many times I 'call' the edit line 'function' the
initial comment for example should be the same and the a line should
not be re-added if it's in the file already. Obviously this example
shows that I'm wrong.

I think my main problem is that I'm thinking in script-style, not in promises.

I could do a "workaround" (I mean workaround for me) based on the
COPBL example, but I'd like to understand it what's wrong in my
thinking.

Thanks,

Miklos
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Accessing global arrays?

2010-03-29 Thread milo...@gmail.com
>    vars:
>        "at_fields" slist => getindices("$(g.asset_cache)"); ## THIS
> DOES NOT WORK
>

Have you tried without the $ sign?

"v[index_1]" string => "value_1";
"v[index_2]" string => "value_2";
"parameter_name" slist => getindices("v");
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Accessing global arrays?

2010-03-29 Thread milo...@gmail.com
On Mon, Mar 29, 2010 at 4:28 PM, Justin Lloyd  wrote:
> This silly (but easy-to-make) mistake of mine was pointed out to me already. 
> :) I did, however, see some weirdness with it after I fixed it. Here's my 
> original response to that from last Thursday:

Sorry, subject has been changed, gmail shows it as a separated thread :(

I was quite surprised that no-one has answered :)

Regards,
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: CentOS and lsb-release call

2010-04-01 Thread milo...@gmail.com
> Apr  1 17:54:11 eth0 cf-execd[29952]:  Couldn't run /usr/bin/lsb_release
> Apr  1 17:54:11 eth0 cf-execd[29952]:   !!! System error for execv:
> "No such file or directory"


> Is it possible to eliminate those complaints somehow?


Other option would be to depend on that package.

A proper Requires: into the .spec file would help - coreutils also a
missing dependency in the RPM.

With the existing RPM it's not possible to deploy cfengine with
kickstart as a normal package as kickstart will install it sooner than
coreutils.

I've sent this to the cfegine guys when they started to provide RPMs,
hope they will update the .spec file soon.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


CentOS 5 RPM packages and included libraries

2010-04-02 Thread milo...@gmail.com
Hello,

after few hours debugging we found that after install
cfengine-community RPM on a CentOS 5 system  PCRE UTF-8 support won't
work.

ldd /usr/bin/pcretest
libpcre.so.0 => /var/cfengine/lib/libpcre.so.0 (0x2b52f2cee000)
...


I'm wondering why it is needed to include library files into the RPM
and make them available for all other programs rather than using the
ones from the OS.

Am I doing something wrong to get this result?

Regards,

Miklos
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Cfengine Help: Update inputs from a svn repository

2010-04-14 Thread milo...@gmail.com
> Is there a way for cfengine to talk directly to a svn repository without 
> having to use shell commands?
>

As far as I know there's no such thing and the reason for that is that
to deploy a new cfengine configuration must be a human decision - YOU
must hit the button on the 'svn up' as you know that it has been
tested properly and ready to deploy.

I think this makes sense.

You can set up several cfengine servers to download the configs in a
chain but on the first, 'root' server you have to deploy manually.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: How to get an slist of mounted local filesystems with CFengine 3?

2010-09-16 Thread milo...@gmail.com
>   mount |egrep '(ext2|ext3|ext4)' |cut -f3 -d" "
>
> ... but somehow I feel that I am about to reinvent a wheel ;-)
>

Maybe "df -l" is a better command to run, I'm quite surprised that
mount does not have this option (at least I can't find it in the
manual).
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Cfengine Help: Re: Quickstart guide?

2010-09-20 Thread milo...@gmail.com
> I've been thinking about a script that can generate a server and client 
> configuration suitable for testing and evaluation on a single host.  I've 
> also started on an updated version of the cookbook.  Perhaps I'll add this 
> script to it.

I didn't followed the thread, but my 'old' plan (originally I wanted
to go for the c^3) to make public our internal scripts with some
modifications and set up a system to support a full installation of
CentOS with CFEngine included.

Currently we use CentOS and a php script to deploy machines. During
the boot process or VM creation we can add a kickstart file option,
which in our case points to a php script. This script generates the
necessary configuration (IP, DNS, etc) and installs necessary RPMs
(including CFEngine).

I think this system would be handy for beginners, just download a
CentOS netinstall ISO (<100MB), create a VM, type in one single line
during the installation and within half an hour you have a working
system in your virtual environment with CFEngine.

Second part of my plan was to implement (at least partially) the RHEL
5 hardening instructions from NSA to show the power in CFEngine.

If you think this fits in your plan and can be a handy add-on for it
please drop me a private mail please.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Cfengine Help: Re: Quickstart guide?

2010-09-20 Thread milo...@gmail.com
Hm, is there any system that can generate all widely used virtual
appliances at one go? I'm not sure if there is any format that would
work with most of them.

Live CD seems a better idea for me. What is in your mind, how should
it work? If you can give a high level overview I'll take a look into
the implementation (as long as you need my help at all).


On 20 September 2010 15:59,   wrote:
> Forum: Cfengine Help
> Subject: Re: Quickstart guide?
> Author: neilhwatson
> Link to topic: https://cfengine.com/forum/read.php?3,18332,18356#msg-18356
>
> Offering a small pre-configured virtual appliance or live CD for people to 
> download and try would be a nice addition.
>
> ___
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
>
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine


Re: Cfengine Help: How to reset hostsseeen?

2010-10-25 Thread milo...@gmail.com
On 25 October 2010 16:15,   wrote:
> Forum: Cfengine Help
> Subject: How to reset hostsseeen?
> Author: hristob
> Link to topic: https://cfengine.com/forum/read.php?3,18860,18860#msg-18860
>
> Hi
>
> How to reset hostsseen database?
>
> Is there a configuration value? Or it is a command/file?


/var/cfengine/ppkeys/

I hope this is what you need. You can remove files from this directory
if you want cfengine to 'forget' a client or server.
___
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine