Skip to content

Ansible collection for automating the management of Cherry Servers resources

License

Notifications You must be signed in to change notification settings

cherryservers/ansible-collection-cherryservers

Repository files navigation

Cherry Servers Ansible Collection

Code style: black codecov galaxy

Cherry Servers Ansible collection for managing infrastructure and resources.

Installation and Usage

Requirements

  • ansible-core >= 2.14
  • python >= 3.9

Installation

Use Ansible Galaxy CLI to install the collection:

ansible-galaxy collection install cherryservers.cloud

Usage

Before using the collection, you need to generate an API token from the Cherry Servers client portal. You can supply the token with the auth_token attribute or by setting CHERRY_AUTH_TOKEN (or CHERRY_AUTH_KEY) environment variables.

Example playbook

---
- name: Create a Cherry Servers server
  hosts: localhost
  tasks:
    - name: Create a server
      cherryservers.cloud.server:
        project_id: 216063
        region: "eu_nord_1"
        plan: "cloud_vps_1"
        auth_token: "my-auth-token-goes-here"

Included content

Modules

server
server_info
floating_ip
floating_ip_info
sshkey
sshkey_info
storage
storage_info
project
project_info

Inventory plugins

cherryservers

Documentation

The full documentation can be found on Ansible Galaxy. Documentation for separate modules and plugins can also be accessed with ansible-doc.

For example: ansible-doc cherryservers.cloud.server will display documentation for the server module.

Development

The collection should be placed in the Ansible collection path, which is usually ~/.ansible/collections/ansible_collections/<namespace>/collection. You can either clone the repository there directly, or, clone the repository anywhere, build with ansible-galaxy collection build (from the collection directory) and install with ansible-galaxy collection install <path-to-collection-file>.

For more information, refer to Ansible documentation on collection development.

Testing

Testing can be done with ansible-test. For example, to launch sanity tests, you can use:

ansible-test sanity --docker default -v

To perform integration tests, an integration_config.yml file must be created in the tests/integration/ directory. This file must declare cherryservers_api_key, cherryservers_project_id and, optionally, cherryservers_baremetal_server_id(used for storage testing).

You can run the whole suite of integration tests with, for example:

ansible-test integration --docker fedora39 -vvv

You can also run integration tests for specific modules, for example:

ansible-test integration server --docker fedora39 -vvv

More information on Ansible collection testing can be found here.

Release notes

See the changelog.

Release process

  1. Update _VERSION in plugins/module_utils/_version.py.
  2. Update version in galaxy.yml.
  3. Run antsibull-changelog release (make sure antsibull-changelog is installed.)
  4. If there are new modules or plugins, update the Included content section of this document.
  5. Tag the new version and push it.

About

Ansible collection for automating the management of Cherry Servers resources

Resources

License

Stars

Watchers

Forks

Packages

No packages published