Theme Inspinia
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!doctype html>
  2. <title>CodeMirror: Puppet mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <script src="../../lib/codemirror.js"></script>
  7. <script src="../../addon/edit/matchbrackets.js"></script>
  8. <script src="puppet.js"></script>
  9. <style>
  10. .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
  11. .cm-s-default span.cm-arrow { color: red; }
  12. </style>
  13. <div id=nav>
  14. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  15. <ul>
  16. <li><a href="../../index.html">Home</a>
  17. <li><a href="../../doc/manual.html">Manual</a>
  18. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  19. </ul>
  20. <ul>
  21. <li><a href="../index.html">Language modes</a>
  22. <li><a class=active href="#">Puppet</a>
  23. </ul>
  24. </div>
  25. <article>
  26. <h2>Puppet mode</h2>
  27. <form><textarea id="code" name="code">
  28. # == Class: automysqlbackup
  29. #
  30. # Puppet module to install AutoMySQLBackup for periodic MySQL backups.
  31. #
  32. # class { 'automysqlbackup':
  33. # backup_dir => '/mnt/backups',
  34. # }
  35. #
  36. class automysqlbackup (
  37. $bin_dir = $automysqlbackup::params::bin_dir,
  38. $etc_dir = $automysqlbackup::params::etc_dir,
  39. $backup_dir = $automysqlbackup::params::backup_dir,
  40. $install_multicore = undef,
  41. $config = {},
  42. $config_defaults = {},
  43. ) inherits automysqlbackup::params {
  44. # Ensure valid paths are assigned
  45. validate_absolute_path($bin_dir)
  46. validate_absolute_path($etc_dir)
  47. validate_absolute_path($backup_dir)
  48. # Create a subdirectory in /etc for config files
  49. file { $etc_dir:
  50. ensure => directory,
  51. owner => 'root',
  52. group => 'root',
  53. mode => '0750',
  54. }
  55. # Create an example backup file, useful for reference
  56. file { "${etc_dir}/automysqlbackup.conf.example":
  57. ensure => file,
  58. owner => 'root',
  59. group => 'root',
  60. mode => '0660',
  61. source => 'puppet:///modules/automysqlbackup/automysqlbackup.conf',
  62. }
  63. # Add files from the developer
  64. file { "${etc_dir}/AMB_README":
  65. ensure => file,
  66. source => 'puppet:///modules/automysqlbackup/AMB_README',
  67. }
  68. file { "${etc_dir}/AMB_LICENSE":
  69. ensure => file,
  70. source => 'puppet:///modules/automysqlbackup/AMB_LICENSE',
  71. }
  72. # Install the actual binary file
  73. file { "${bin_dir}/automysqlbackup":
  74. ensure => file,
  75. owner => 'root',
  76. group => 'root',
  77. mode => '0755',
  78. source => 'puppet:///modules/automysqlbackup/automysqlbackup',
  79. }
  80. # Create the base backup directory
  81. file { $backup_dir:
  82. ensure => directory,
  83. owner => 'root',
  84. group => 'root',
  85. mode => '0755',
  86. }
  87. # If you'd like to keep your config in hiera and pass it to this class
  88. if !empty($config) {
  89. create_resources('automysqlbackup::backup', $config, $config_defaults)
  90. }
  91. # If using RedHat family, must have the RPMforge repo's enabled
  92. if $install_multicore {
  93. package { ['pigz', 'pbzip2']: ensure => installed }
  94. }
  95. }
  96. </textarea></form>
  97. <script>
  98. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  99. mode: "text/x-puppet",
  100. matchBrackets: true,
  101. indentUnit: 4
  102. });
  103. </script>
  104. <p><strong>MIME types defined:</strong> <code>text/x-puppet</code>.</p>
  105. </article>