cassandra_cqlsh -- Run cql commands via the clqsh shell.

Synopsis

Run cql commands via the clqsh shell.

Run commands inline or using a cql file.

Attempts to parse returned data into a format that Ansible can use.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

cqlsh_host (optional, str, localhost)
Host to connect to
cqlsh_port (optional, int, 9042)
Port to connect to.
username (optional, str, None)
The C* user to authenticate with.
password (optional, str, None)
The C* users password.
keyspace (optional, str, None)
Authenticate to the given keyspace.
file (optional, str, None)
Path to a file containing cql commands.
execute (optional, str, None)
cqlsh command to execute.
encoding (optional, str, utf-8)
Specify a non-default encoding for output.
cqlshrc (optional, str, None)
Specify an alternative cqlshrc file location.
cqlversion (optional, str, None)
Specify a particular CQL version.
protocol_version (optional, str, None)
Specify a specific protcol version.
connect_timeout (optional, int, 5)
Specify the connection timeout in seconds.
request_timeout (optional, int, 10)
Specify the default request timeout in seconds.
tty (optional, bool, False)
Force tty mode.
debug (optional, bool, False)
show additional debug info.
ssl (optional, bool, False)
Use SSL.
no_compact (optional, bool, False)
No Compact.
cqlsh_cmd (optional, str, cqlsh)
cqlsh executable.
transform (optional, str, auto)

Transform the output returned to the user.

auto - Attempt to automatically decide the best tranformation.

split - Split output on a character.

json - parse as json.

raw - Return the raw output.

split_char (optional, str, )
Used by the split action in the transform stage.
additional_args (optional, raw, None)

Additional arguments to supply to the mongo command.

Supply as key-value pairs.

If the parameter is a valueless flag supply a bool value.

Examples

- name: Run the DESC KEYSPACES cql command
  community.cassandra.cassandra_cqlsh:
    execute: "DESC KEYSPACES"

- name: Run a file containing cql commands
  community.cassandra.cassandra_cqlsh:
    file: "/path/to/cql/file.sql"

- name: Run a cql query returning json data
  community.cassandra.cassandra_cqlsh:
    execute: "SELECT json * FROM my_keyspace.my_table WHERE partition = 'key' LIMIT 10"

- name: Use a different python
  community.cassandra.cassandra_cqlsh:
    execute: "SELECT json * FROM my_keyspace.my_table WHERE partition = 'key' LIMIT 10"
    additional_args:
      python: /usr/bin/python2

Return Values

file (When a cql file is used., str, )
CQL file that was executed successfully.
msg (always, str, )
A message indicating what has happened.
transformed_output (on success, list, )
Output from the cqlsh command. We attempt to parse this into a list or json where possible.
changed (always, bool, )
Change status.
failed (on failure, bool, )
Something went wrong.
out (when debug is set to true, str, )
Raw stdout from cqlsh.
err (when debug is set to true, str, )
Raw stderr from cqlsh.
rc (when debug is set to true, int, )
Return code from cqlsh.

Status

Authors

  • Rhys Campbell (@rhysmeister)