Skip to content

huyz/ansible-collection-huyz-general

Repository files navigation

Ansible Collection: huyz.general

MIT licensed Galaxy Collection CI

This Ansible collection contains roles for general use.

Usage

Roles:

  • huyz.general.add_to_config_file (README)
    • Function: Safely insert a block into one or more shell config files.
    • Use case: Mainly intended to be re-used by other roles.
  • huyz.general.prompt_password (README)
    • Function: Prompts for the ansible_password if not defined.
    • Use case: Avoid the need to call ansible-playbook with --ask-pass and --ask-become-pass.
  • huyz.general.sudo_by_ssh_agent (README)
    • Function: Configures sudo to use the libpam-ssh-agent-auth package and authorize the provided ssh key.
    • Use case: Avoid the need to authenticate with a password to run privileged commands.

Development (of this repo)

  1. Set ANSIBLE_GALAXY_API_KEY in .env

  2. Run

    direnv allow

How to update the Changelog

First time setup

One time, to initialize:

antsibull-changelog init .

Update the title and set keep_fragments: true.

After each change

First, create a manual fragments in changeslogs/fragments.

Then, to lint the fragments:

antsibull-changelog lint

To test out in dot-super/general

make build

In dot-super/general, have requirements.yml contain:

collections:
  # my own collection (the development version)
  - name: ../../ansible-collection-huyz-general/huyz-general-latest.tar.gz
# Add -f to force the update
install.sh

For a new release

First, create a manual fragment in changeslogs/fragments named DATE_vVERSION_summary.yml with release_summary property.

Then, generate the changelog for the release:

antsibull-changelog release --refresh-fragments --update-existing

How to lint

First, stage your changes, then:

pre-commit run -v

Overview of GitHub Actions

  • lint.yml
    • Triggered by: push to master and pull requests; weekly
    • Runs pre-commit
  • ansible-molecule.yml
    • Triggered by: push to master and pull requests; weekly
    • Runs Ansible Molecule on all the roles defined by the collection
  • publish.yml
    • Triggered by new tags
    • Builds collection and publishes it to Ansible Galaxy

How to publish on Ansible Galaxy

Typically:

  1. Draft a new "GitHub release":
    1. Choose tag: create new tag of the form vX.Y.Z.
    2. Title: vX.Y.Z
    3. Description: paste in the entry from the auto-generated CHANGELOG.rst
    4. Check Set as a pre-release
  2. The publish.yml GitHub Workflow should automatically publish a "Galaxy release".
  3. Check the action results. If successful, edit the GitHub release:
    1. Uncheck Set as a pre-release
    2. Check Set as the latest release

Note that the "Publish on Galaxy" action can be triggered manually on github.com

To manually trigger a "Galaxy release" at the command line:

make publish

License

MIT

About

Ansible collection for general-purpose roles

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •