summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeoffrey B <jeoffrey54@gmail.com>2016-02-03 08:22:30 +0100
committerJeoffrey B <jeoffrey54@gmail.com>2016-02-03 08:22:30 +0100
commit210f770853bb2c7c5ddca7eb52f85db7c2377ab2 (patch)
treeefe31ee1a68caa7ff3999297b363956502b644b0
parent2e566505836f0ac7aa77b6fd4d7f8f1a789e77b9 (diff)
parent2bc9d47add521d78f8ade7ff5de36b77104d0371 (diff)
Merge pull request #2 from rchicoli/add-runner-parameters
Add runner parameters
-rw-r--r--README.markdown26
-rw-r--r--manifests/config.pp3
-rw-r--r--manifests/init.pp6
-rw-r--r--manifests/params.pp2
-rw-r--r--manifests/runner.pp3
-rw-r--r--templates/fragment_runner_config.toml.erb10
6 files changed, 41 insertions, 9 deletions
diff --git a/README.markdown b/README.markdown
index f0bb736..7434c2d 100644
--- a/README.markdown
+++ b/README.markdown
@@ -37,13 +37,33 @@ If your module requires anything extra before setting up (pluginsync enabled, et
###Beginning with gitlab_ci_multi_runner
-The very basic steps needed for a user to get the module up and running.
+To use the gitlab_ci_multi_runner with default parameters, declare the ```gitlab_ci_multi_runner``` class.
-If your most recent release breaks compatibility or requires particular steps for upgrading, you may wish to include an additional section here: Upgrading (For an example, see http://forge.puppetlabs.com/puppetlabs/firewall).
+```puppet
+include gitlab_ci_multi_runner
+```
+
+**Note:** The main gitlab_ci_multi_runner class is required by all other classes, types, and defines in this module. You must declare it whenever you use the module.
##Usage
-Put the classes, types, and resources for customizing, configuring, and doing the fancy stuff with your module here.
+### Hiera
+
+```hiera
+gitlab_ci_multi_runner::runners:
+ 'host01-ssh':
+ url: 'https://gitlab.example.com/ci'
+ token: 'abb0d7b09e8491ccc6a0d4264fc319ca'
+ tls_skip_verify: true
+ tls_ca_file: '/usr/local/share/ca-certificates/ca.crt'
+ executor: 'ssh'
+ ssh_params:
+ host: "%{::fqdn}"
+ port: '22'
+ user: 'gitlab-runner'
+ password: 'strongpassword'
+ identity_file: ''
+```
##Reference
diff --git a/manifests/config.pp b/manifests/config.pp
index c8a6fbd..fec0ac2 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -21,7 +21,4 @@ class gitlab_ci_multi_runner::config (
order => '01',
}
- if $gitlab_ci_multi_runner::runners {
- create_resources(gitlab_ci_multi_runner::runner, $runners)
- }
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 1670d98..cd39308 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -45,7 +45,11 @@ class gitlab_ci_multi_runner (
$config_file = $gitlab_ci_multi_runner::params::config_file,
) inherits gitlab_ci_multi_runner::params {
- # validate parameters here
+ validate_hash($gitlab_ci_multi_runner::runners)
+
+ if $gitlab_ci_multi_runner::runners {
+ create_resources(gitlab_ci_multi_runner::runner, $runners)
+ }
anchor { 'before_gitlab_ci_multi_runner': } ->
class { 'gitlab_ci_multi_runner::install': } ->
diff --git a/manifests/params.pp b/manifests/params.pp
index d883d12..5a18d34 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -10,7 +10,7 @@ class gitlab_ci_multi_runner::params {
$group = 'gitlab-runner'
$concurrent = 1
- $runners = undef
+ $runners = {}
$service_ensure = true
$service_start = '/usr/bin/gitlab-ci-multi-runner start'
diff --git a/manifests/runner.pp b/manifests/runner.pp
index 2af8271..1ec3e82 100644
--- a/manifests/runner.pp
+++ b/manifests/runner.pp
@@ -60,8 +60,11 @@ define gitlab_ci_multi_runner::runner (
$disable_verbose = undef,
$output_limit = undef,
$docker_params = undef,
+ $ssh_params = undef,
$parallels_params = undef,
$config_file = $gitlab_ci_multi_runner::params::config_file,
+ $tls_skip_verify = undef,
+ $tls_ca_file = undef,
){
concat::fragment { "${name}_${gitlab_ci_multi_runner::config_file}":
diff --git a/templates/fragment_runner_config.toml.erb b/templates/fragment_runner_config.toml.erb
index a9c3ca3..092e37d 100644
--- a/templates/fragment_runner_config.toml.erb
+++ b/templates/fragment_runner_config.toml.erb
@@ -1,6 +1,8 @@
[[runners]]
+<% if @name -%>
name = "<%= @name %>"
+<% end -%>
executor = "<%= @executor %>"
<% if @url -%>
url = "<%= @url %>"
@@ -26,6 +28,12 @@
<% if @output_limit -%>
output_limit = <%= @output_limit %>
<% end -%>
+<% if @tls_skip_verify -%>
+ tls_skip_verify = <%= @tls_skip_verify %>
+<% end -%>
+<% if @tls_ca_file -%>
+ tls_ca_file = "<%= @tls_ca_file %>"
+<% end -%>
<% if executor == 'docker' -%>
[runners.docker]
<%- if @docker_params['host'] -%>
@@ -92,4 +100,4 @@
<%- if @ssh_params['identity_file'] -%>
identity_file = "<%= @ssh_params['identity_file'] %>"
<%- end -%>
-<% end -%> \ No newline at end of file
+<% end -%>