Commit Graph

41 Commits

Author SHA1 Message Date
David Moreau Simard 8acd54b687
Remove Zuul configuration for ara-plugins
Depends-On: https://review.openstack.org/640818
Change-Id: I17697f5dc77ceaa06c6a9ee30a4e152da0d66152
2019-03-04 12:02:25 -05:00
David Moreau Simard 11553e102d
Update README to explain ara-plugins was migrated back into ara
The ara-clients standalone repository is being discontinued.
The clear and logical separation of components was nice but the overhead
in complexity was not worth it.

Change-Id: Ie548db190c5cb1e3634ff056727f0ee81986ce1e
2019-03-02 08:46:46 -05:00
David Moreau Simard 7cf37ea15f
Add new integration jobs to ara-plugins
There are new jobs defined in ara-infra for testing ara-plugins with
the other ARA components. Add them to the check and gate pipelines.

Depends-On: https://review.openstack.org/#/c/630303
Change-Id: I1582084a73b5d1afb75cc07c718de643934678f8
2019-01-23 09:48:55 -05:00
David Moreau Simard e55e217a80
Fix typo when ara_record retrieves options from the callback
Caught by the upcoming integration tests. It wouldn't had merged
if the tests had been ready.

Change-Id: Ic0aff764f9f9f2a1ba6235fc2302e8e155e59753
2019-01-22 17:34:28 -05:00
Zuul f7fa02c915 Merge "Use get_client from ara.clients.utils to get an API client" 2019-01-21 15:59:26 +00:00
David Moreau Simard 49c52ffa92
Retrieve CLI options with ansible.context in Ansible 2.8
Ansible 2.8 will release with a new way of recovering CLI options.
We need to keep handling the previous method as long as all releases
that don't contain ansible.context have not been retired.

Change-Id: I47dbe579c78bc9e46db8d9f92c2eed92e490da9d
2019-01-21 09:51:37 -05:00
David Moreau Simard 19140f878a
Use get_client from ara.clients.utils to get an API client
This simplifies the code in ara plugins and leaves the logic of client
selection to ara.clients.

Change-Id: I707efa35507ae9f292d21816c0606ee541df9f6c
Depends-On: https://review.openstack.org/#/c/631828/
2019-01-18 11:52:28 -05:00
David Moreau Simard 49ce188ab8
Implement support for setting host aliases
Hosts in Ansible are unique per playbook because there is no concept
of persistence between different playbook runs. A host could be named
"webserver" and be a completely different host in two playbook runs.

In order to make it possible to track a given host across different
playbook runs, it is now possible to set a host alias.
Host aliases are explicitely provided by the user as the "ara_host_alias"
hostvar which defaults to the inventory hostname if it is not set.

Change-Id: Iaa3b0ce57968b9e4977d25a559e21e67a37b1d62
2019-01-10 15:35:55 -05:00
David Moreau Simard b129ad91c7
Implement support for naming playbooks
This allows users to give arbitrary names to their playbooks based
on the "ara_playbook_name" Ansible variable that can be supplied either
as a literal Ansible variable or as an extra_var.

Change-Id: I8bbe644003a1a277a9639167effdee1146907c6f
2019-01-10 15:35:41 -05:00
David Moreau Simard c7933f3425
Fix RST codeblock syntax in README
Change-Id: I3a2d669f9429cca37fea8192aeae3dff1603b852
2018-12-21 10:55:52 -05:00
David Moreau Simard 014d65a5fa
Tweak how files and hosts are created to ensure idempotency
Files and hosts can be created from different places and as such,
we need to double check if they have not already been created
whenever we might want to create them.

It should not be possible to have the same file or the same host
more than once in a given playbook due to unique constraints.

Change-Id: I6023949f4ad026086ba690789ddeebf5bb1d0a0d
Depends-On: https://review.openstack.org/#/c/625948/
Depends-On: https://review.openstack.org/#/c/625961/
2018-12-20 17:54:32 -05:00
David Moreau Simard 188eba9b0d
Improve README to include docs for enabling ara-plugins
We'll iterate on the documentation but this is a good start.

Change-Id: Iaabc620d513d3f6494bdb9ad5f4d3b6eefda0907
2018-12-20 17:52:02 -05:00
David Moreau Simard 04936f2fe0
Add helper command to determine plugins location
This is the equivalent of the 0.x "python -m ara.setup.callback_plugins"
and "python -m ara.setup.action_plugins".
This allows users to run "python -m ara.plugins" in order to determine
the location of the plugins.

