Commit Graph

17 Commits

Author SHA1 Message Date
Ian Wienand 8c6512107c
Standarise block/when ordering
Newer ansbile-lint finds "when" or "become" statements that are at the
end of blocks.  Ordering these before the block seems like a very
logical thing to do, as we read from top-to-bottom so it's good to see
if the block will execute or not.

This is a no-op, and just moves the places the newer linter found.

Change-Id: If4d1dc4343ea2575c64510e1829c3fe02d6c273f
2022-11-07 10:37:53 +11:00
Ian Wienand af3f79121a
linter: Use capitals for names
This is pretty trivial, but consistency is probably better in this
regard and it does guide you to writing a sentence that is human
parsable, which is the point of it.

Change-Id: Iaab9bb6aec0ad0f1d3cae10364c1f1b37d02801e
2022-11-07 10:37:53 +11:00
Ian Wienand f76cfbab11 linters: fix spaces between filters
This fixes a number of places where we do not have spaces between
filters.  I think that this is a reasonable rule for readability (I
also think it probably was enforced, but maybe later versions got
better at detecting it?).

These are detected by a later version of Ansible lint; this change
should have no operational change to any roles but prepares us to
update in a follow-on change.

Change-Id: I07e1a109b87adce86f483d14d7e02fcecb8313d5
2022-07-27 17:13:39 +10:00
Jeremy Stanley 763916231f validate-host: Options to require v4 and v6 routes
Make it possible for a site to demand that the validate-host role
finds IPv4 and/or IPv6 routes, making one or both explicitly
mandatory, instead of the default behavior of succeeding as long as
at least one is available. This allows a site to, for example,
discard nodes during a pre playbook if they lack IPv4 connectivity.

Change-Id: Icaa82212468a659a3756ed51cac442de33065b55
2020-11-18 16:01:39 +00:00
Zuul d7c6088d62 Merge "validate-host: skip linux nly tasks on windows machines" 2020-10-07 20:13:34 +00:00
Clark Boylan d49893f894 Partial address ansible-lint E208
- replaces ignore with a warn, which displays issue without affecting
  the linting outcome (allowing gradual fixing)
- bumps linter to enable the warn_list feature
- fixes a set of issues, others will be fixed in follow-up

Change-Id: I7d6f8c156b06f68f681943e88860930968e7c9f9
2020-09-29 10:29:01 +01:00
Albin Vass afbc17db0b validate-host: skip linux nly tasks on windows machines
Change-Id: Iab4805ffc6391423d3a622705268f88fa66a5516
2020-08-12 09:10:05 +02:00
Albin Vass 94e69147a7 Replace occurences of '/' in nodename to something more path friendly
Inventory hostnames like "abc/123" is valid in both ansible and zuul
but this role breaks since it uses it as part of a path. This sanitizes
the hostname from "abc/123" to "abc_123".

Change-Id: Ic89d595b6f004b5ca4805f1af8387e8ba56564aa
2020-03-16 11:27:10 +01:00
Paul Belanger 27c5e8d641 Don't run zuul_debug_info_enabled under python2.6
This is because it is not python2.6 compatible, where supported
versions of ansible still allow for python2.6.

Change-Id: Ie1b3a30e1d6b5206ba81558a34937071a951ce15
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2019-04-11 19:11:33 -04:00
Paul Belanger 6685c54616 Revert "validate-host: retry network tests and include unbound logs"
This reverts commit 7e00ba32da.

Change-Id: I2c1aa1e834d408de14ad4818ff5c9b58145f44b0
2018-11-19 21:43:40 +00:00
Ian Wienand 7e00ba32da validate-host: retry network tests and include unbound logs
Split the network testing component of the validate-host rule into a
separate task, so it can be retried a couple of times in case
something is a bit slow about bringing up external networking.  Add
failure collection of unbound logs if they appear to be in some common
locations (such as will be there on infra nodes).

Change-Id: Id12f1ba064fa2e5f75b9a5cfba76d238d23d3f57
2018-11-06 14:33:06 +11:00
Clark Boylan bbc50852b6 Stop logging inventory in validate-host
We remove the privileged inventory file copy from validate-host so that
validate-host can be tested more easily. Users should use log-inventory
in their base jobs to get this functionality.

Depends-On: https://review.openstack.org/563789
Change-Id: I8cd1748395abfe868f1716a9b4394850f962d436
2018-04-23 16:02:03 -07:00
Monty Taylor f3e89a488c
Make validate-host read from site-variables
Change the default parameters to the role to be zuul site variables.
Because of variable precedence, having these not be site variables means
someone could override them in a job. Since one of the actions is to
read and log the contents of a file, we likely don't want to give people
the ability to do that with an arbitrary file.

The traceroute host isn't as important to be a site variable, but it's
still not actually something that jobs should override - it's a feature
of the deployment.

Both variables work if they are not set, so deployers should still be
able to use this role without defining site-variables. But it should be
made clear to them that if they want those features they really should
define the locations in a site-variable and not in a normal job
variable.

configure-mirror similarly allows in-job override, but maybe that's ok
for now and leaving the site-variable value as a default is fine?

Finally, add a new zuul_site_image_manifest_files list, so that we can
specify more than one file to read. Set the defaults of it to be the
files that the dib nodepool elements emit. We'll also look in to pushing
those manifest files up a level into dib so that expecting nodepool
nodes to have them is even more reasonable.

Change-Id: I632a32fdfac4bfe57eb269ac8e183fb8df34d48f
2017-09-07 11:18:36 -05:00
Monty Taylor 0bb86fb256
Copy inventory as part of validate host
We are collcting information about the running zuul system in
validate-host. Move the inventory collection here with the rest of
it. Also, put it in zuul-info. It's debugging info about the ansible
layer.

Change-Id: I5dded8f3545e725cbc11c1eae194857fe9623ab1
2017-08-18 19:28:41 -05:00
Paul Belanger 829297c37a
Ensure we load roles for linting
Did didn't have ansible-lint setup properly, as a results our roles
weren't actually linted properly.

Fix variable linting issues and ignore ANSIBLE0012.

Change-Id: I07aa940245e700c9f08df0f1920720f0ed9d3de0
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2017-07-17 16:50:06 -04:00
Monty Taylor c00eca3f15
Switch to using setup instead of hostvars
hostvars can potentially leak secrets. setup doesn't, and records what
we're interested in, which is the information ansible knows about the
remote host.

Change-Id: Ice585cb3beddf4e3ecc1e692ecf4e7da8c5754b8
2017-07-13 17:08:41 -05:00
Monty Taylor 7f64bddb1d
Rename debug-ansible to validate-host
It's doing more than just outputting ansible information.

Change-Id: Icfbef10b1bcf36d75f961cd4319bc062a77efe2a
2017-07-09 11:26:50 -05:00