
The code is switching from relying on metadata based groups to dynamically created groups with add_host. As such, the group containing puppetmaster is now 'puppetmaster'. Change-Id: Ic66a68fd7e873816ec27be37ce4842eea8268a47
24 lines
917 B
YAML
24 lines
917 B
YAML
---
|
|
- name: Run puppet agent to install Jenkins
|
|
puppet:
|
|
|
|
- name: Get JJB password from Puppetmaster Hiera
|
|
command: hiera -c /etc/puppet/hiera.yaml jenkins_jobs_password environment=production
|
|
delegate_to: "{{ groups['puppetmaster'][0] }}"
|
|
register: jenkins_jobs_password
|
|
no_log: True
|
|
|
|
- name: Download Jenkins CLI to /tmp
|
|
get_url: url=http://localhost:8080/jnlpJars/jenkins-cli.jar dest=/tmp/jenkins-cli.jar
|
|
register: result
|
|
until: result|success
|
|
retries: 5
|
|
delay: 10
|
|
|
|
- name: Run Groovy script on Jenkins CLI to create JJB user and set password
|
|
shell: echo 'hpsr=new hudson.security.HudsonPrivateSecurityRealm(false); hpsr.createAccount("gerrig", "{{ jenkins_jobs_password }}")' | java -jar /tmp/jenkins-cli.jar -s http://localhost:8080 groovy =
|
|
no_log: True
|
|
|
|
- name: Trigger 'jenkins-jobs update' to populate Jenkins jobs
|
|
command: jenkins-jobs update /etc/jenkins_jobs/config --delete-old
|