Skip to content

Commit

Permalink
Merge pull request #3 from troter/jinja2-style-variable-access
Browse files Browse the repository at this point in the history
jinja2 style variable access
  • Loading branch information
tberton committed Oct 29, 2013
2 parents 6fb49d6 + 861c9b1 commit b311158
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions setup.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: "Jenkins playbook"
hosts: jenkins
user: $user
user: {{ user }}
sudo: yes
sudo_user: root

vars_files:
- vars/jenkins.yml

tasks:
- include: tasks/setup.yml
- include: tasks/setup.yml
26 changes: 13 additions & 13 deletions tasks/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,62 @@
# If Jenkins is installed or updated, wait for pulling the Jenkins CLI, assuming 10s should be sufficiant
- name: 10s delay while starting Jenkins
wait_for: port=8080 delay=10
when: ${jenkins_install.changed}
when: jenkins_install.changed
tags:
- jenkins
- cli

# Create Jenkins CLI destination directory
- name: "Create Jenkins CLI destination directory: ${jenkins.dest}"
file: path=${jenkins.dest} state=directory
- name: "Create Jenkins CLI destination directory: {{ jenkins.dest }}"
file: path={{ jenkins.dest }} state=directory
tags:
- jenkins
- cli

# Get Jenkins CLI from localhost
- name: Get Jenkins CLI
get_url: url=http://localhost:8080/jnlpJars/jenkins-cli.jar dest=${jenkins.cli_dest} mode=0440
get_url: url=http://localhost:8080/jnlpJars/jenkins-cli.jar dest={{ jenkins.cli_dest }} mode=0440
tags:
- jenkins
- cli

# Get latest Jenkins update file
- name: Get Jenkins updates
get_url: url=http://updates.jenkins-ci.org/update-center.json dest=${jenkins.updates_dest} thirsty=yes mode=0440
get_url: url=http://updates.jenkins-ci.org/update-center.json dest={{ jenkins.updates_dest }} thirsty=yes mode=0440
register: jenkins_updates
tags:
- jenkins
- cli

# Jenkins Update-center
- name: Update-center Jenkins
shell: "cat ${jenkins.updates_dest} | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- http://localhost:8080/updateCenter/byId/default/postBack"
when: ${jenkins_updates.changed}
shell: "cat {{ jenkins.updates_dest }} | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- http://localhost:8080/updateCenter/byId/default/postBack"
when: jenkins_updates.changed
tags:
- jenkins
- cli

# Install/update Jenkins plugins
- name: Install/update plugins
command: java -jar ${jenkins.cli_dest} -s http://localhost:8080 install-plugin ${item}
when: when $plugins is defined and ${jenkins_updates.changed}
with_items: $plugins
command: java -jar {{ jenkins.cli_dest }} -s http://localhost:8080 install-plugin {{ item }}
when: plugins is defined and jenkins_updates.changed
with_items: plugins
tags:
- jenkins
- cli

# Wait for Jenkins to install plugins, assuming 10s should be sufficiant
- name: 10s delay while installing plugins
wait_for: port=8080 delay=10
when: ${jenkins_updates.changed}
when: jenkins_updates.changed
tags:
- jenkins
- cli

# Safe-restart Jenkins
- name: Safe-restart Jenkins
command: java -jar ${jenkins.cli_dest} -s http://localhost:8080 safe-restart
when: ${jenkins_updates.changed}
command: java -jar {{ jenkins.cli_dest }} -s http://localhost:8080 safe-restart
when: jenkins_updates.changed
tags:
- jenkins
- cli
6 changes: 3 additions & 3 deletions tasks/dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
# Install Jenkins dependencies
- name: Install dependencies
apt: pkg=${item} state=installed update-cache=yes
with_items: ${jenkins.dependencies}
apt: pkg={{ item }} state=installed update-cache=yes
with_items: jenkins.dependencies
tags:
- packages
- dependencies
- dependencies
6 changes: 3 additions & 3 deletions tasks/repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

# Add Jenkins repository key
- name: Add jenkins apt-key
apt_key: url=${jenkins.key} state=present
apt_key: url={{ jenkins.key }} state=present
tags:
- repo
- jenkins

# Add Jenkins repository
- name: Add Jenkins repository
apt_repository: repo='${jenkins.repo}' state=present
apt_repository: repo='{{ jenkins.repo }}' state=present
tags:
- repo
- jenkins
Expand All @@ -27,4 +27,4 @@
command: sed --in-place '/deb-src.*pkg.jenkins-ci/d' /etc/apt/sources.list
tags:
- repo
- jenkins
- jenkins

0 comments on commit b311158

Please sign in to comment.