0Pricing
Ansible Academy · Lesson

Publishing Your Own Role to Galaxy

Share automation with the world.

Publishing Your Own Role to Galaxy is a free Ansible Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ansible Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Give Back to the Hub

Once a role solves a problem cleanly, you can share it. Publishing to Galaxy lets anyone install your work with one command.

Galaxy Reads from GitHub

Galaxy does not host code itself. It imports a role straight from a public GitHub repository that you own.

One Repo, One Role

The cleanest setup puts a single role at the repo root using the standard scaffold from ansible-galaxy init.

ansible-galaxy init my_role

meta/main.yml Is Required

Galaxy reads meta/main.yml for metadata. Fill in author, a clear description, the license, and supported platforms before importing.

galaxy_info:
  author: yourname
  description: Configure nginx
  license: MIT

Write a Real README

Your README.md is the role's front page. Document what it does and list every variable it accepts with sensible examples.

Connect Your GitHub Account

Log in to galaxy.ansible.com with GitHub. This links your account so Galaxy can see and import your repositories.

Import the Repository

From your Galaxy dashboard you select the repo and trigger an import. Galaxy then reads the metadata and publishes the role.

Import from the CLI

You can also import without the website using an API token and the import subcommand, naming your GitHub user and repo.

ansible-galaxy role import yourname my_role

Tags Become Versions

Galaxy turns your Git tags into role versions. Push a tag like 1.0.0 so users can pin a specific, stable release.

git tag 1.0.0
git push --tags

Naming Comes from Your Repo

The published role's name is your github_user.repo_name, which is exactly how others will reference it in requirements.yml.

roles:
  - name: yourname.my_role

Keep It Maintained

Publishing is a commitment. Respond to issues and push fresh tags for fixes so the community keeps trusting your role.

Quick Check

Recall where Galaxy gets the code it publishes.

Recap

Scaffold the role, fill meta/main.yml and the README, push to GitHub, then import to Galaxy. Git tags become installable versions. 🚀

Frequently asked questions

Is the “Publishing Your Own Role to Galaxy” lesson free?

Yes — the full text of “Publishing Your Own Role to Galaxy” is free to read here on the web, and the Ansible Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ansible Academy course, upgrade to CoddyKit PRO.

What will I learn in “Publishing Your Own Role to Galaxy”?

Share automation with the world. You practise Ansible Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Ansible Academy?

No prior experience is required. Ansible Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Publishing Your Own Role to Galaxy” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Ansible Academy lesson?

Yes. Every Ansible Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Roles vs Collections on Galaxy
  2. Install Roles with requirements.yml
  3. Using FQCN: namespace.collection.module
  4. Publishing Your Own Role to Galaxy
← Back to Ansible Academy