From 4ead9fabd28a1b30560bd0a3b1b296fa08efa4a2 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Mon, 7 Aug 2023 14:06:33 +0200 Subject: [PATCH] update docs Signed-off-by: Guido Grazioli --- MAINTAINING.md | 3 - README.md | 171 ++++++++++++++++++-------------------------- REVIEW_CHECKLIST.md | 2 +- docs/testing.md | 34 +++++---- 4 files changed, 88 insertions(+), 122 deletions(-) delete mode 100644 MAINTAINING.md diff --git a/MAINTAINING.md b/MAINTAINING.md deleted file mode 100644 index 9fad0d3..0000000 --- a/MAINTAINING.md +++ /dev/null @@ -1,3 +0,0 @@ -# Maintaining this collection - -Refer to the [Maintainer guidelines](https://github.com/ansible/community-docs/blob/main/maintaining.rst). diff --git a/README.md b/README.md index c27b264..c5a07dd 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,78 @@ # Lean Ansible bindings for KubeVirt - -[![CI](https://github.com/kubevirt/kubevirt.core/workflows/CI/badge.svg?event=push)](https://github.com/kubevirt/kubevirt.core/actions) + +[![Build Status](https://github.com/kubevirt/kubevirt.core/workflows/CI/badge.svg?event=push)](https://github.com/kubevirt/kubevirt.core/actions) - -This repo hosts the kubevirt.core Ansible Collection. +> **_NOTE:_ If you are Red Hat customer, install `redhat.ocpv` from [Automation Hub](https://console.redhat.com/ansible/ansible-dashboard) as the certified version of this collection.** + -The collection includes an inventory plugin for Ansible to automate the management of VMs running on KubeVirt. +This repository hosts the `kubevirt.core` Ansible Collection, which provides virtual machine operations and inventory source for use with Ansible. + +## Ansible version compatibility + +This collection has been tested against following Ansible versions: **>=2.9.10**. + + +## Included content + +### Plugins + +* `kubevirt`: inventory source for kubevirt virtual machines +* `kubevirt_vm`: create or delete kubevirt virtual machines + +## Using this collection + + +### Installing the Collection from Ansible Galaxy + +Before using this collection, you need to install it with the Ansible Galaxy command-line tool: +```bash +ansible-galaxy collection install kubevirt.core +``` + + +### Build and install locally + +Clone the repository, checkout the tag you want to build, or pick the main branch for the development version; then: +```bash +ansible-galaxy collection build . +ansible-galaxy collection install kubevirt-kubevirt.core-*.tar.gz +``` + +### Dependencies + +#### Ansible collections + +* [kubernetes.core](https://docs.ansible.com/ansible/latest/collections/kubernetes/core/index.html) + +You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: +```yaml +--- +collections: + - name: kubevirt.core +``` + +#### Python libraries + +- kubernetes +- PyYaml +- jsonpatch +- jinja2 + +To install all the dependencies: +```bash +pip install -r requirements.txt +``` + +See [Ansible Using collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details. + + ## Code of Conduct -We follow the [Ansible Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html) in all our interactions within this project. - -If you encounter abusive behavior, please refer to the [policy violations](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html#policy-violations) section of the Code for information on how to raise a complaint. - -## Communication - - - -We announce releases and important changes through Ansible's [The Bullhorn newsletter](https://github.com/ansible/community/wiki/News#the-bullhorn). Be sure you are [subscribed](https://eepurl.com/gZmiEP). - -Join us in the `#ansible` (general use questions and support), `#ansible-community` (community and collection development questions), and other [IRC channels](https://docs.ansible.com/ansible/devel/community/communication.html#irc-channels). - -We take part in the global quarterly [Ansible Contributor Summit](https://github.com/ansible/community/wiki/Contributor-Summit) virtually or in-person. Track [The Bullhorn newsletter](https://eepurl.com/gZmiEP) and join us. - -For more information about communication, refer to the [Ansible Communication guide](https://docs.ansible.com/ansible/devel/community/communication.html). +We follow the [KubeVirt Code of Conduct](https://github.com/kubevirt/kubevirt/blob/main/CODE_OF_CONDUCT.md). ## Contributing to this collection - - The content of this collection is made by people like you, a community of individuals collaborating on making the world better through developing automation software. We are actively accepting new contributors. @@ -47,95 +91,22 @@ We use the following guidelines: ## Collection maintenance -The current maintainers are listed in the [MAINTAINERS](MAINTAINERS) file. If you have questions or need help, feel free to mention them in the proposals. +The current maintainers are listed in the [OWNERS](OWNERS) file. If you have questions or need help, feel free to mention them in the proposals. -To learn how to maintain / become a maintainer of this collection, refer to the [Maintainer guidelines](MAINTAINING.md). +To learn how to maintain / become a maintainer of this collection, refer to the [Maintainer guidelines](https://docs.ansible.com/ansible/devel/community/maintainers.html). ## Governance - - The process of decision making in this collection is based on discussing and finding consensus among participants. Every voice is important. If you have something on your mind, create an issue or dedicated discussion and let's discuss it! + -## Tested with Ansible - - - -## External requirements - - -- python >= 3.6 - -Python libraries: -- kubernetes -- PyYaml -- jsonpatch -- jinja2 - -### Supported connections - - -## Included content - - - -## Using this collection - - - -### Installing the Collection from Ansible Galaxy - -Before using this collection, you need to install it with the Ansible Galaxy command-line tool: -```bash -ansible-galaxy collection install kubevirt.core -``` - -You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: -```yaml ---- -collections: - - name: kubevirt.core -``` - -Note that if you install the collection from Ansible Galaxy, it will not be upgraded automatically when you upgrade the `ansible` package. To upgrade the collection to the latest available version, run the following command: -```bash -ansible-galaxy collection install kubevirt.core --upgrade -``` - -You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version `0.1.0`: - -```bash -ansible-galaxy collection install kubevirt.core:==0.1.0 -``` - -See [Ansible Using collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details. - -## Release notes - -See the [changelog](https://github.com/ansible-collections/REPONAMEHERE/tree/main/CHANGELOG.rst). - -## Roadmap - - - -## More information - - - -- [Ansible Collection overview](https://github.com/ansible-collections/overview) -- [Ansible User guide](https://docs.ansible.com/ansible/devel/user_guide/index.html) -- [Ansible Developer guide](https://docs.ansible.com/ansible/devel/dev_guide/index.html) -- [Ansible Collections Checklist](https://github.com/ansible-collections/overview/blob/main/collection_requirements.rst) -- [Ansible Community code of conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html) -- [The Bullhorn (the Ansible Contributor newsletter)](https://us19.campaign-archive.com/home/?u=56d874e027110e35dea0e03c1&id=d6635f5420) -- [News for Maintainers](https://github.com/ansible-collections/news-for-maintainers) + + ## Licensing - - GNU General Public License v3.0 or later. See [LICENSE](./LICENSE) to see the full text. diff --git a/REVIEW_CHECKLIST.md b/REVIEW_CHECKLIST.md index 9dccf7e..a056a90 100644 --- a/REVIEW_CHECKLIST.md +++ b/REVIEW_CHECKLIST.md @@ -1,3 +1,3 @@ # Review Checklist -Refer to the [Collection review checklist](https://github.com/ansible/community-docs/blob/main/review_checklist.rst). +Refer to the [Collection review checklist](https://docs.ansible.com/ansible/devel/community/collection_contributors/collection_reviewing.html). diff --git a/docs/testing.md b/docs/testing.md index f9343f2..6ed0b3d 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -2,34 +2,32 @@ ## Continuous integration -The collection is tested with a [molecule](https://github.com/ansible-community/molecule) setup covering the included roles and verifying correct installation and idempotency. -In order to run the molecule tests locally with python 3.9 available, after cloning the repository: +The `hack/e2e-setup.sh` script contains the steps necessary to reproduce the CI test environment, which relies on `kubectl` and `kind`. -``` -pip install yamllint 'molecule[docker]~=3.5.2' ansible-core flake8 ansible-lint voluptuous -molecule test --all -``` -## Test playbooks +## Example config and playbooks -Sample playbooks are provided in the `playbooks/` directory; to run the playbooks locally (requires a rhel system with python 3.9+, ansible, and systemd) the steps are as follows: +Sample playbooks and inventory configurations are provided in the `examples/` directory; to run the playbooks locally, build the testing environment with the script above, then the steps are as follows: -``` +```bash # setup environment pip install ansible-core # clone the repository -git clone https://github.com/ansible-middleware/amq -cd amq +git clone https://github.com/kubevirt/kubevirt.core +cd kubevirt.core # install collection dependencies ansible-galaxy collection install -r requirements.yml # install collection python deps pip install -r requirements.txt -# create inventory for localhost -cat << EOF > inventory -[amq] -localhost ansible_connection=local -EOF -# run the playbook -ansible-playbook -i inventory playbooks/activemq.yml +# setup environment +hack/e2e-setup.sh +# run inventory source +ansible-inventory -i examples/inventory.kubevirt.yml +# create a virtual machine +ansible-playbook -i examples/inventory.kubevirt.yml examples/play-create-min.yml +# terminate a virtual machine +ansible-playbook -i examples/inventory.kubevirt.yml examples/play-delete.yml +# terminate the environment +hack/e2e-setup.sh --cleanup ```