diff --git a/murano-apps/CiCdEnvironment/package/Classes/CiCdEnvironment.yaml b/murano-apps/CiCdEnvironment/package/Classes/CiCdEnvironment.yaml index 82ef4cb..48d2815 100644 --- a/murano-apps/CiCdEnvironment/package/Classes/CiCdEnvironment.yaml +++ b/murano-apps/CiCdEnvironment/package/Classes/CiCdEnvironment.yaml @@ -109,3 +109,6 @@ Methods: - $this.ldap.deploy() - $this.gerrit.deploy() - $this.jenkins.deploy() + + - $ssh_private_key: $gerritInstance.getHieraValue('gerrit_ssh_rsa_key_contents') + - $this.jenkins.configureUser($ssh_private_key) diff --git a/murano-apps/Jenkins/package/Classes/Jenkins.yaml b/murano-apps/Jenkins/package/Classes/Jenkins.yaml index c3f0661..67384e8 100644 --- a/murano-apps/Jenkins/package/Classes/Jenkins.yaml +++ b/murano-apps/Jenkins/package/Classes/Jenkins.yaml @@ -127,3 +127,13 @@ Methods: Body: - $.reportDestroyed() - $.setAttr(deployed, false) + + configureUser: + Arguments: + - key: + Contract: $.string().notNull() + Body: + - $this.instance.setHieraValue('gerrit_ssh_rsa_key_contents', $key) + - $resources: new(sys:Resources) + - $template: $resources.yaml('JenkinsUser.template') + - $.instance.agent.call($template, $resources, 100) diff --git a/murano-apps/Jenkins/package/Resources/JenkinsUser.template b/murano-apps/Jenkins/package/Resources/JenkinsUser.template new file mode 100644 index 0000000..b65ba86 --- /dev/null +++ b/murano-apps/Jenkins/package/Resources/JenkinsUser.template @@ -0,0 +1,17 @@ +FormatVersion: 2.1.0 +Version: 1.0.0 +Name: Configure User + + +Body: | + return deploy().stdout + +Scripts: + deploy: + Type: Application + Version: 1.0.0 + EntryPoint: jenkins_user.sh + Files: ['jenkins_user.sh', 'jenkins_user.pp'] + Options: + captureStdout: true + captureStderr: true diff --git a/murano-apps/Jenkins/package/Resources/scripts/jenkins_user.pp b/murano-apps/Jenkins/package/Resources/scripts/jenkins_user.pp new file mode 100644 index 0000000..b09ebd2 --- /dev/null +++ b/murano-apps/Jenkins/package/Resources/scripts/jenkins_user.pp @@ -0,0 +1,8 @@ +node default { + $ssh_key = hiera('gerrit_ssh_rsa_key_contents', undef) + if $ssh_key { + class { 'jenkins::jenkinsuser': + ssh_key => $ssh_key + } + } +} \ No newline at end of file diff --git a/murano-apps/Jenkins/package/Resources/scripts/jenkins_user.sh b/murano-apps/Jenkins/package/Resources/scripts/jenkins_user.sh new file mode 100644 index 0000000..87db131 --- /dev/null +++ b/murano-apps/Jenkins/package/Resources/scripts/jenkins_user.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +puppet apply jenkins_user.pp \ No newline at end of file diff --git a/murano-apps/Puppet/package/Classes/PuppetInstance.yaml b/murano-apps/Puppet/package/Classes/PuppetInstance.yaml index 3bedf9a..32c5628 100644 --- a/murano-apps/Puppet/package/Classes/PuppetInstance.yaml +++ b/murano-apps/Puppet/package/Classes/PuppetInstance.yaml @@ -74,17 +74,6 @@ Methods: - $._environment.reporter.report($this, 'Puppet module {0} installed on {1}'.format( $module, $.openstackId)) - setHieraValue: - Arguments: - - key: - Contract: $.string().notNull() - - value: - Contract: $.string().notNull() - Body: - - $._environment.reporter.report($this, - 'Put value {0} = {1}'.format( $key, $value)) - - $.setYamlValue('/etc/puppet/hieradata/murano.yaml', $key, $value) - setHieraConfigValue: Arguments: - key: @@ -122,3 +111,14 @@ Methods: key => $key)) - $value: $.agent.call($template, $resources) - Return: $value + + setHieraValue: + Arguments: + - key: + Contract: $.string().notNull() + - value: + Contract: $.string().notNull() + Body: + - $._environment.reporter.report($this, + 'Put value {0} = {1}'.format( $key, $value)) + - $.setYamlValue('/etc/puppet/hieradata/murano.yaml', $key, $value)