feat(git.yml): enhance version handling for git repositories to prioritize 'master' if available
This commit is contained in:
+209
-19
@@ -28,7 +28,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ git_firewall_repository.repo }}"
|
repo: "{{ git_firewall_repository.repo }}"
|
||||||
dest: "{{ git_firewall_repository.dest }}"
|
dest: "{{ git_firewall_repository.dest }}"
|
||||||
version: "{{ git_firewall_repository.version | default(git_firewall_repository.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
git_firewall_repository.version
|
||||||
|
| default(git_firewall_repository.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ git_firewall_repository.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
when: git_firewall_repository is defined and git_firewall_repository | length > 0
|
when: git_firewall_repository is defined and git_firewall_repository | length > 0
|
||||||
tags:
|
tags:
|
||||||
- git-firewall-repository
|
- git-firewall-repository
|
||||||
@@ -41,7 +51,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_default_repositories }}"
|
with_items: "{{ git_default_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -56,7 +76,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_oopen_server_repositories }}"
|
with_items: "{{ git_oopen_server_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -72,7 +102,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_warenform_server_repositories }}"
|
with_items: "{{ git_warenform_server_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -88,7 +128,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_lxc_guest_repositories }}"
|
with_items: "{{ git_lxc_guest_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -104,7 +154,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_lxc_host_repositories }}"
|
with_items: "{{ git_lxc_host_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -120,7 +180,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_gateway_repositories }}"
|
with_items: "{{ git_gateway_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -136,7 +206,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_apache2_repositories }}"
|
with_items: "{{ git_apache2_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -152,7 +232,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_nginx_repositories }}"
|
with_items: "{{ git_nginx_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -168,7 +258,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_mysql_repositories }}"
|
with_items: "{{ git_mysql_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -184,7 +284,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_postgresql_repositories }}"
|
with_items: "{{ git_postgresql_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -200,7 +310,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_nextcloud_repositories }}"
|
with_items: "{{ git_nextcloud_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -216,7 +336,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_dns_repositories }}"
|
with_items: "{{ git_dns_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -232,7 +362,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_backup_repositories }}"
|
with_items: "{{ git_backup_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -249,7 +389,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_samba_repositories }}"
|
with_items: "{{ git_samba_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -266,7 +416,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_mailserver_repositories }}"
|
with_items: "{{ git_mailserver_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -282,7 +442,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_sympa_repositories }}"
|
with_items: "{{ git_sympa_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -298,7 +468,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
with_items: "{{ git_jitsi_meet_repositories }}"
|
with_items: "{{ git_jitsi_meet_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
@@ -344,7 +524,17 @@
|
|||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
version: "{{ item.version | default(item.branch) | default(git_default_branch | default('main')) }}"
|
version: >-
|
||||||
|
{{
|
||||||
|
item.version
|
||||||
|
| default(item.branch)
|
||||||
|
| default(
|
||||||
|
'master'
|
||||||
|
if (lookup('pipe', 'git ls-remote --heads ' ~ item.repo ~ ' master') | length > 0)
|
||||||
|
else 'main'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
with_items: "{{ git_other_repositories }}"
|
with_items: "{{ git_other_repositories }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user