Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hdm data types on complex hashes and arrays #3

Merged
merged 4 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 67 additions & 4 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
* `hdm::docker`: A short summary of the purpose of this class
* `hdm::puppet_ruby`: A short summary of the purpose of this class

### Data types

* [`Hdm::Gitdata`](#hdmgitdata): type to enforce git settings for HDM
* [`Hdm::Ldap_settings`](#hdmldap_settings): type to enforce ldap settings for HDM
* [`Hdm::Puppetdb`](#hdmpuppetdb): type to enforce puppetdb settings for HDM

## Classes

### <a name="hdm"></a>`hdm`
Expand Down Expand Up @@ -95,7 +101,7 @@ Default value: `3000`

##### <a name="bind_ip"></a>`bind_ip`

Data type: `String[1]`
Data type: `Stdlib::IP::Address::Nosubnet`

The ip address to bind the process to

Expand Down Expand Up @@ -143,7 +149,7 @@ Default value: `'hdm'`

##### <a name="puppetdb_settings"></a>`puppetdb_settings`

Data type: `Hash`
Data type: `Hdm::Puppetdb`

A hash to provide information on how
HDM can connect to puppetdb
Expand All @@ -159,6 +165,7 @@ Using PE token:
{
'server' => 'https://localhost:8081',
'token' => '/etc/hdm/puppetdb.token',
'cacert' => '<path to cacert>',
}
```
Using SSL cert:
Expand Down Expand Up @@ -209,7 +216,7 @@ Default value: ``true``

##### <a name="git_data"></a>`git_data`

Data type: `Array`
Data type: `Hdm::Gitdata`

Configure several settings related to the option
to modify data via Webfrontend. WARNING!! untested!!
Expand All @@ -229,7 +236,7 @@ Default value: `[]`

##### <a name="ldap_settings"></a>`ldap_settings`

Data type: `Hash`
Data type: `Hdm::Ldap_settings`

Config for LDAP integration
Needs the following Hash:
Expand All @@ -254,3 +261,59 @@ want HDM to not use hiera.yaml.

Default value: `'hiera.yaml'`

## Data types

### <a name="hdmgitdata"></a>`Hdm::Gitdata`

type to enforce git settings for HDM

Alias of

```puppet
Array[Optional[Struct[
{
datadir => Stdlib::Unixpath,
git_url => String[1],
path_in_repo => String[1],
Optional[ssh_priv_key] => String[1],
}
]]]
```

### <a name="hdmldap_settings"></a>`Hdm::Ldap_settings`

type to enforce ldap settings for HDM

Alias of

```puppet
Struct[{
Optional[host] => Stdlib::Host,
Optional[port] => Stdlib::Port,
Optional[base_dn] => String[1],
Optional[bind_dn] => String[1],
Optional[bind_dn_password] => String[1],
}]
```

### <a name="hdmpuppetdb"></a>`Hdm::Puppetdb`

type to enforce puppetdb settings for HDM

Alias of

```puppet
Struct[{
server => Stdlib::Httpurl,
Optional[pem] => Struct[
{
key => Stdlib::Unixpath,
cert => Stdlib::Unixpath,
ca_file => Stdlib::Unixpath,
}
],
Optional[token] => Stdlib::Unixpath,
Optional[cacert] => Stdlib::Unixpath,
}]
```

9 changes: 5 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# {
# 'server' => 'https://localhost:8081',
# 'token' => '/etc/hdm/puppetdb.token',
# 'cacert' => '<path to cacert>',
# }
# ```
# Using SSL cert:
Expand Down Expand Up @@ -110,19 +111,19 @@
Boolean $manage_docker = true,
String[1] $version = 'main',
Stdlib::Port $port = 3000,
String[1] $bind_ip = '0.0.0.0',
Stdlib::IP::Address::Nosubnet $bind_ip = '0.0.0.0',
String[1] $hostname = $facts['networking']['fqdn'],
Stdlib::Unixpath $hdm_path = '/etc/hdm',
String[1] $user = 'hdm',
String[1] $group = 'hdm',
String[1] $git_url = 'https://github.com/betadots/hdm.git',
Hash $puppetdb_settings = { 'server' => 'http://localhost:8080', },
Hdm::Puppetdb $puppetdb_settings = { 'server' => 'http://localhost:8080', },
Stdlib::Unixpath $puppet_code_dir = '/etc/puppetlabs/code',
String[1] $hdm_hiera_config_file = 'hiera.yaml',
Boolean $allow_encryption = false,
Boolean $read_only = true,
Array $git_data = [],
Hash $ldap_settings = {},
Hdm::Gitdata $git_data = [],
Hdm::Ldap_settings $ldap_settings = {},
) {
case $method {
'docker': {
Expand Down
11 changes: 11 additions & 0 deletions types/gitdata.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @summary type to enforce git settings for HDM
type Hdm::Gitdata = Array[
tuxmea marked this conversation as resolved.
Show resolved Hide resolved
Optional[Struct[
{
datadir => Stdlib::Unixpath,
git_url => String[1],
path_in_repo => String[1],
Optional[ssh_priv_key] => String[1],
}
]]
]
10 changes: 10 additions & 0 deletions types/ldap_settings.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @summary type to enforce ldap settings for HDM
type Hdm::Ldap_settings = Struct[
{
Optional[host] => Stdlib::Host,
Optional[port] => Stdlib::Port,
Optional[base_dn] => String[1],
Optional[bind_dn] => String[1],
Optional[bind_dn_password] => String[1],
}
]
15 changes: 15 additions & 0 deletions types/puppetdb.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @summary type to enforce puppetdb settings for HDM
type Hdm::Puppetdb = Struct[
{
server => Stdlib::Httpurl,
Optional[pem] => Struct[
{
key => Stdlib::Unixpath,
cert => Stdlib::Unixpath,
ca_file => Stdlib::Unixpath,
}
],
Optional[token] => Stdlib::Unixpath,
Optional[cacert] => Stdlib::Unixpath,
}
]