bind zone file inside cfengine

423 Views Asked by At

I have some zone files that uses bind specific $GENERATE directive like this

$GENERATE 50-100 srv-${-50,3,d}  A 10.34.38.$

Now when I add this to cfengine, it tries to expand ${...} and gives an error. I can escape this ${ with \${ and that passes cfengine but I can't use named-checkzone then (cfengine LITERAL directive also will make named-checkzone fail as it adds @@LITERAL in the zone file). One option would be to expand $GENERATE to single lines. Is there any other option I have?

1

There are 1 best solutions below

0
On

Is this CFEngine 2 or CFEngine 3?

If it it is CFEngine 3, would it help if you use the built in variable const.dollar for this?

Consider the following example:

body common control {
    bundlesequence => { "test"};
}

bundle agent test {
    reports:
        linux::
            "$GENERATE 50-100 srv-$(const.dollar){-50,3,d}  A 10.34.38.$";
}

This outputs the following by cf-agent:

# /var/cfengine/bin/cf-agent -K -f /tmp/test.cf 
R: $GENERATE 50-100 srv-${-50,3,d}  A 10.34.38.$

Is it something like this you are trying to achieve?