|
46 | 46 | loop_var: nfc_pb_awx_inventory
|
47 | 47 |
|
48 | 48 |
|
49 |
| - # - name: GIT Checkout Project |
50 |
| - # ansible.builtin.git: |
51 |
| - # repo: "{{ nfc_pb_awx_project.scm_url }}" |
52 |
| - # dest: /tmp/project |
53 |
| - # # separate_git_dir: /tmp/project |
54 |
| - # # clone: true |
55 |
| - # # depth: 1 |
56 |
| - # version: "{{ nfc_pb_awx_project.scm_branch | default('master') }}" |
57 |
| - # # single_branch: true |
58 |
| - # when: > |
59 |
| - # nfc_pb_awx_project.scm_url | default('') != '' |
60 |
| - # and |
61 |
| - # nfc_pb_awx_project.type | lower == 'playbook' |
| 49 | + - name: "[helper] Setup Git credentials if present" |
| 50 | + ansible.builtin.shell: |
| 51 | + cmd: | |
| 52 | + cat {{ tower.filename.git_credential_file }} > ~/.gitconfig; |
| 53 | + chmod 700 ~/.gitconfig; |
| 54 | + chown $(whoami):$(whoami) ~/.gitconfig; |
| 55 | + creates: ~/.gitconfig |
| 56 | + become: true |
| 57 | + when: tower.filename.git_credential_file is defined |
62 | 58 |
|
63 | 59 | - name: GIT Checkout Project
|
64 |
| - ansible.builtin.command: |
65 |
| - cmd: |- |
66 |
| - git clone --depth 1 -b {{ nfc_pb_awx_project.scm_branch | default('master') }} https:// |
67 |
| - {%- if nfc_pb_git_username is defined -%} |
68 |
| - {{ nfc_pb_git_username }}:{{ nfc_pb_git_token }}@ |
69 |
| - {%- endif -%} |
70 |
| - {{- nfc_pb_awx_project.scm_url | replace('https://', '') }} /tmp/project |
71 |
| - # repo: "{{ nfc_pb_awx_project.scm_url }}" |
72 |
| - # dest: /tmp/project |
73 |
| - # # separate_git_dir: /tmp/project |
74 |
| - # # clone: true |
75 |
| - # # depth: 1 |
76 |
| - # version: "{{ nfc_pb_awx_project.scm_branch | default('master') }}" |
77 |
| - # # single_branch: true |
78 |
| - no_log: true # Contains credentials. |
79 |
| - when: nfc_pb_awx_project.playbook_path is defined |
80 |
| - |
81 |
| - |
82 |
| - - name: GIT Init Submodule |
83 |
| - ansible.builtin.command: |
84 |
| - cmd: git submodule update --init |
85 |
| - chdir: /tmp/project |
86 |
| - no_log: true # Contains credentials. |
87 |
| - when: nfc_pb_awx_project.playbook_path is defined |
| 60 | + ansible.builtin.git: |
| 61 | + repo: "{{ nfc_pb_awx_project.scm_url }}" |
| 62 | + dest: /tmp/project |
| 63 | + version: "{{ nfc_pb_awx_project.scm_branch | default('master') }}" |
| 64 | + single_branch: true |
| 65 | + when: > |
| 66 | + nfc_pb_awx_project.playbook_path is defined |
88 | 67 |
|
89 | 68 |
|
90 | 69 | - name: Add Job templates
|
|
0 commit comments