On Wed, Oct 16, 2019 at 03:37:17PM -0400, Randy Barlow wrote:
On Wed, 2019-10-16 at 10:50 +0200, Adrian Reber wrote:
> {% if env == "staging" or inventory_hostname ==
> "proxy14.fedoraproject.org" %}
Rather than inlining host names like this, why not use host vars to
define a boolean variable like "enable_cool_new_rust_mirrorlist". Then
you can make that true in staging, true on proxy 14, and false
everywhere else and make this if statement simpler and more "permanent"
(i.e., you don't to touch this or the other two places with similar
adjustments later when you want to add the other proxies.
I'm guilty of doing the above in my Ansible too, but recently I've been
thinking that it would be better to use the host and group vars
instead. And honestly this is pretty similar to what a lot of our
playbook does, so I am not opposed.
Anyways, I'm +1 to the change as-is, but would prefer a change that
uses vars over this one, if you are so inclined.
Thanks for that recommendation. Can you point me to a place in ansible
where you are using this? For this FBR I would rather not change it and
go with the current solution. The goal is to completely remove the
conditionals because it either works (everything uses the new approach)
or it does not work at all (keep on using the current approach). If we
would actually go the way to slowly switch more proxies one after
another I would change the conditionals to how you described it. For now
I would rather try it the way I currently have it.
Adrian