Once the cassandra user has lost its superuser privilege the next puppet agent run fails on executing the 'cassandra::schema' class
What behaviour did you expect instead
To be able to provide a non default super user to run the cassandra::schema or at least a way to change the default cassandra user's password
Output log
1st puppet run
Notice: /Stage[main]/Cassandra/Package[cassandra]/ensure: created
Info: /Stage[main]/Cassandra/Package[cassandra]: Scheduling refresh of Exec[cassandra_reload_systemctl]
Info: /Stage[main]/Cassandra/Package[cassandra]: Scheduling refresh of Service[cassandra]
Notice: /Stage[main]/Cassandra/Exec[cassandra_reload_systemctl]: Triggered 'refresh' from 1 event
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf]/owner: owner changed 'root' to 'cassandra'
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf]/group: group changed 'root' to 'cassandra'
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra.yaml]/content:
--- /etc/cassandra/default.conf/cassandra.yaml 2020-10-29 11:49:35.000000000 +0100
+++ /tmp/puppet-file20220208-343687-1r5v2pg 2022-02-08 15:28:39.401894745 +0100
[very long diff omitted for clarity]
Info: Computing checksum on file /etc/cassandra/default.conf/cassandra.yaml
Info: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra.yaml]: Filebucketed /etc/cassandra/default.conf/cassandra.yaml to puppet with sum 92a23b8db27d99e9b50767e5bfcbcd05
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra.yaml]/content: content changed '{md5}92a23b8db27d99e9b50767e5bfcbcd05' to '{md5}1cf09e4874815d1b687601446b4df4a1'
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra.yaml]/owner: owner changed 'root' to 'cassandra'
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra.yaml]/group: group changed 'root' to 'cassandra'
Info: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra.yaml]: Scheduling refresh of Service[cassandra]
Info: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra.yaml]: Scheduling refresh of Service[cassandra]
Info: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra.yaml]: Scheduling refresh of Service[cassandra]
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra-rackdc.properties]/content:
--- /etc/cassandra/default.conf/cassandra-rackdc.properties 2020-10-29 11:47:19.000000000 +0100
+++ /tmp/puppet-file20220208-343687-1jnef34 2022-02-08 15:28:39.470893789 +0100
@@ -16,12 +16,12 @@
# These properties are used with GossipingPropertyFileSnitch and will
# indicate the rack and dc for this node
-dc=dc1
-rack=rack1
+dc=DC1
+rack=RACK1
# Add a suffix to a datacenter name. Used by the Ec2Snitch and Ec2MultiRegionSnitch
# to append a string to the EC2 region name.
#dc_suffix=
# Uncomment the following line to make this snitch prefer the internal ip when possible, as the Ec2MultiRegionSnitch does.
-# prefer_local=true
+prefer_local=true
Info: Computing checksum on file /etc/cassandra/default.conf/cassandra-rackdc.properties
Info: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra-rackdc.properties]: Filebucketed /etc/cassandra/default.conf/cassandra-rackdc.properties to puppet with sum 560a25f2805cc316a2981a50dafd4e6b
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra-rackdc.properties]/content: content changed '{md5}560a25f2805cc316a2981a50dafd4e6b' to '{md5}e43732cbfe105322fb4cbc9077f259e1'
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra-rackdc.properties]/owner: owner changed 'root' to 'cassandra'
Notice: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra-rackdc.properties]/group: group changed 'root' to 'cassandra'
Info: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra-rackdc.properties]: Scheduling refresh of Service[cassandra]
Info: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra-rackdc.properties]: Scheduling refresh of Service[cassandra]
Info: /Stage[main]/Cassandra/File[/etc/cassandra/default.conf/cassandra-rackdc.properties]: Scheduling refresh of Service[cassandra]
Notice: /Stage[main]/Cassandra/Service[cassandra]: Triggered 'refresh' from 7 events
Notice: /Stage[main]/Cassandra::Schema/Exec[::cassandra::schema connection test]/returns: executed successfully
Notice: /Stage[main]/Cassandra::Schema/Cassandra::Schema::User[newuser]/Exec[Create user (newuser)]/returns: executed successfully
Notice: /Stage[main]/Profile::Cassandra/Exec[drop cassandra user from superuser]/returns: executed successfully
Notice: Applied catalog in 105.12 seconds
2nd puppet run
Notice: /Stage[main]/Cassandra::Schema/Cassandra::Schema::User[newuser]/Exec[Create user (newuser)]/returns: <stdin>:1:Unauthorized: Error from server: code=2100 [Unauthorized] message="User cassandra does not have sufficient privileges to perform the requested operation"
Error: '/usr/bin/cqlsh -u cassandra -p cassandra -e "CREATE ROLE IF NOT EXISTS newuser WITH PASSWORD = 'nicepassword' AND SUPERUSER = true AND LOGIN = true" 10.201.208.110 9042' returned 2 instead of one of [0]
Error: /Stage[main]/Cassandra::Schema/Cassandra::Schema::User[newuser]/Exec[Create user (newuser)]/returns: change from 'notrun' to ['0'] failed: '/usr/bin/cqlsh -u cassandra -p cassandra -e "CREATE ROLE IF NOT EXISTS newuser WITH PASSWORD = 'nicepassword' AND SUPERUSER = true AND LOGIN = true" 10.201.208.110 9042' returned 2 instead of one of [0] (corrective)
Notice: /Stage[main]/Profile::Cassandra/Exec[drop cassandra user from superuser]: Dependency Exec[Create user (newuser)] has failures: true
Warning: /Stage[main]/Profile::Cassandra/Exec[drop cassandra user from superuser]: Skipping because of failed dependencies
Notice: Applied catalog in 9.44 seconds
Any additional information you'd like to impart
Cassandra roles after the 1st run:
$ cqlsh -u newuser -p nicepassword -e 'LIST ROLES OF cassandra' localhost 9042
role | super | login | options
-----------+-------+-------+---------
cassandra | False | True | {}
(1 rows)
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
What are you seeing
Once the cassandra user has lost its superuser privilege the next puppet agent run fails on executing the 'cassandra::schema' class
What behaviour did you expect instead
To be able to provide a non default super user to run the cassandra::schema or at least a way to change the default cassandra user's password
Output log
1st puppet run
2nd puppet run
Any additional information you'd like to impart
Cassandra roles after the 1st run: