We use Ansible to automatically setup Kubernetes clusters. KPT https://kpt.dev/ is further used to deploy config files to pods in these clusters.

In this process we need to create new GitHub Repositories with Ansible. The problem is KPT doesn't work with en empty repo.

Is there a way to create a GitHub Repository with Ansible and include for example a README file? The file could be anything, doesn't matter for KPT.

I used the community.general.github_repo module to create a repository which worked great, but I don't seem to find a way to automatically include a README.md.

Any ideas?

1 Answer 1


In GH API endpoint that is used in this module has the optional parameter auto_init - for the creation of empty README (https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-an-organization-repository)

I see few options:

But probably the quickest way will be to use this module: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html to call GH API

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.