<p>In GH API endpoint that is used in this module has the optional parameter <code>auto_init</code> - for the creation of empty <code>README</code> (<a href="https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-an-organization-repository" rel="nofollow noreferrer">https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-an-organization-repository</a>)</p>
<p>I see few options:</p>
<ul>
<li>create your own copy of this module - this easy change in the module</li>
<li>change request in the module will be a good idea: <a href="https://github.com/ansible-collections/community.general" rel="nofollow noreferrer">https://github.com/ansible-collections/community.general</a></li>
</ul>
<p>But probably the quickest way will be to use this module: <a href="https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html" rel="nofollow noreferrer">https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html</a> to call GH API</p>

CC BY-SA 4.0
2023-04-06T21:37:44.930Z
2023-04-06T21:37:44.930Z
BLuM
<p>We use Ansible to automatically setup Kubernetes clusters.
KPT <a href="https://kpt.dev/" rel="nofollow noreferrer">https://kpt.dev/</a> is further used to deploy config files to pods in these clusters.</p>
<p>In this process we need to create new GitHub Repositories with Ansible.
The problem is KPT doesn't work with en empty repo.</p>
<p>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.</p>
<p>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.</p>
<p>Any ideas?</p>

<ansible><github>
Use ansible to create GitHub repository with README
r3volutionxxx
# Use ansible to create GitHub repository with README

(Asked by: username_0 on 2023-04-05)

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?

**Tags:** ansible, github


---

## 1 answers

### Answer by username_1 on 2023-04-06. Score: 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:

* create your own copy of this module - this easy change in the module
* change request in the module will be a good idea: <https://github.com/ansible-collections/community.general>

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


---

