Adventures in Puppet: Tangled Strings

Posted on Wednesday, 4 August 2010

I am trying to do as much management on my new VM servers as possible with Puppet, but these are machines I still frequently log on to, and not everything is managed by Puppet, so it's entirely possible that in a fit of forgetfulness I will start editing a file that Puppet is managing and then be annoyed when my changes are lost next time Puppet runs.
Since prior preparation and planning prevents pitifully poor performance, I decided to do something about this.

Thus, I present a VIM plugin called TangledStrings, which I'm distributing as a Vimball (.vba) you can download from its project page on Launchpad. For more information on Vimball formatted plugins, see this page. To install the plugin, simply:

  • vim tangledstrings.vba

  • Follow the instructions from Vimball to type: :so %

By default, TangledStrings will show a (configurable) warning message when you load a Puppet-owned file:

This message can be disabled, and you can choose to enable a persistent message in the VIM status line instead:

(or you could choose to enable both of these methods).

For more information, see the documentation included in the Vimball which you can display with the VIM command:
:help TangledStrings

Suggestions, improvements, patches, etc. are most welcome! Email me or use Launchpad to file bugs and propose merges.


  1. Great idea, but as we us rvn/svn to add a header to all puppets files, theres no need for me to use this - surprised you dont use similar and there is a need for this?

    just my 0.02c

  2. M: Headers are definitely a good thing, but someone has to add them to every file (although you could at least verify this pretty trivially). There might be files where comments aren't possible, etc, etc.
    I see this plugin as an additional line of defence, but you're not wrong :)

  3. oh i agree, its a very cute hack :) and additional lines of defence is no bad thing - iptables fragments are one which spring to mind that requires no headers but was genuinely curious as to wether you were using headers on version control with your puppet configs

    Using a wrapper script to add your headers when you create your file is also an easy way of adding headers if youre forgetful like me :)

  4. Today I started evaluating your plugin and I found it's really awesome! I already rolled it out on my Puppet machines and shared my experiences on my blog here: http://berndadamowicz.wordpress.com/2011/12/30/recognize-puppet-managed-files/.

    Of course I've credited you. Thanks a lot for sharing this toll with the world!