Change-Id: I8fddf3507916ae58c83af5e8400e7f7af83ba98c
2018-12-20 17:50:53 -05:00
David Moreau Simard 9e61bfbb51
Remove leftover .gitkeep file
We've ported ara_record and the directory is no longer empty.

Change-Id: I125e6b7f6edb92abc569833715326dee35febf7a
2018-12-14 11:30:48 -05:00
melissaml d3cd36fce4 Change openstack-dev to openstack-discuss
Mailinglists have been updated. Openstack-discuss replaces openstack-dev.

Change-Id: I09e913681754533b53c34dbf2b43e321ede97bbd
2018-12-07 20:33:35 +08:00
David Moreau Simard 35e4778bff
Port ara_record to use the ARA 1.0 API
This port uses the (outdated) flask 1.0 as a base [1] since it had
already been switched to use the flask API and required less changes.
It otherwise doesn't change how the module itself works or the use
case for it.

The only tricky part in this implementation revolves around letting
the action plugin recover the playbook id for the playbook the plugin
is running from.
One one end, the callback saves the play uuid [2][3].
The play uuid is available to the action plugin by recursing through
its task inheritance to find the parent play's uuid.
Once the plugin has the play uuid, it is able to search for it and
recover the parent playbook's id.

[1]: 0d915282e6/ara/plugins/actions/ara_record.py
[2]: https://review.openstack.org/#/c/609076/
[3]: https://review.openstack.org/#/c/609078/

Change-Id: I396ff26a53caedef7dfbd7dafa7eba9a515ea7a3
Depends-On: https://review.openstack.org/#/c/618228/
2018-11-17 16:19:10 -05:00
David Moreau Simard d94cd419a2
Use task.status instead of task.completed
Change-Id: I8c02f10b5178a3690da37af84bf36f839aa0bb95
Depends-On: https://review.openstack.org/618016
2018-11-14 16:11:39 -05:00
David Moreau Simard b9540a99e6
Use play.status instead of play.completed
Change-Id: Ieb43efe90673c1e3047ebfc112a54a599d6e4c77
Depends-On: https://review.openstack.org/618015
2018-11-14 16:11:37 -05:00
David Moreau Simard b65e0883db
Set the playbook status and infer the resulting status
This is the client-side implementation of playbook.status.
The logic is simple -- if there's a failure or an unreachable task,
the playbook is a failure.
It is created as 'running' by the playbook and transitions to
'completed' or 'failed' depending on the statistics at the end.

Change-Id: Ife3f4fe75a1eb2a627a52d289867b854c075ecd6
2018-10-15 21:48:59 -04:00
Florian Apolloner 7faafc61dc
Pass playbook along during result creation.
Change-Id: If14242bc34d62d9b5797dd99e6fad2fa3512ff55
2018-10-15 16:36:57 -04:00
David Moreau Simard 25fd771512
Retrofit ignored/filtered parameters to 1.0 callback
It's possible in ARA 0.x for users to specify playbook parameters
that won't be saved by ARA.
Add this to the 1.0 callback and rename them to arguments instead
of parameters.

Depends-On: https://review.openstack.org/610389
Change-Id: I517dd6f90eaee15f0d762242750c10a5fc9fc955
2018-10-14 12:45:02 -04:00
David Moreau Simard a2ce0758e4
Retrofit ignored/filtered facts to 1.0 callback
ARA 0.16.0 introduced fact filtering to prevent saving certain facts.
Backport it to 1.0.

Change-Id: I709c64cae3a5cf62820b011c6e39c7150bf3ad49
2018-10-14 12:07:00 -04:00
Zuul 7d624a63eb Merge "Save the play uuid provided by Ansible when recording the play" 2018-10-11 14:08:03 +00:00
David Moreau Simard 1ea26c9a59
Save the play uuid provided by Ansible when recording the play
This will allow clients and plugins running within Ansible to identify
which play they are in and which playbook they are in.

Change-Id: I734999473423992d69555bb84bf601acf62d1eb8
Depends-On: https://review.openstack.org/#/c/609076/
2018-10-09 14:12:13 -04:00
David Moreau Simard a510210c90 Update README.rst to be more accurate
Change-Id: I1e93c0fe887ab53ea0eb8a49f8a0ca7470cc3d38
2018-10-04 15:25:19 +00:00
David Moreau Simard f3e4d101e2
Add zuul job to run tox-format environment for executing black and isort
This will allow us to have more consistent and clean code.

