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
Adjust which playbook is run depending on which group was changed #5
Conversation
This hasn't had much testing :( |
I don't understand. What is the difference between the two playbooks? Also, will this fail on some of the message types? Do any of them have an odd |
|
groups = [ | ||
msg['msg']['group'] | ||
for msg in messages | ||
if 'sysadmin-' in msg['msg'].get('group', None) |
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.
Perhaps just 'sysadmin'
instead of 'sysadmin-'
?
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 was wondering if there are groups having sysadmin
in their name but not related to us (I'm thinking a foosysadmingit
or so.
So this has us doing simple by default. But the more complete one when the change is with respect to a group. This deserves an inline comment to explain. Why is it more complex when there's a group involved? What kind of change happened that deserves only a simple run when there is no group involved. Is it that the simple runs take place only when a public SSH key changes? What about if a sysadmin with shell access changes their SSH key? That info won't get propagated to all the nodes. |
So fas.user.update is the only one giving us problem :-/ |
Looking into the data for my previous reply I was thinking about this and maybe we should look into the message for Thoughts? |
It's not about having groups involved, it's about which groups are involved :) |
for msg in messages: | ||
# If one of the groups includes a sysadmin-related group, run the | ||
# complete playbook | ||
if 'sysadmin-' in msg['msg'].get('group', None) \ |
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.
Maybe leave the '-'
off the end of 'sysadmin-'
so we can catch the "sysadmin" group itself?
- Let's be more generous about which group we find - Don't forget that None is not iterable so use an empty string instead
Nice! 👍 |
Adjust which playbook is run depending on which group was changed
No description provided.