Ejemplo n.º 1
0
 def it_creates_an_include_statement_for_each_role():
     env.roledefs = {
         'app': 'server.example.com',
         'db': 'server.example.com',
     }
     env.host_string = 'server.example.com'
     site_pp = generate_site_pp()
     assert 'include "roles::app"' in site_pp
     assert 'include "roles::db"' in site_pp
Ejemplo n.º 2
0
    def it_creates_an_include_statement_for_each_role_sorted():
        env.roledefs = {
            'app': 'server.example.com',
            'db': 'server.example.com',
            'zapp': 'server.example.com',
        }
        env.host_string = 'server.example.com'

        expected = 'include "roles::app"\ninclude "roles::db"\ninclude "roles::zapp"\n'
        assert generate_site_pp() == expected
Ejemplo n.º 3
0
    def it_creates_an_include_statement_for_each_role_sorted():
        env.roledefs = {
            'app': 'server.example.com',
            'db': 'server.example.com',
            'zapp': 'server.example.com',
        }
        env.host_string = 'server.example.com'

        expected = 'include "roles::app"\ninclude "roles::db"\ninclude "roles::zapp"\n'
        assert generate_site_pp() == expected
Ejemplo n.º 4
0
def update():
    """
    Upload puppet modules
    """
    if not current_roles():
        abort('Host "%s" has no roles. Does it exist in this environment?' % env.host_string)

    # Install local modules
    module_dir = env.get('puppet_module_dir', 'modules/')
    if not module_dir.endswith('/'): module_dir+='/'
    upload_dir(module_dir, '/etc/puppet/modules', use_sudo=True)

    # Install vendor modules
    put('Puppetfile', '/etc/puppet/Puppetfile', use_sudo=True)
    with cd('/etc/puppet'):
        sudo('librarian-puppet install --path /etc/puppet/vendor')

    # Install site.pp
    sudo('mkdir -p /etc/puppet/manifests')
    put(StringIO(generate_site_pp()), '/etc/puppet/manifests/site.pp', use_sudo=True)
Ejemplo n.º 5
0
def update():
    """
    Upload puppet modules
    """
    if not current_roles():
        abort('Host "%s" has no roles. Does it exist in this environment?' %
              env.host_string)

    # Install local modules
    module_dir = env.get('puppet_module_dir', 'modules/')
    if not module_dir.endswith('/'): module_dir += '/'
    upload_dir(module_dir, '/etc/puppet/modules', use_sudo=True)

    # Install vendor modules
    put('Puppetfile', '/etc/puppet/Puppetfile', use_sudo=True)
    with cd('/etc/puppet'):
        sudo('librarian-puppet install --path /etc/puppet/vendor')

    # Install site.pp
    sudo('mkdir -p /etc/puppet/manifests')
    put(StringIO(generate_site_pp()),
        '/etc/puppet/manifests/site.pp',
        use_sudo=True)