Try removing the organization parameter from the github_repo task.

On Mon, 3 Jul 2023 at 17:39, Hiero-nymo <[email protected]> wrote:
>
> Hi everyone,
>
> I tried to create a git repository in GitHub with Ansible and I encounter two 
> issues:
> 1) I did a lot of research and didn't see much information about GitHub API 
> Infrastructure.
> 2) I can get the information about a repo but I cannot create a new one. I've 
> tried with github_repo and uri Module without success:
>
> With uri
> - name: create repository
> uri:
> url: "https://api.github.com/users/<user>"
> method: POST
> body_format: json
> headers:
> Accept: "application/vnd.github.v3+json"
> Authorization: "token {{ token_perso }}"
> body:
> name: "{{ repository_name }}"
> private: false
> auto_init: true
> has_issues: true
> has_wiki: true
> has_downloads: true
> register: response
>
> With github_repo
> - name: create repository
> github_repo:
> organization: <user>
> access_token: "{{ token_perso }}"
> name: "{{ repository_name }}"
> state: present
> register: response
>
> Unfortunately I always received a Status code 404. I've configured my token 
> with permission too.
>
> "msg": "Status code was 404 and not [200]: HTTP Error 404: Not Found", 
> "redirected": false, "referrer_policy": "origin-when-cross-origin, 
> strict-origin-when-cross-origin", "server": "GitHub.com", "status": 404,
>
> As anyone an idea?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/8ea3df71-d5a1-4374-bc40-6f4e96a2e900n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLY9shXaWZSVZNvypmY4hbvSMh8cD1ijjDKPEi1CfZcJNg%40mail.gmail.com.

Reply via email to