Skip to content

Commit

Permalink
add IF NOT EXISTS to role creation command
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sokołowski <[email protected]>
  • Loading branch information
jakubgs committed Oct 8, 2020
1 parent affcec6 commit 419bc20
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tasks/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@

- name: Create specified DB users
shell: |
echo "CREATE ROLE {{ item.user }} WITH SUPERUSER = true AND LOGIN = true AND PASSWORD = '{{ item.pass }}';" | \
echo "CREATE ROLE IF NOT EXISTS {{ item.user }} WITH SUPERUSER = true AND LOGIN = true AND PASSWORD = '{{ item.pass }}';" | \
/opt/cassandra/bin/cqlsh {{ cassandra_listen_address }} \
-u '{{ cassandra_db_default_user }}' \
-p '{{ cassandra_db_default_pass }}'
with_items: '{{ cassandra_db_users }}'
loop_control:
label: '{{ item.user }}'

- name: Disable default user
shell: |
Expand Down

0 comments on commit 419bc20

Please sign in to comment.