aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2013-11-26 04:36:13 +0200
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2013-11-26 04:36:13 +0200
commite0ed53032994547ffda69640a8e9b013bf31df83 (patch)
tree191f9092cf9a2331d6b3e48109354fa3db39db3c
parentda3951b106c3b3298930601899469e87c227c3b2 (diff)
Use proper idiom for checking if vars defined.
http://www.ansibleworks.com/docs/playbooks_conditionals.html
-rw-r--r--ansible-deploy/jenkins.yml3
-rw-r--r--ansible-deploy/roles/jenkins/tasks/main.yml4
2 files changed, 4 insertions, 3 deletions
diff --git a/ansible-deploy/jenkins.yml b/ansible-deploy/jenkins.yml
index d915f86..b421062 100644
--- a/ansible-deploy/jenkins.yml
+++ b/ansible-deploy/jenkins.yml
@@ -7,13 +7,14 @@
- jenkins_version: 1.509.2
- ssl_cert: /etc/ssl/certs/{{site_name}}.crt
- ssl_key: /etc/ssl/private/{{site_name}}.key
+ - private_vars: ../ansible-private-vars/main.yml
# "native" or "crowd"
- jenkins_auth: crowd
vars_files:
# Include private settings only if they exist - not all modes need
# them (e.g. jenkins_auth: native).
# Following construct works as: find first file which exists and use it.
- - ["../ansible-private-vars/main.yml", "vars/empty.yml"]
+ - ["{{private_vars}}", "vars/empty.yml"]
roles:
- common
- apache
diff --git a/ansible-deploy/roles/jenkins/tasks/main.yml b/ansible-deploy/roles/jenkins/tasks/main.yml
index c7cf6ca..7587714 100644
--- a/ansible-deploy/roles/jenkins/tasks/main.yml
+++ b/ansible-deploy/roles/jenkins/tasks/main.yml
@@ -1,6 +1,6 @@
- name: Verify Jenkins parameters
- local_action: copy content="{{crowd_user}} {{crowd_passwd}}" dest=/dev/null
- when: jenkins_auth == "crowd"
+ fail: msg="crowd_user and crowd_passwd should be defined in {{private_vars}}"
+ when: jenkins_auth == "crowd" and (crowd_user is not defined or crowd_passwd is not defined)
- name: Install Jenkins dependency packages
apt: pkg={{item}}