Change-Id: I782c92c5d87cd55c007b919fb2680fdfd61c3b0c
2018-10-02 15:55:05 -05:00
David Moreau Simard 013324348c
Run black/isort on ara-plugins
There will be a follow up patch to add black/isort CI.

Change-Id: If3834babdb62ec12235676756ae82f81cd6cae28
2018-10-02 15:52:58 -05:00
David Moreau Simard b9792cfe57
Implement self-configuration of the callback through Ansible
- Import the right ARA API client
- Set the API server URL
- Set the API http timeout

Change-Id: I72f2a382d83c0a18fce7ac9d1cece39d83cb4734
2018-10-02 09:59:07 -05:00
Florian Apolloner 0c21396411 Fixed namespacing to use python3 style namespace packages.
Note: the egg name is not allowed to have a dash, because that is
interpreted as version by at least pbr.
See https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support

Change-Id: I957c5114150b430612cff0280df66ef769c8f71b
2018-09-27 19:18:33 +02:00
David Moreau Simard e3b94a440d
Record stats and adjust to latest database model for hosts
- Hosts are now tied to the playbook, not the play

Change-Id: Ibf8deb75732cb676436b78dddc497abf775756cf
2018-09-05 10:05:14 -04:00
David Moreau Simard 8999b4feab Drop trailing slash from the API endpoints
Change-Id: Ifab7e0bb068a5067fba1138c150cc398515f341b
2018-06-25 14:45:57 +00:00
David Moreau Simard 98d302ec8f
Add result and host facts logging to the default callback
This is the first iteration that allows us to save results
and host facts using the API in the callback.

Change-Id: I9d6450c7721887e7893dc966055a89787d9bd228
2018-06-25 10:45:39 -04:00
David Moreau Simard 8908f9df48
Load hosts during v2_playbook_on_play_start
This implements adding hosts through the callback with the API.

TODO: Make sure hosts are added when recording results. That
ensures we take into account tasks such as add_host.

Change-Id: I2f750319a2cddbceab166d323c4bf11aee4c7bb4
2018-06-21 17:55:36 -04:00
David Moreau Simard 2c19b1fb50
Fix import of the offline client
The offline client class is called AraOfflineClient, not
OfflineClient.

Change-Id: I408d163838de1934ce3920ed8dd13c919d0def64
2018-06-20 10:16:18 -04:00
David Moreau Simard ff8f450117
Rename ARA default callback to ara_default
Naming the callback simply 'default' overrides the actual Ansible
default callback. Name it something else so it doesn't clash.

Change-Id: I3a4269c5a4ec1bee3bd090c57e696032c2508a62
2018-06-20 10:11:28 -04:00
David Moreau Simard 92320181a9
Add ansible and ara-clients as requirements for ara-plugins
ara-plugins (callback modules, action plugins, etc.) requires
ansible and ara-clients so the plugins can communicate with the
API.

Change-Id: Ice090181f410b97ad9971d1d9a725a4d557c1442
2018-06-20 09:38:25 -04:00
David Moreau Simard eea0c5ef55
Add tox-pep8 gate job
Change-Id: I4532a80548a3afb8d0ecf236ba2169b591435877
2018-06-20 00:07:41 -04:00
David Moreau Simard 482cca5e8b
First iteration of the callback plugin
Implements playbook, play, files and tasks.
TODO: Results and Hosts

Change-Id: Ia8dc0299112e54fe31e3e48895aca0ec2a4b9e25
2018-06-20 00:06:09 -04:00
David Moreau Simard be9f8e2af8
Refactor ara-plugins as a namespaced module
This is a structure that will allow us to install everything under
"ara" as separate packages but inside the same module.

For example, installing ara-server will provide ara.server and
ara.api.
Installing ara-clients will provide ara.clients, ara-plugins will
supply ara.plugins, etc.

Change-Id: I4fc9a06b1da720120567a476c17e9543828adfa1
2018-06-20 00:02:53 -04:00
David Moreau Simard c7763e37eb
Bootstrap ara-plugins
Add basic skeleton and make it installable.

Change-Id: Icc75e069125942e95438c3986477b2e20ce27c7e
2018-04-24 17:33:59 -04:00
OpenStack Project Creator 4c2f3da7a4 Added .gitreview 2018-03-27 11:35:29 +00:00