Hi everyone and thanks in advance for your support, I wanna create 1 API call to create 2 repos, 1 assigned to a Superadmin gitea account and the other for standard gitea user named gitea, I assume this would need to be with a list of users in variables and a list of repos in variables also using with_items but I don't seem to get it, down I'm attaching my API call format in Ansible to achieve 1 repo/1user, please someone help:
- name: "gitea - Create repo"
uri:
url: '{{ gitea_api_url }}/user/repos'
method: POST
body_format: json
status_code: 201
headers:
Authorization: token {{ saved_tokens if token_ is undefined else token_ }}
body:
auto_init: true
default_branch: "main"
description: "hi"
gitignores: ""
issue_labels: ""
license: ""
name: "{{ item }}"
private: true
readme: ""
template: true
trust_model: "default"
owner: '{{ gitea.users }}'
with_items: "{{ repo_names }}"
register: _repostatus
I only assume it could work with a list of 2 users and a list of 2 repo names using somehow with_items and conditionals together, in this case I have the following:
gitea:
users:
- name: '{{ gitea_admin_account }}'
admin: true
- name: '{{ gitea_standard_account }}'
admin: false
repo_names:
- test2
- test3
How to use the 'admin' flag to create 'test2' to the admin and 'test3' to the standard user?