This Ansible collection contains roles for general use.
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_passwordif not defined. - Use case: Avoid the need to call
ansible-playbookwith--ask-passand--ask-become-pass.
- Function: Prompts for the
huyz.general.sudo_by_ssh_agent(README)- Function: Configures sudo to use the
libpam-ssh-agent-authpackage and authorize the provided ssh key. - Use case: Avoid the need to authenticate with a password to run privileged commands.
- Function: Configures sudo to use the
-
Set
ANSIBLE_GALAXY_API_KEYin.env -
Run
direnv allow
make testFirst, stage your changes, then:
pre-commit run -vOne time, to initialize:
antsibull-changelog init .Update the title and set keep_fragments: true.
First, create a manual fragments in changeslogs/fragments.
Then, to lint the fragments:
antsibull-changelog lintmake buildIn 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.shUpdate version field in galaxy.yml.
If you haven't already, 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-existinglint.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
Typically:
- Draft a new "GitHub release":
- Choose tag: create new tag of the form
vX.Y.Z. - Title:
vX.Y.Z - Description: paste in the entry from the auto-generated
CHANGELOG.rst - Check
Set as a pre-release
- Choose tag: create new tag of the form
- The
publish.ymlGitHub Workflow should automatically publish a "Galaxy release". - Check the action results. If successful, edit the GitHub release:
- Uncheck
Set as a pre-release - Check
Set as the latest release
- Uncheck
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 publishMIT