updated to manage keypace collections
diff --git a/tasks/main.yml b/tasks/main.yml
index 50c0e0e..47bfaf6 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -2,29 +2,37 @@
# tasks file for apigee-opdk-cassandra-change-replication-factor
- name: Validate that opdk_region is provided
fail:
- msg: Please indicate the opdk_region to use from those available in the profiles folder
+ msg: Please indicate the opdk_region to use
when: opdk_region is not defined
-- name: Validate that keyspace is provided
+- name: Validate that keyspaces collection is provided
fail:
- msg: Please indicate the keyspace to use from those available in the profiles folder
- when: keyspace is not defined
+ msg: Please indicate the keyspaces to use
+ when: keyspaces is not defined
- name: Validate that replication_factor is provided
fail:
- msg: Please indicate the replication_factor to use from those available in the profiles folder
+ msg: Please indicate the replication_factor to use
when: replication_factor is not defined
-- name: Construct CQL file
- template:
- src: alter_replication_factor.cql.j2
- dest: /tmp/alter_replication_factor.cql
+- block:
-- name: Keyspace before modification
- shell: "{{ apigee_installation_home }}/apigee-cassandra/bin/cqlsh -e 'DESCRIBE KEYSPACE {{ keyspace }}' {{ local_address }} | grep 'CREATE KEYSPACE {{ keyspace }}'"
+ - name: Keyspace before modification
+ shell: "{{ apigee_installation_home }}/apigee-cassandra/bin/cqlsh -e 'DESCRIBE KEYSPACE {{ item }}' {{ local_address }} | grep 'CREATE KEYSPACE {{ keyspace }}'"
-- name: Execute CQL statements
- shell: "{{ apigee_installation_home }}/apigee-cassandra/bin/cqlsh -f /tmp/alter_replication_factor.cql {{ local_address }} "
+ - name: Prep keyspace for template
+ set_fact:
+ keyspace: '{{ item }}'
-- name: Keyspace after modification
- shell: "{{ apigee_installation_home }}/apigee-cassandra/bin/cqlsh -e 'DESCRIBE KEYSPACE {{ keyspace }}' {{ local_address }} | grep 'CREATE KEYSPACE {{ keyspace }}'"
+ - name: Construct CQL file
+ template:
+ src: alter_replication_factor.cql.j2
+ dest: /tmp/alter_replication_factor.cql
+
+ - name: Execute CQL statements
+ shell: "{{ apigee_installation_home }}/apigee-cassandra/bin/cqlsh -f /tmp/alter_replication_factor.cql {{ local_address }} "
+
+ - name: Keyspace after modification
+ shell: "{{ apigee_installation_home }}/apigee-cassandra/bin/cqlsh -e 'DESCRIBE KEYSPACE {{ item }}' {{ local_address }} | grep 'CREATE KEYSPACE {{ keyspace }}'"
+
+ with_items: '{{ keyspaces }}'
\ No newline at end of file