pulp_resources

Pulp resources

Dawei Wang

af6140

6,911 downloads

5,532 latest version

4.6 quality score

Version information

  • 0.0.5 (latest)
  • 0.0.4
released Nov 7th 2016
This version is compatible with:
  • RedHat

Start using this module

Documentation

af6140/pulp_resources — version 0.0.5 Nov 7th 2016

#pulp_resource

Talbe of Contents

  1. Module description - What is the pulp_resource module, and what does it do?

Module description

This module defines custom types and providers to manage pulp server resources, including repo, user, role, user permission and role permission.

Set up

What the pulp_resource module required:

  • puppetlabs/inifile module: A inifile utility class is used. The built-in puppet/util/inifile does not allow customized key value seperator
  • working pulp-admin client installation
  • ~/.pulp/admin.conf with auth configuration
[auth]
username: admin
password: admin

Note: This module use credentials from admin.conf to login, so a user certificate is generated. It uses the certificate for operations later on. It checks the certificate expiration date and logins again if necessary.

Beginning with pulp_resource

Declaring pulp_resource class to include custom types.

class {'pulp_resource':
}

Managing pulp resources with custom types

Pulp repos####

Listing pulp repos: (other resource types works similarly)

[root@localhost ~]# puppet resource pulp_repo
pulp_repo { 'test':
  ensure      => 'present',
  description => 'test rpm repo',
  serve_http  => 'false',
  serve_https => 'true',
  type        => 'rpm',
}
pulp_repo { 'test_rpm':
  ensure       => 'present',
  description  => '"test rpm"',
  display_name => '"Test RPM Repo"',
  serve_http   => 'false',
  serve_https  => 'true',
  type         => 'rpm',
}
pulp_repo { 'test_rpm2':
  ensure      => 'present',
  description => '2test rpm repo',
  serve_http  => 'false',
  serve_https => 'true',
  type        => 'rpm',
}
pulp_repo { 'test_rpm_rpm':
  ensure       => 'present',
  description  => 'test rpm',
  display_name => 'Test RPM Repo',
  serve_http   => 'false',
  serve_https  => 'true',
  type         => 'rpm',
}

Create a pulp repository:

pulp_repo {'test_rpm':
 ensure => 'present',
 description => 'test rpm repository',
 display_name => 'Test RPM Repository',
 feed => 'http://dummy',
 serve_http => 'false',
 serve_https => 'true',
 type => 'rpm',
}

Create a pulp user:

Note A password field is required, but it is only effective when the user is created.

pulp_user {'test':
 ensure => 'present',
 roles => ['super-user'],
 password => 'test',
}

Create a pulp role:

pulp_role {'testrole':
  ensure => 'present',
  description => 'test role',
}

Create a pulp user permission:

This resource use composite namevar. The title is spit into two parts seperated by ':', first part is the name which maps to pulp user login, the second part is the pulp resource.

pulp_permission {'test:/':
  ensure => 'present',
  permissions => ['read']
}

Create a pulp role permission:

It uses composite namevar. The title split into two parts seperated by ':'. The first part is the role-id, the second part is the resource.

pulp_role_permission{'testrole:/':
  ensure => 'present',
  permissions => ['read']
}