imfreedom/bamboo-terraform

e58899dfbce8
Parents 769cb2f0d86c
Children 10cdd0571af7
Add qemu-user-static and add some restraints on when we run commands
--- a/ansible/roles/pidgin.bamboo-agent/tasks/main.yml Sat May 25 21:58:37 2019 -0500
+++ b/ansible/roles/pidgin.bamboo-agent/tasks/main.yml Sun May 26 00:16:09 2019 -0500
@@ -1,3 +1,4 @@
+# vi:et:ts=2 sw=2 sts=2
---
- name: precondition - bamboo_server
fail: msg="ERROR -required variable 'bamboo_server' missing."
@@ -39,6 +40,7 @@
[Install]
WantedBy=multi-user.target
+
# install our dependencies
- name: Install Dependencies
become: yes
@@ -47,6 +49,7 @@
- mercurial
- git
- openjdk-8-jre-headless
+ - qemu-user-static
state: present
install_recommends: no
update_cache: yes
@@ -67,11 +70,24 @@
createhome: yes
home: "{{bamboo_home}}"
+# create a data directory (mostly used for triggers)
+- file:
+ name: "{{bamboo_agent_home}}"
+ state: directory
+ owner: "{{bamboo_user}}"
+ group: "{{bamboo_group}}"
+ with_items:
+ - "{{bamboo_agent_home}}"
+ - "{{bamboo_agent_home}}/conf"
+ - "{{bamboo_agent_home}}/bin"
+ register: agent_home
+
# download the jar
- name: get bamboo agent installer (as jar)
get_url:
url: "{{bamboo_jar_url}}"
dest: "{{bamboo_home}}/{{bamboo_jar}}"
+ when: agent_home.changed
# stop the agent if it's already running
- name: stop agent
@@ -79,6 +95,7 @@
state: stopped
name: bamboo-agent
ignore_errors: yes
+ when: agent_home.changed
# run the installer
- name: run bamboo installer
@@ -86,14 +103,15 @@
args:
chdir: "{{bamboo_home}}"
become: yes
+ when: agent_home.changed
-- name: fix bamboo permissions
- file:
- owner: "{{bamboo_user}}"
- group: "{{bamboo_group}}"
- recurse: yes
- path: "{{bamboo_home}}"
- become: yes
+#- name: fix bamboo permissions
+# file:
+# owner: "{{bamboo_user}}"
+# group: "{{bamboo_group}}"
+# recurse: yes
+# path: "{{bamboo_home}}"
+# become: yes
# now start the agent
- name: start bamboo-agent
@@ -101,4 +119,5 @@
state: started
daemon_reload: yes
name: bamboo-agent
+ when: agent_home.changed