summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-09-17 16:54:28 +0100
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-09-17 16:54:28 +0100
commite594df7ed432d74cc56eaa5e29a1bfed7b22aae5 (patch)
tree3f91726ef415ebd7fed10e301287fe662e1ac7af
parentb2260b5fb45f4519bf7ea31ac278ffac7cddfbb7 (diff)
parent48a9bb48b428e08395179800359d264ef35b5c24 (diff)
downloadtrove-setup-e594df7ed432d74cc56eaa5e29a1bfed7b22aae5.tar.gz
Merge branch 'baserock/pedroalvarez/allow-empty-upstream-trove3'
Reviewed-by: Richard Maw Reviewed-by: Lars Wirzenius
-rw-r--r--ansible/roles/trove-setup/tasks/check.yml3
-rw-r--r--ansible/roles/trove-setup/tasks/known-hosts-setup.yml5
-rw-r--r--ansible/roles/trove-setup/tasks/lorry-controller-setup.yml18
-rw-r--r--share/lorry-controller.conf23
4 files changed, 24 insertions, 25 deletions
diff --git a/ansible/roles/trove-setup/tasks/check.yml b/ansible/roles/trove-setup/tasks/check.yml
index 6305a78..1495b4b 100644
--- a/ansible/roles/trove-setup/tasks/check.yml
+++ b/ansible/roles/trove-setup/tasks/check.yml
@@ -26,9 +26,6 @@
- fail: msg='WORKER_SSH_PUBKEY is mandatory'
when: WORKER_SSH_PUBKEY is not defined
-- fail: msg='UPSTREAM_TROVE is mandatory'
- when: UPSTREAM_TROVE is not defined
-
- set_fact: UPSTREAM_TROVE_PROTOCOL=ssh
when: UPSTREAM_TROVE_PROTOCOL is not defined
diff --git a/ansible/roles/trove-setup/tasks/known-hosts-setup.yml b/ansible/roles/trove-setup/tasks/known-hosts-setup.yml
index 6e988e0..a8d18f7 100644
--- a/ansible/roles/trove-setup/tasks/known-hosts-setup.yml
+++ b/ansible/roles/trove-setup/tasks/known-hosts-setup.yml
@@ -1,7 +1,10 @@
# Depends on:
# - check.yml
---
+# If UPSTREAM_TROVE is not defined, the jinja2 'default' filter will
+# replace it with an empty string. ssh-keyscan skips empty hostnames,
+# so it will run only with 'localhost'
- name: Add localhost and UPSTREAM_TROVE to /etc/ssh/ssh_known_hosts
shell: |
- ssh-keyscan localhost {{ UPSTREAM_TROVE|quote }} > /etc/ssh/ssh_known_hosts
+ ssh-keyscan localhost {{ UPSTREAM_TROVE|default('')|quote }} > /etc/ssh/ssh_known_hosts
creates=/etc/ssh/ssh_known_hosts
diff --git a/ansible/roles/trove-setup/tasks/lorry-controller-setup.yml b/ansible/roles/trove-setup/tasks/lorry-controller-setup.yml
index fd00ea3..4486884 100644
--- a/ansible/roles/trove-setup/tasks/lorry-controller-setup.yml
+++ b/ansible/roles/trove-setup/tasks/lorry-controller-setup.yml
@@ -10,6 +10,24 @@
shell: su git -c 'mktemp -d'
register: lorry_controller_templates
+- set_fact:
+ UPSTREAM_TROVE_STANZA: {
+ type: "trove",
+ trovehost: "{{ UPSTREAM_TROVE }}",
+ protocol: "{{ UPSTREAM_TROVE_PROTOCOL }}",
+ ls-interval: "4H",
+ interval: "2H",
+ prefixmap: {
+ baserock: "baserock",
+ delta: "delta"
+ },
+ ignore: [
+ "baserock/lorries"
+ ],
+ tarball: "always"
+ }
+ when: UPSTREAM_TROVE is defined
+
- name: Create the configuration files of lorry-controller using templates
template: src=/usr/share/trove-setup/{{ item }} dest={{ lorry_controller_templates.stdout }}/{{ item }} owner=git group=git mode=0644
with_items:
diff --git a/share/lorry-controller.conf b/share/lorry-controller.conf
index ad6e49a..7a4ab81 100644
--- a/share/lorry-controller.conf
+++ b/share/lorry-controller.conf
@@ -1,25 +1,6 @@
[
- {
- "type": "trove",
- "uuid": "{{ TROVE_ID }}/initial",
- "serial": 1,
- "trovehost": "{{ UPSTREAM_TROVE }}",
- "protocol": "{{ UPSTREAM_TROVE_PROTOCOL }}",
- "ls-interval": "4H",
- "interval": "2H",
- "create": "always",
- "destroy": "never",
- "stagger": true,
- "prefixmap": {
- "baserock": "baserock",
- "delta": "delta"
- },
- "ignore": [
- "baserock/lorries"
- ],
- "tarball": "always"
- },
- {
+ {% if UPSTREAM_TROVE_STANZA is defined %}{{ UPSTREAM_TROVE_STANZA | to_nice_json |indent(4) }},
+ {% endif %}{
"type": "lorries",
"uuid": "{{ TROVE_ID }}/open-source-lorries",
"serial": 1,