mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-03-26 19:03:16 +00:00
@@ -1,3 +0,0 @@
|
|||||||
# Maintaining this collection
|
|
||||||
|
|
||||||
Refer to the [Maintainer guidelines](https://github.com/ansible/community-docs/blob/main/maintaining.rst).
|
|
||||||
171
README.md
171
README.md
@@ -1,34 +1,78 @@
|
|||||||
# Lean Ansible bindings for KubeVirt
|
# Lean Ansible bindings for KubeVirt
|
||||||
<!-- Add CI and code coverage badges here. Samples included below. -->
|
<!--start build_status -->
|
||||||
[](https://github.com/kubevirt/kubevirt.core/actions)
|
[](https://github.com/kubevirt/kubevirt.core/actions)
|
||||||
|
|
||||||
<!-- Describe the collection and why a user would want to use it. What does the collection do? -->
|
> **_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.**
|
||||||
This repo hosts the kubevirt.core Ansible Collection.
|
<!--end build_status -->
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
<!--start requires_ansible-->
|
||||||
|
## Ansible version compatibility
|
||||||
|
|
||||||
|
This collection has been tested against following Ansible versions: **>=2.9.10**.
|
||||||
|
<!--end requires_ansible-->
|
||||||
|
|
||||||
|
## Included content
|
||||||
|
|
||||||
|
### Plugins
|
||||||
|
|
||||||
|
* `kubevirt`: inventory source for kubevirt virtual machines
|
||||||
|
* `kubevirt_vm`: create or delete kubevirt virtual machines
|
||||||
|
|
||||||
|
## Using this collection
|
||||||
|
|
||||||
|
<!--start galaxy_download -->
|
||||||
|
### 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
|
||||||
|
```
|
||||||
|
<!--end galaxy_download -->
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
<!--start community_readme -->
|
||||||
## Code of Conduct
|
## 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.
|
We follow the [KubeVirt Code of Conduct](https://github.com/kubevirt/kubevirt/blob/main/CODE_OF_CONDUCT.md).
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
<!--List available communication channels. In addition to channels specific to your collection, we also recommend to use the following ones.-->
|
|
||||||
|
|
||||||
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).
|
|
||||||
|
|
||||||
## Contributing to this collection
|
## Contributing to this collection
|
||||||
|
|
||||||
<!--Describe how the community can contribute to your collection. At a minimum, fill up and include the CONTRIBUTING.md file containing how and where users can create issues to report problems or request features for this collection. List contribution requirements, including preferred workflows and necessary testing, so you can benefit from community PRs. If you are following general Ansible contributor guidelines, you can link to - [Ansible Community Guide](https://docs.ansible.com/ansible/devel/community/index.html). List the current maintainers (contributors with write or higher access to the repository). The following can be included:-->
|
|
||||||
|
|
||||||
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.
|
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.
|
We are actively accepting new contributors.
|
||||||
@@ -47,95 +91,22 @@ We use the following guidelines:
|
|||||||
|
|
||||||
## Collection maintenance
|
## 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
|
## Governance
|
||||||
|
|
||||||
<!--Describe how the collection is governed. Here can be the following text:-->
|
|
||||||
|
|
||||||
The process of decision making in this collection is based on discussing and finding consensus among participants.
|
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!
|
Every voice is important. If you have something on your mind, create an issue or dedicated discussion and let's discuss it!
|
||||||
|
<!--end community_readme -->
|
||||||
|
|
||||||
## Tested with Ansible
|
<!--start support -->
|
||||||
|
<!--end support -->
|
||||||
<!-- List the versions of Ansible the collection has been tested with. Must match what is in galaxy.yml. -->
|
|
||||||
|
|
||||||
## External requirements
|
|
||||||
|
|
||||||
<!-- List any external resources the collection depends on, for example minimum versions of an OS, libraries, or utilities. Do not list other Ansible collections here. -->
|
|
||||||
- python >= 3.6
|
|
||||||
|
|
||||||
Python libraries:
|
|
||||||
- kubernetes
|
|
||||||
- PyYaml
|
|
||||||
- jsonpatch
|
|
||||||
- jinja2
|
|
||||||
|
|
||||||
### Supported connections
|
|
||||||
<!-- Optional. If your collection supports only specific connection types (such as HTTPAPI, netconf, or others), list them here. -->
|
|
||||||
|
|
||||||
## Included content
|
|
||||||
|
|
||||||
<!-- Galaxy will eventually list the module docs within the UI, but until that is ready, you may need to either describe your plugins etc here, or point to an external docsite to cover that information. -->
|
|
||||||
|
|
||||||
## Using this collection
|
|
||||||
|
|
||||||
<!--Include some quick examples that cover the most common use cases for your collection content. It can include the following examples of installation and upgrade (change NAMESPACE.COLLECTION_NAME correspondingly):-->
|
|
||||||
|
|
||||||
### 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
|
|
||||||
|
|
||||||
<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. -->
|
|
||||||
|
|
||||||
## More information
|
|
||||||
|
|
||||||
<!-- List out where the user can find additional information, such as working group meeting times, slack/IRC channels, or documentation for the product this collection automates. At a minimum, link to: -->
|
|
||||||
|
|
||||||
- [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
|
## Licensing
|
||||||
|
|
||||||
<!-- Include the appropriate license information here and a pointer to the full licensing details. If the collection contains modules migrated from the ansible/ansible repo, you must use the same license that existed in the ansible/ansible repo. See the GNU license example below. -->
|
|
||||||
|
|
||||||
GNU General Public License v3.0 or later.
|
GNU General Public License v3.0 or later.
|
||||||
|
|
||||||
See [LICENSE](./LICENSE) to see the full text.
|
See [LICENSE](./LICENSE) to see the full text.
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# Review Checklist
|
# 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).
|
||||||
|
|||||||
@@ -2,34 +2,32 @@
|
|||||||
|
|
||||||
## Continuous integration
|
## 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.
|
The `hack/e2e-setup.sh` script contains the steps necessary to reproduce the CI test environment, which relies on `kubectl` and `kind`.
|
||||||
In order to run the molecule tests locally with python 3.9 available, after cloning the repository:
|
|
||||||
|
|
||||||
```
|
|
||||||
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
|
# setup environment
|
||||||
pip install ansible-core
|
pip install ansible-core
|
||||||
# clone the repository
|
# clone the repository
|
||||||
git clone https://github.com/ansible-middleware/amq
|
git clone https://github.com/kubevirt/kubevirt.core
|
||||||
cd amq
|
cd kubevirt.core
|
||||||
# install collection dependencies
|
# install collection dependencies
|
||||||
ansible-galaxy collection install -r requirements.yml
|
ansible-galaxy collection install -r requirements.yml
|
||||||
# install collection python deps
|
# install collection python deps
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
# create inventory for localhost
|
# setup environment
|
||||||
cat << EOF > inventory
|
hack/e2e-setup.sh
|
||||||
[amq]
|
# run inventory source
|
||||||
localhost ansible_connection=local
|
ansible-inventory -i examples/inventory.kubevirt.yml
|
||||||
EOF
|
# create a virtual machine
|
||||||
# run the playbook
|
ansible-playbook -i examples/inventory.kubevirt.yml examples/play-create-min.yml
|
||||||
ansible-playbook -i inventory playbooks/activemq.yml
|
# terminate a virtual machine
|
||||||
|
ansible-playbook -i examples/inventory.kubevirt.yml examples/play-delete.yml
|
||||||
|
# terminate the environment
|
||||||
|
hack/e2e-setup.sh --cleanup
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user