From 44341f4984056945c960b744c6066ef2a29dcaa9 Mon Sep 17 00:00:00 2001 From: Michael Buluma <1452922+buluma@users.noreply.github.com> Date: Fri, 9 Oct 2026 03:56:28 +0300 Subject: [PATCH 1/2] Fix Galaxy role index names --- .github/workflows/update-roles.yml | 8 +++++--- README.md | 9 +++++---- _data/ansible_role_repositories.yml | 1 + _data/ansible_roles.yml | 7 +++---- index.md | 2 +- scripts/update_roles.py | 19 ++++++++++++++----- 6 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 _data/ansible_role_repositories.yml diff --git a/.github/workflows/update-roles.yml b/.github/workflows/update-roles.yml index 2d0714a..f55ad28 100644 --- a/.github/workflows/update-roles.yml +++ b/.github/workflows/update-roles.yml @@ -49,9 +49,11 @@ jobs: branch: automation/update-ansible-roles delete-branch: true base: master - add-paths: _data/ansible_roles.yml + add-paths: | + _data/ansible_roles.yml + _data/ansible_role_repositories.yml commit-message: Update Ansible role list title: Update Ansible role list body: | - Refresh `_data/ansible_roles.yml` from public `buluma/ansible-role-*` repositories. - Archived repositories are excluded. + Refresh the Ansible Galaxy role index and GitHub repository slug mapping from public `buluma/ansible-role-*` repositories. + Galaxy role names use underscores, and archived repositories are excluded. diff --git a/README.md b/README.md index a8d6a61..8457872 100644 --- a/README.md +++ b/README.md @@ -61,10 +61,11 @@ python scripts/update_roles.py list python scripts/update_roles.py sync ``` -This syncs public `buluma/ansible-role-*` repositories into the role list and -skips archived repositories. The **Update Ansible roles** workflow runs daily -or can be started manually from the Actions tab; it opens or updates a PR for -the generated change. +This syncs public `buluma/ansible-role-*` repositories into the role list, +converts dashes in repository names to Galaxy-compatible underscores, and skips +archived repositories. The **Update Ansible roles** workflow runs daily or can +be started manually from the Actions tab; it opens or updates a PR for the +generated role list and repository slug mapping. The workflow needs a repository secret named `ROLE_SYNC_TOKEN`: a fine-grained token with **Contents: read and write** and **Pull requests: read and write** diff --git a/_data/ansible_role_repositories.yml b/_data/ansible_role_repositories.yml new file mode 100644 index 0000000..7779e03 --- /dev/null +++ b/_data/ansible_role_repositories.yml @@ -0,0 +1 @@ +lemp_stack: lemp-stack diff --git a/_data/ansible_roles.yml b/_data/ansible_roles.yml index 1d2e865..bc46c2a 100644 --- a/_data/ansible_roles.yml +++ b/_data/ansible_roles.yml @@ -60,7 +60,7 @@ - debug - demo - dhcpd -- digitalocean-agent +- digitalocean_agent - diskspace - dns - dnsmasq @@ -115,7 +115,7 @@ - kibana - kubectl - kubernetes -- lemp-stack +- lemp_stack - libvirt - local - locale @@ -139,7 +139,7 @@ - multi - mysql - netdata -- netiq-sentinel-syslog-event-source +- netiq_sentinel_syslog_event_source - nfs - nginx - nodejs @@ -173,7 +173,6 @@ - rclone - reboot - redis -- redmine-1 - remi - repo_epel - restore diff --git a/index.md b/index.md index 99a1109..f68cca4 100644 --- a/index.md +++ b/index.md @@ -23,5 +23,5 @@ understand what distributions and their versions are tested, have a look at the | Role | Galaxy | CI Status | Version | Downloads | |------|--------|-----------|---------|-----------| -{% for role in roles %}| [`{{ role }}`](https://galaxy.ansible.com/buluma/{{ role }}) | [![Galaxy](https://img.shields.io/badge/galaxy-{{ role }}-brightgreen?logo=ansible)](https://galaxy.ansible.com/buluma/{{ role }}) | [![CI](https://github.com/buluma/ansible-role-{{ role }}/actions/workflows/molecule.yml/badge.svg)](https://github.com/buluma/ansible-role-{{ role }}/actions/workflows/molecule.yml) | [![Version](https://img.shields.io/github/commits-since/buluma/ansible-role-{{ role }}/latest.svg)](https://github.com/buluma/ansible-role-{{ role }}/releases) | [![Downloads](https://img.shields.io/ansible/role/d/buluma/{{ role }})](https://galaxy.ansible.com/buluma/{{ role }}) | +{% for role in roles %}{% assign repository = site.data.ansible_role_repositories[role] | default: role %}| [`{{ role }}`](https://galaxy.ansible.com/buluma/{{ role }}) | [![Galaxy](https://img.shields.io/badge/galaxy-{{ role }}-brightgreen?logo=ansible)](https://galaxy.ansible.com/buluma/{{ role }}) | [![CI](https://github.com/buluma/ansible-role-{{ repository }}/actions/workflows/molecule.yml/badge.svg)](https://github.com/buluma/ansible-role-{{ repository }}/actions/workflows/molecule.yml) | [![Version](https://img.shields.io/github/commits-since/buluma/ansible-role-{{ repository }}/latest.svg)](https://github.com/buluma/ansible-role-{{ repository }}/releases) | [![Downloads](https://img.shields.io/ansible/role/d/buluma/{{ role }})](https://galaxy.ansible.com/buluma/{{ role }}) | {% endfor %} diff --git a/scripts/update_roles.py b/scripts/update_roles.py index 18036b3..4d227c0 100755 --- a/scripts/update_roles.py +++ b/scripts/update_roles.py @@ -21,13 +21,10 @@ import yaml ROLES_FILE = "_data/ansible_roles.yml" +ROLE_REPOSITORIES_FILE = "_data/ansible_role_repositories.yml" REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) GITHUB_OWNER = "buluma" ROLE_REPOSITORY_PREFIX = "ansible-role-" -ROLE_NAME_OVERRIDES = { - "digitalocean_agent": "digitalocean-agent", - "netiq_sentinel_syslog_event_source": "netiq-sentinel-syslog-event-source", -} def load_roles(): @@ -57,6 +54,13 @@ def save_roles(roles): print(f"Updated {len(sorted_roles)} roles in {ROLES_FILE}") +def save_role_repositories(repositories): + """Save GitHub repository slugs for roles whose Galaxy names differ.""" + filepath = os.path.join(REPO_ROOT, ROLE_REPOSITORIES_FILE) + with open(filepath, "w") as f: + yaml.safe_dump(repositories, f, sort_keys=True) + + def cmd_add(role_names): """Add one or more roles.""" roles = load_roles() @@ -104,6 +108,7 @@ def cmd_list(): def cmd_sync(): """Synchronize roles from non-archived public GitHub role repositories.""" roles = set() + role_repositories = {} page = 1 token = os.environ.get("GITHUB_TOKEN") or os.environ.get("GH_TOKEN") @@ -140,7 +145,10 @@ def cmd_sync(): if repository.get("archived") or not name.startswith(ROLE_REPOSITORY_PREFIX): continue repository_role = name.removeprefix(ROLE_REPOSITORY_PREFIX) - roles.add(ROLE_NAME_OVERRIDES.get(repository_role, repository_role)) + role_name = repository_role.replace("-", "_") + roles.add(role_name) + if role_name != repository_role: + role_repositories[role_name] = repository_role page += 1 @@ -151,6 +159,7 @@ def cmd_sync(): ) save_roles(roles) + save_role_repositories(role_repositories) print(f"Synchronized roles from {GITHUB_OWNER}'s active public repositories") From 027d9dfbb01202d01ba29355b49701d52463022a Mon Sep 17 00:00:00 2001 From: Michael Buluma <1452922+buluma@users.noreply.github.com> Date: Fri, 9 Oct 2026 03:59:03 +0300 Subject: [PATCH 2/2] Align LEMP repository slug --- _data/ansible_role_repositories.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/ansible_role_repositories.yml b/_data/ansible_role_repositories.yml index 7779e03..0967ef4 100644 --- a/_data/ansible_role_repositories.yml +++ b/_data/ansible_role_repositories.yml @@ -1 +1 @@ -lemp_stack: lemp-stack +{}