Open mootezbessifi opened 6 years ago
Regarding the example: I could only guess that the version of ansible you are using doesn't work with blocks in the same way.
As for the exception: it looks like lib is hard coding the protocol version for connecting to the cluster. i would recommend changing the protocol version to see if that fixes it: https://github.com/Ensighten/ansible-module-cassandra/blob/master/library/cassandra_grant.py#L252
thanks for your quick response @sadams . According to the ansible version i am working with is 2.3.1.0. and i have some other code working fine with block module.
According to the exception, which protocol version i need to use to run this successfully?
I don't know. Which version of C* are you using and what is the header on your cqlsh client repl when you successfully login? I would start there. The simplest change you could probably make would be to change https://github.com/Ensighten/ansible-module-cassandra/blob/master/library/cassandra_grant.py#L252 to accept the protocol version as a parameter (like login_host etc) but default it to '2'. Then you could just change them to see if it worked with 3+.
yes @sadams indeed, i changed the hard coded protocol version to 3 and it works fone for me, now i would like to run the task for only on host from the ansible group 'cassandra' (cassandra inventory group contains list of cassandra cluster nodes). when added the below code under cassandra_role module , it does not work:
it skips it and run the task in all cassandra hosts
did cassandra_role module missing some inheritance maybe ?
The module isn't that clever. delegate_to
isn't passed to the modules. the module simply runs the cql commands on whichever machine it's pointed at. If you point the task at all the nodes in your cluster, it will run on each node. best idea is to run the cql against only 1 of your nodes and let cassandra propagate the change:
- hosts: cassandra[0]
Hi all,
first of all, thank you a lot for suck ansible module. i need to mention that you example is not working, when i tried to run it, an exception occurs with the following output:
ERROR! 'login_hosts' is not a valid attribute for a Block
The error appears to have been in '/home/centos/fcs-automation/roles/cassandra/tasks/user-mgt.yml': line 3, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- block:
^ here
So i read the library content and i tried to run it like following:
name: add users (as roles) cassandra_role: state: present name: a_user superuser: False enable_login: True password: a_user_password login_hosts: 192.168.0.3 login_user: cassandra login_password: cassandra
(sorry for mis-formatting the task) when i run the above, i got the following error:
fatal: [cass1 -> None]: FAILED! => {"changed": false, "failed": true, "msg": "unable to connect to ****, check login_user and login_password are correct. Exception message: ('Unable to connect to any servers', {'192.168.0.3': DriverException('ProtocolError returned from server while using explicitly set client protocol_version 2',)})"}
Any help on this ??
PS: cassandra username and password are working fine using direct cqlsh.