Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
0
 def it_returns_the_roles_for_the_current_host():
     env.roledefs = {'app': 'app.example.com'}
     env.host_string = 'app.example.com'
     assert current_roles() == ['app']
Beispiel #4
0
def generate_site_pp():
    site = ''.join('include "roles::%s"\n' % role
                   for role in sorted(current_roles()))
    return site
Beispiel #5
0
 def it_returns_the_roles_for_the_current_host():
     env.roledefs = {'app': 'app.example.com'}
     env.host_string = 'app.example.com'
     assert current_roles() == ['app']
Beispiel #6
0
 def it_returns_the_roles_for_the_current_host():
     env.roledefs = {"app": "app.example.com"}
     env.host_string = "app.example.com"
     assert current_roles() == ["app"]
Beispiel #7
0
def generate_site_pp():
    site = ''.join('include "roles::%s"\n' % role for role in sorted(current_roles()))
    return site