Wikimedia Labs/Puppet learning mode

Note: looks like something like this already exists, called Blueprint

Write application that will record actions as puppet configuration while setting up services manually.

  • Watch apt log, and make configuration for each action:
    apt-get install:
       package { "<packagename>":
           ensure => latest;
       }
  • apt-get (purge|remove):
       package { "<packagename>":
           ensure => absent;
       }
  • apt-key add:
       apt::key { "<keyname>": apt_key => "<keyname>" }
  • apt-key delete:
       apt::key { "<keyname>": apt_key => "<keyname>", ensure => absent }
  • Watch for file edits via editor logs, and copy files and make configuration:
    On edit/copy:
       file {
           "<file-location>":
               content => template("<file>"),
               owner => <file-owner>,
               group => <file-group>,
               mode => <file-mode>;
       }
  • On chmod/chown/chgrp, make or modify configuration
  • When exiting learning mode, inspect the firewall rules and make configuration
  • Have a logger, to document your steps as you go. The messages should be output in MediaWiki format:
    log heading "Configuring OpenStack"
    log number-list --begin
    log "Install packages"
    log heading "..."
    log number-list --end
    ...
  • Application should keep configuration in an intermediate state, and should output when asked.