I am trying to get a client server's /etc/mail/sendmail.mc configured properly. 
 Here is part of /etc/mail/sendmail.mc file.

"dnl #
dnl # Do not advertize sendmail version.
dnl #
dnl define(`confSMTP_LOGIN_MSG', `$j Sendmail; $b')dnl
dnl #
dnl # default logging level is 9, you might want to set it higher to
dnl # debug the configuration
dnl #
dnl define(`confLOG_LEVEL', `9')dnl
dnl #
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
dnl define(`SMART_HOST', `smtp.your.provider')dnl
dnl #
"

I need to edit the line...

dnl define(`SMART_HOST', `smtp.your.provider')dnl

to...

define(`SMART_HOST', `smtp.cfengine.com')

I was able to make the change smtp.your.provider to smtp.cfengine.com with the 
config file below.  However, I cannot delete the "dnl" before and after (the 
after is not required and considered cosmetic) without deleting all the "dnl" 
in the file.

/tmp/templates/edit_file.cf.test
"#
#       testing cfengine with following:
#               edit file
#
body common control
{
        bundlesequence          => { "createFile" , "copyLocalFile" , 
"editFile" };
        ignore_missing_bundles  => "true";
        require_comments        => "true";
        inputs                  => { "/var/cfengine/inputs/cfengine_stdlib.cf" 
};
        version                 => "1.0";
}

body agent control
{
        verbose         => "true";
}

bundle agent createFile
{
        files:
#
#       the stanza below creates folders and file if it does not exist
#
                "/tmp/test/create_folder1/create_file4.txt"
                comment => "create file",
                perms => mog("755", "root", "root"),
                create => "true";

                "/tmp/test/create_folder1/create_folder2/create_file5.txt"
                comment => "create file",
                perms => mog("755", "root", "root"),
                create => "true";

                "/tmp/test/create_folder1/create_folder3/create_file6.txt"
                comment => "create file",
                perms => mog("755", "root", "root"),
                create => "true";
}

bundle agent copyLocalFile
{
        files:
                "/tmp/test/create_folder1/copy_local_file.txt"
                comment         => "copy local file",
                preserve        => "true",
                copy_from       => local_cp("/etc/mail/sendmail.mc");
}

bundle agent editFile
{
        files:
                "/tmp/test/create_folder1/copy_local_file.txt"
                comment         => "edit a line of a file",
                edit_line       => editLine("your.provider","cfengine.com");
}

bundle edit_line editLine(x,y)
{
        replace_patterns:
                "$(x)"
                replace_with    => With("$(y)");
}

body replace_with With(z)
{
        replace_value           => "$(z)";
        occurrences             => "all";
}"

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

Reply via email to