PyratLabs / ansible-role-k3s

Ansible role for installing k3s as either a standalone server or HA cluster.
BSD 3-Clause "New" or "Revised" License
628 stars 135 forks source link

Case insensitive control node lookup #126

Closed mrobinsn closed 3 years ago

mrobinsn commented 3 years ago

Fix: case insensitive control node lookup

Summary

Apologies for the lack of info, using this role is my first foray into the world of Ansible.

This PR fixes an issue I was running into where my /tmp/inventory.txt file didn't contain C_True, but it did contain C_true. Didn't seem to me like the casing matters so I threw a -i on the grep command and everything started working.

 $ ssh <a node> -- sudo cat /tmp/inventory.txt  
# BEGIN ANSIBLE MANAGED BLOCK
<node1> @@@ <node1>  @@@ C_False @@@ P_False @@@ END:<node1> 
<node2> @@@ <node2> @@@ C_False @@@ P_False @@@ END:<node2>
<node3> @@@ <node3> @@@ C_False @@@ P_False @@@ END:<node3>
<node4 (primary)> @@@ <node4 (primary)> @@@ C_true @@@ P_False @@@ END:<node4 (primary)>
# END ANSIBLE MANAGED BLOCK

I am setting k3s_control_node=true on my primary node in the inventory.

Issue type

xanmanning commented 3 years ago

Not sure why it was writing it differently, however I can see this makes it a bit more robust. Thanks :+1: