blob: 47bfaf6b6127f7e13d1b8f5d6791eafac5e94a5e [file] [log] [blame]
---
# 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
when: opdk_region is not defined
- name: Validate that keyspaces collection is provided
fail:
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
when: replication_factor is not defined
- block:
- name: Keyspace before modification
shell: "{{ apigee_installation_home }}/apigee-cassandra/bin/cqlsh -e 'DESCRIBE KEYSPACE {{ item }}' {{ local_address }} | grep 'CREATE KEYSPACE {{ keyspace }}'"
- name: Prep keyspace for template
set_fact:
keyspace: '{{ item }}'
- 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 }}'