/ansible-collections-consoledot.edgemanagement

PoC Ansible Collection for Red Hat Edge Fleet Manager

Primary LanguagePythonMIT LicenseMIT

Red Hat console.redhat.com Edge Manager Ansible Collection

Tech Preview

This is the Ansible Collection provided by the Ansible Edge Automation Team for automating actions in Red Hat Edge Management

This Collection is meant for distribution through Ansible Galaxy as is available for all Ansible users to utilize, contribute to, and provide feedback about.

Ansible version compatibility

This collection has been tested against following Ansible versions: >=2.11.

Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible.

Collection Content

Installing this collection

You can install the Edge Management collection with the Ansible Galaxy CLI:

ansible-galaxy collection install consoledot.edgemanagement

You can also include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml, using the format:

---
collections:
  - name: consoledot.edgemanagement

Using the Red Hat Edge Manager Collection

An example for using this collection to manage a log source with Red Hat Edge Manager is as follows.

Password Auth

For password-based auth, inventory.ini (Note the password should be managed by a Vault for a production environment).

[CRC]
console.redhat.com

[CRC:vars]
ansible_network_os=consoledot.edgemanagement.consoledot
ansible_connection=ansible.netcommon.httpapi
ansible_user=foobar@example.com
ansible_httpapi_pass=SuperSekretPassword
ansible_httpapi_use_ssl=yes
ansible_httpapi_validate_certs=yes

Token Auth

You can obtain a Red Hat API Offline Token by following the documentation here, and then provide that in the ansible_httpapi_consoledot_offline_token inventory var as follows (Note the password should be managed by a Vault for a production environment).

[CRC]
console.redhat.com

[CRC:vars]
ansible_connection=ansible.netcommon.httpapi
ansible_network_os=consoledot.edgemanagement.consoledot
ansible_httpapi_use_ssl=yes
ansible_httpapi_validate_certs=yes
ansible_httpapi_consoledot_offline_token="MY_RED_HAT_API_OFFLINE_TOKEN_HERE"

Using the modules with Fully Qualified Collection Name (FQCN)

With Ansible Collections there are various ways to utilize them either by calling specific Content from the Collection, such as a module, by its Fully Qualified Collection Name (FQCN) as we'll show in this example or by defining a Collection Search Path as the examples below will display.

---
- name: Get a list of Edge Images
  hosts: CRC
  gather_facts: false
  tasks:
    - name: get image info
      consoledot.edgemanagement.images_info:
			register: images_info_out
		- debug: var=images_info_out

Directory Structure

  • docs/: local documentation for the collection
  • license.txt: optional copy of license(s) for this collection
  • galaxy.yml: source data for the MANIFEST.json that will be part of the collection package
  • playbooks/: playbooks reside here
    • tasks/: this holds 'task list files' for include_tasks/import_tasks usage
  • plugins/: all ansible plugins and modules go here, each in its own subdir
    • modules/: ansible modules
    • lookups/: lookup plugins
    • filters/: Jinja2 filter plugins
    • ... rest of plugins
  • README.md: information file (this file)
  • roles/: directory for ansible roles
  • tests/: tests for the collection's content

Contributing to this collection

We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the Red Hat Edge Manager collection repository. See Contributing to Ansible-maintained collections for complete details.

See the Ansible Community Guide for details on contributing to Ansible.

Code of Conduct

This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.

Changelogs

Roadmap

More information

Licensing

MIT

See LICENSE to see the full text.

Dependencies

This collection relies on the ansible.netcommon collection, so if you're using ansible-core and not ansible then you will need to run the following command:

 $ ansible-galaxy install -r requirements.yml

Hacking

To use this while developing, run the following commands from within your local checkout to this git repo in order to symlink this git repo to the appropriate Ansible Collection path

	$ mkdir -p ~/.ansible/collections/ansible_collections/consoledot
	$ ln -s $(pwd) ~/.ansible/collections/ansible_collections/consoledot/edgemanagement

Make sure to set the proxy vars on the command line or in your shell environment if needed (required for devs using console.stage.redhat.com:

	$ HTTP_PROXY=http://proxy.foo.com:3128 HTTPS_PROXY=http://proxy.foo.com:3128 ansible-playbook myplaybook.yml -i myinventory.ini