Clark Boylan faf32b452d Mark .git dirs safe when marking ansible roles safe for git
In the previous change we set the top level ansible role git repo dir as
safe for git to perform clones against. It seems that for this to work
the way we want it to we actually need to mark the .git dir as safe
instead. Go ahead and do so here.

Change-Id: Id877c721e94d015f68cb51fb862b220da0414970
2024-06-10 08:15:44 -07:00

19 lines
771 B
YAML

- name: Mark source side of clone as safe
# This goes into a config file with many entries so we cannot set
# a creates attribute on this task. However, subsequent runs of this
# command seem to noop if the entries are already present so the impact
# is low.
command: git config --global safe.directory '{{ ansible_role_src_root }}/src/opendev.org/opendev/ansible-role-{{ ansible_role }}/.git'
loop: '{{ ansible_roles }}'
loop_control:
loop_var: ansible_role
- name: Install ansible roles to /etc/ansible/roles
git:
repo: '{{ ansible_role_src_root }}/src/opendev.org/opendev/ansible-role-{{ ansible_role }}'
dest: '/etc/ansible/roles/{{ ansible_role }}'
force: yes
loop: '{{ ansible_roles }}'
loop_control:
loop_var: ansible_role