Search code examples
puppet

understanding repl in puppet code


I am looking at puppet code that looks something like

class {
      users => {
           'repl@%' => {
                ensure => present,
                .
            }
       }
 }

What does "repl" do? I cant find much information online.


Solution

  • The amount of anonymization almost hides the important points. But I belive that this is supposed to be the declaration of a hash, meant for use with the create_resources function.

    It works like this: If you have a large number of resources that should not take all the space in your class (this reason is contrived), you can convert it to a hash structure instead.

    mysql_grant {
        'repl@%':
            ensure => present,
            rights => 'REPLICATION CLIENT';
    }
    

    This becomes a hash, stored in a variable.

    $users = {
        'repl@%' => {
            ensure => present,
            rights => 'REPLICATION CLIENT',
        }
    }
    

    This can then be used to declare this (and more resources in the hash, if there is more than one) in a simple line.

    create_resources('mysql_grant', $users)
    

    I'm guessing that you are looking at grants because repl@% is a typical MySQL notation that means user with name "repl" from any client.

    TL;DR it is a domain specific identifier and has no special meaning to Puppet itself.