-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ha_cluster_node_options allows per-node addresses and SBD options to be set #196
feat: ha_cluster_node_options allows per-node addresses and SBD options to be set #196
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #196 +/- ##
=======================================
Coverage 50.54% 50.54%
=======================================
Files 1 1
Lines 91 91
Branches 12 12
=======================================
Hits 46 46
Misses 45 45
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
358c212
to
4adf14e
Compare
[citest] |
I'm not sure I understand the motivation for "moving" variables from inventory to playbooks. The general idea with Ansible is to separate the "code" from the "data", the "code" being the roles and the playbooks which are generally static, and the "data" being the inventory and other sources of variables outside of the "code", which are generally dynamic. |
4adf14e
to
980f7c3
Compare
[citest] |
README.md
Outdated
@@ -1484,10 +1532,70 @@ in /var/lib/pcsd with the file name FILENAME.crt and FILENAME.key, respectively. | |||
|
|||
### Configuring cluster to use SBD | |||
|
|||
#### inventory | |||
#### Using playbook variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to document where to define variables (inventory, playbook), only how to define them.
https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#adding-variables-to-inventory
Typically, this is done in the inventory, by defining groups of hosts and variables for those groups, or defining host specific variables. Of course, for our test framework, we cannot provide an inventory for the tests/tests_*.yml
files, but we should document best practices.
All we need to do in the README is to describe which parameters, but if you feel we should provide HA cluster users with more Ansible guidance, then we can do something like
"
If you need to define ha_cluster role variables on a per host or group of host basis in your inventory, see https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#adding-variables-to-inventory. If you want to know how Ansible variable precedence works with respect to inventory and playbooks, see https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html#variables
"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the readme and removed mentions of which variable should be defined where.
The title "move variables from inventory to playbook" is actually a kind of a shortcut. Let me elaborate on what is actually being done. To configure a cluster using the role, the user runs the role with a bunch of variables. They are prefixed with the name of the role, so there is Soon after that, I run into a case when I needed specific variables to have different values for each node. These are node addresses and SBD settings. So I created an Later, I found out that it doesn't actually matter where a variable is defined. But the naming kind of stuck to differentiate between The point of this PR is to make the role read options, which were previously configurable only by all:
hosts:
node1:
ha_cluster:
pcs_address: node1-address
corosync_addresses:
- 192.168.1.11
- 192.168.2.11
node2:
ha_cluster:
pcs_address: node2-address:2224
corosync_addresses:
- 192.168.1.12
- 192.168.2.12 one can write this: ha_cluster_node_options:
- node_name: node1
pcs_address: node1-address
corosync_addresses:
- 192.168.1.11
- 192.168.2.11
- node_name: node2
pcs_address: node2-address:2224
corosync_addresses:
- 192.168.1.12
- 192.168.2.12 This allows to define all cluster settings using a single approach. It will also allow the role to export all cluster settings in a single structure. |
I see - thanks for the explanation. |
The PR title - I think it should be something like "feat: ha_cluster_node_options allows per-node options to be set" ? Something more descriptive to what is actually being done |
Enhancement:
Allow users to specify node addresses and SBD options in a playbook. Previously, these were only read from an inventory.
Reason:
All cluster configuration is localized to a single place - a playbook. On top of being easier to use, this will also allow us to export cluster configuration in form of a playbook.
Result:
ha_cluster_node_options
variable contains settings for node addresses and SBD options. Variables from inventory are still processed for backward compatibility.Issue Tracker Tickets (Jira or BZ if any):