]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
lv-create: use copy instead of the template module
authorAndrew Schoen <aschoen@redhat.com>
Thu, 9 Aug 2018 13:09:41 +0000 (08:09 -0500)
committerSébastien Han <seb@redhat.com>
Thu, 16 Aug 2018 14:38:23 +0000 (16:38 +0200)
The copy module does in fact do variable interpolation so we do not need
to use the template module or keep a template in the source.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
infrastructure-playbooks/lv-create.yml
infrastructure-playbooks/templates/lv-create-log.j2 [deleted file]
tox.ini

index 485cae239bd131641f10e194b0e5712784c0781c..b1c87d5258c7e51979dadad2dabd2ae08c9e69e9 100644 (file)
@@ -3,6 +3,23 @@
   hosts:
   - osds
 
+  vars:
+    logfile: |
+      Suggested cut and paste under "lvm_volumes:" in "group_vars/osds.yml" for configuring with osd_scenario=lvm
+      -----------------------------------------------------------------------------------------------------------
+      {% for lv in nvme_device_lvs %}
+        - data: {{ lv.lv_name }}
+          data_vg: {{ nvme_vg_name }}
+          journal: {{ lv.journal_name }}
+          journal_vg: {{ nvme_vg_name }}
+      {% endfor %}
+      {% for hdd in hdd_devices %}
+        - data: {{ hdd_lv_prefix }}-{{ hdd.split('/')[-1] }}
+          data_vg: {{ hdd_vg_prefix }}-{{ hdd.split('/')[-1] }}
+          journal: {{ hdd_journal_prefix }}-{{ hdd.split('/')[-1] }}
+          journal_vg: {{ nvme_vg_name }}
+      {% endfor %}
+
   tasks:
 
   - name: include vars of lv_vars.yaml
@@ -73,7 +90,7 @@
 
   - name: "write output for osds.yml to {{ logfile_path }}"
     become: false
-    template:
-      src: "templates/lv-create-log.j2"
+    copy:
+      content: "{{ logfile }}"
       dest: "{{ logfile_path }}"
     delegate_to: localhost
diff --git a/infrastructure-playbooks/templates/lv-create-log.j2 b/infrastructure-playbooks/templates/lv-create-log.j2
deleted file mode 100644 (file)
index 8b0d78f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Suggested cut and paste under "lvm_volumes:" in "group_vars/osds.yml" for configuring with osd_scenario=lvm
------------------------------------------------------------------------------------------------------------
-{% for lv in nvme_device_lvs %}
-- data: {{ lv.lv_name }}
-  data_vg: {{ nvme_vg_name }}
-  journal: {{ lv.journal_name }}
-  journal_vg: {{ nvme_vg_name }}
-{% endfor %}
-{% for hdd in hdd_devices %}
-- data: {{ hdd_lv_prefix }}-{{ hdd.split('/')[-1] }}
-  data_vg: {{ hdd_vg_prefix }}-{{ hdd.split('/')[-1] }}
-  journal: {{ hdd_journal_prefix }}-{{ hdd.split('/')[-1] }}
-  journal_vg: {{ nvme_vg_name }}
-{% endfor %}
diff --git a/tox.ini b/tox.ini
index ede234e57a7043fcb1171c657e2eef91f410659d..9764cf1c9866902b6de80075125452d86a1465f4 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -29,11 +29,8 @@ commands=
   bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}
 
   cp {toxinidir}/infrastructure-playbooks/lv-create.yml {toxinidir}/lv-create.yml
-  mkdir -p {toxinidir}/templates
-  cp {toxinidir}/infrastructure-playbooks/templates/lv-create-log.j2 {toxinidir}/templates/lv-create-log.j2
   ansible-playbook -vv -i {changedir}/hosts {toxinidir}/lv-create.yml
 
-
   cp {toxinidir}/infrastructure-playbooks/lv-teardown.yml {toxinidir}/lv-teardown.yml
   ansible-playbook -vv -i {changedir}/hosts {toxinidir}/lv-teardown.yml --extra-vars "ireallymeanit=yes"