Skip to content

Commit 6d052dd

Browse files
committed
allow to customize admin's token lifetime
1 parent 472d2b2 commit 6d052dd

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

Diff for: plans/install.pp

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
Optional[String] $stagingdir = undef,
6060
Enum[direct,bolthost] $download_mode = 'bolthost',
6161
Boolean $permit_unsafe_versions = false,
62+
String $token_lifetime = '1y',
6263
) {
6364
peadm::assert_supported_bolt_version()
6465

@@ -96,6 +97,7 @@
9697
stagingdir => $stagingdir,
9798
download_mode => $download_mode,
9899
permit_unsafe_versions => $permit_unsafe_versions,
100+
token_lifetime => $token_lifetime,
99101
)
100102

101103
$configure_result = run_plan('peadm::subplans::configure',

Diff for: plans/subplans/install.pp

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
String $stagingdir = '/tmp',
5959
Enum[direct,bolthost] $download_mode = 'bolthost',
6060
Boolean $permit_unsafe_versions = false,
61+
String $token_lifetime = '1y',
6162
) {
6263
peadm::assert_supported_pe_version($version, $permit_unsafe_versions)
6364

@@ -325,7 +326,8 @@
325326
run_command('systemctl stop pe-puppetdb', $primary_target)
326327
run_command('systemctl start pe-puppetdb', $primary_target)
327328
run_task('peadm::rbac_token', $primary_target,
328-
password => $console_password,
329+
password => $console_password,
330+
token_lifetime => $token_lifetime,
329331
)
330332

331333
# Stub a production environment and commit it to file-sync. At least one

Diff for: tasks/rbac_token.json

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"password": {
55
"type": "String",
66
"description": "The password for the admin user"
7+
},
8+
"token_lifetime": {
9+
"type": "String",
10+
"description": "The duration for which a token will be valid. Format <integer>[smhdy]"
711
}
812
},
913
"input_method": "stdin",

Diff for: tasks/rbac_token.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
body = {
1818
'login' => 'admin',
1919
'password' => $params['password'],
20-
'lifetime' => '1y',
20+
'lifetime' => $params['token_lifetime'],
2121
'label' => 'provision-time token',
2222
}.to_json
2323

0 commit comments

Comments
 (0)