Commit Graph

13 Commits

Author SHA1 Message Date
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
James E. Blair 9e22cfdb0f Remove shebang from all python ansible modules
This commit in Ansible:
9142be2f6c

now allows Python modules to specify their interpreter with the shebang.
We expect our roles to use the discovered python interpreter on remote
nodes, and on the executor, we need them to use the virtualenv.  Removing
the specific shebang accomplishes this under Ansible 6, and has no effect
under older versions of Ansible.

Without this, for example, the log upload roles would not have access to
their cloud libraries.

Also update our ansible/cli check in our module files.  Many of our modules
can be run from the command line for ease of testing, but the check that we
perform to determine if the module is being invoked from the command line
or Ansible fails on Ansible 5.  Update it to a check that should work in
all 4 versions of Ansible that Zuul uses.

Change-Id: I4e6e85156459cca032e6c3e1d8a9284be919ccca
2022-09-15 13:48:10 -07:00
Clark Boylan fa1331e4a7 Remove redundant ssh known hosts prep
This removes redundant ssh known hosts prep in the
multi-node-known-hosts role as we've seen these tasks take significant
amounts of time due to the high cost of ansible looping. According to
the change [0] that added the system wide known_hosts setting this was
not originally done to avoid breaking testing in openstack-zuul-jobs.
Since then those tests have been moved to zuul-jobs [1] and I've updated
them with this change.

This should cut the time to run this role by about half.

[0] https://review.opendev.org/c/zuul/zuul-jobs/+/548642
[1] https://review.opendev.org/c/zuul/zuul-jobs/+/668767

Change-Id: I90492bbb5ae15fd3b36a54071c4eef891f53b405
2022-09-12 12:55:24 -07:00
Albin Vass 9062289151 Check for loop_control in with_ type loops
Change-Id: I191265df7709a6262b44a428d78fe28ffaeb4b75
2020-05-01 13:45:34 +02:00
Andreas Jaeger f0cff4d4e9 Add missing README.rst for roles
Newer zuul-sphinx check that a README.rst exists for each role, add
missing ones.

Change-Id: I8e884934a45219977f4389c9ff040e31aec63f18
2018-09-05 19:35:53 +00:00
Ian Wienand eee316ce7b Enable Python 2.7 unit tests
Add a testenv:py27 environment that overrides basepython to 2.7

Unfortunately implicit namespace packages are a Python3 thing [1] so
we have to scatter a few __init__.py's around for the test loader
under python2 to be able to find the unit test directories.

Update documenation to mention this

Needed-By: https://review.openstack.org/592768

[1] https://www.python.org/dev/peps/pep-0420/

Change-Id: I9a653666e8a083fb7f3fbb92589fe0467a41e6e6
2018-08-17 10:23:20 +10:00
Zuul 3535aa0e43 Merge "Add a python unit test framework" 2018-07-25 20:45:03 +00:00
James E. Blair 1548d82ffd Add a python unit test framework
Add a unit testing framework for python roles.  Thanks to Matthew
Treinish for the suggestion of how to perform discovery (and much of the
code which is copied from Tempest).

Change-Id: Iec95dd1026a41614def57c65c3faa0516a682a5a
2018-07-25 09:11:25 -07:00
Monty Taylor 054812719f
Scope all_known_hosts in mult-node-known-hosts
Ansible is moving towards ansible_facts return values going in to
ansible_facts rather than the top-level dict. ansible_facts exists
starting in ansible 2.5, so go ahead and start consuming the value that
way.

Change-Id: Iac13b1efb47c9d79ed088e1cf9176003790c74f7
2018-07-23 13:21:39 -05:00
Andrea Frittoli 870298bf54 Add known hosts for all users
The role today only adds known hosts for the zuul user.
This replicates what d-g does today by adding a default known_hosts
file which applies to all users.

We csnnot remove the original task that adds for the zuul user since
there's a unit test in openstack-zuul-jons that expects that.

Depends-on: https://review.openstack.org/550425/

Change-Id: I54d4d975fa54cbb6df7dbed525211ab5c2cd6754
2018-03-07 11:03:24 +00:00
David Moreau-Simard e748a8a56b
Multi-node: Streamline multi-node-known-hosts
We're now evaluating the condition whether or not to run this role
at the playbook level instead since there are different roles using
this same condition.

Change-Id: I99738c7e98133838f989ed369a09ecb6a7b64054
2017-09-26 15:32:07 -04:00
Monty Taylor 5cdacdfbf4
Handle floating ips in multi-node-known-hosts
Nodes (and ansible) don't know about floating ips because they are
external. However, they are valid interfaces over which nodes might talk
to each other- especially if we're re-using the inventory generated for
the jobs.

Start off by grabbing all of the addresses from nodepool, if they exist.
Then do the loop for finding the addresses we want. Then collapse
that list with set and do a pass to create the actual list of hosts and
keys needed.

Change-Id: I748fae1c86d7bb9333dc251991308282858811a4
2017-09-06 16:33:28 -05:00
Clint Byrum cc2ed9fa5f Add known_hosts generation for multiple nodes
Things will need to be done a bit differently for localhost-ssh, so this
is just for the case of multiple nodes needing to be able to SSH to
eachother.

Change-Id: I941cf3de7691ee1b5277ca50c7bb9daa5b9a0732
2017-08-22 13:56:16 -07:00