/flightctl-ansible

Ansible Collection for Flight Control Service

Primary LanguagePythonApache License 2.0Apache-2.0

Ansible Collection for Flight Control Service

This Ansible Collection includes Ansible content to help automate the management of Flight Control resources.

Description

This collection enables organizations to automate time-consuming, error-prone tasks, enhancing efficiency and reducing manual effort. By leveraging it, teams can quickly adapt to shifting conditions across diverse IT environments, improving both operational agility and resilience. Its primary goal is to streamline mission-critical workflows for better overall performance.

Requirements

Ansible version compatibility

Tested with the Ansible Core >= 2.15.0 versions, and the current development version of Ansible.

Python version compatibility

This collection requires Python 3.10 or greater.

Use Cases

You can either call modules, rulebooks and playbooks by their Fully Qualified Collection Name (FQCN), such as ansible.eda.activation, or you can call modules by their short name if you list the flightctl.edge collection in the playbook's collections keyword:

---
  - name: Create a new test device
    flightctl.edge.flightctl:
      kind: Device
      name: "test-ansible-device"
      api_version: v1alpha1

  - name: Create a new device
    flightctl.edge.flightctl:
      kind: Device
      name: "test-ansible-device-2"
      resource_definition: "{{ lookup('file', 'device.yml') | from_yaml }}"

  - name: Update new test device
    flightctl.edge.flightctl:
      kind: Device
      name: "test-ansible-device"
      api_version: v1alpha1
      resource_definition:
        apiVersion: v1alpha1
        kind: Device
        metadata:
          labels:
            fleet: default
            novalue: ""

  - name: Get information about a specific device
    flightctl.edge.flightctl_info:
      kind: Device
      name: "test-ansible-device"

  - name: Delete a test device
    flightctl.edge.flightctl:
      kind: Device
      name: "test-ansible-device"
      state: absent

  - name: Get all devices
    flightctl.edge.flightctl_info:
      kind: Device

  - name: Get all fleets
    flightctl.edge.flightctl_info:
      kind: Fleet

  - name: Update the resource definition for a fleet
    flightctl.edge.flightctl:
      kind: Fleet
      name: "asible-test-fleet"
      resource_definition:
        spec:
          os:
            image: quay.io/redhat/rhde:9.3

Testing

There are unit, sanity, and integration tests configured to run for this repository. Tests are configured to run via github actions on pull requests and can also be run locally.

ansible-test is used to run each of the test types. For ansible-test to properly work the collection must be present in the following directory structure on your local machine:

{...}/ansible_collections/flightctl/edge/{code_from_this_repo}

Unit Tests

Run locally via make test-unit

Sanity Tests

Run locally via make test-sanity

Integration Tests

Integration tests are dependent on:

  • A flightctl instance the tests can hit
  • The flightctl_host var inside integration_config.yml set to the running flightctl api service

The easiest way to run tests locally is to:

  • Run make deploy from the main flightctl repository
  • Run make write-integration-config from this repository to create the proper integration config from your running services
  • Run locally via make test-integration

Support

If you encounter issues or have questions, you can submit a support request through the following channels:

  • GitHub Issues: Report bugs, request features, or ask questions by opening an issue in the GitHub repository.

Release notes

See the changelog.

Related Information

More information about Flight Control can be found in the main repo. The user docs in particular are helpful for understanding the concepts and capabilities of Flight Control.

License Information

See LICENSE to see the full text.