You can use concat fragments to specify the order of stanzas or lines. 

Forgive the pseudo code below but you should be able to get the idea

concat::fragment { original_file:
              order => 10,
}
concat::fragment { other_stuff:
              order => 50,
}

concat::fragment { last_line:
              order => 99,
}

This will allow you to specify a file where other admins can edit 
"original_file" and you can concat your changes in whatever order you want.
 

On Wednesday, December 4, 2013 5:37:26 PM UTC-6, Stack Kororā wrote:
>
> Greetings,
>
> I am currently managing a configuration file for an application with 
> puppet+file_line and so far everything is going well. I have about 30 rules 
> that I need to ensure are in the configuration file. The tricky part is 
> that the rest of the file I don't care about but some admin somewhere 
> *does*. I, as the puppet module dev/admin, may not care about "$someline" 
> but AdminA may need "$someline" to exist where AdminB may need "$someline" 
> to _not_ exist and AdminC may need "$someline" to exist with a different 
> value associated with it (!). Due to this complexity I have given up trying 
> the template route (maybe I am doing it wrong...but it was a pain trying to 
> deal with all the different parameters...I didn't get far before it was 
> over my head in complexity).
>
> In short, I am managing 30 lines of a config file with puppet in a config 
> file that may be anywhere between 30-100 lines long depending on the 
> system, admin, and use. 
>
> So what is the problem? Well up till this last rule, I haven't cared what 
> order these rules exist in the config file. It generally doesn't make a 
> difference. But not the latest addition to these rules that I am supposed 
> to ensure exists. This new rule is kind of like an iptables "-A INPUT -j 
> DROP" rule for this application. If it is anywhere *but* the last line of 
> the file, then all the rest of the config lines are ignored. Thankfully the 
> program at least complains about this so we can fix it manually, but it 
> would be awesome if puppet would ensure that this line was /always/ the 
> last line of the file.
>
> I tinkered with a few things (like anchors and stages) but the problem is 
> that if the line already exists and isn't at the end, nothing moves it to 
> the end. 
>
> Does anyone have any clever ideas on how to ensure that a line exists as 
> the very last item of a file? Or maybe there is a suggestion on a better 
> method of managing this config file?
>
> Thanks!
> ~Stack~
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/8255ddf3-053b-42b6-a4dc-5348fecf8d10%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to