playbooks/clone-repo: refactored the playbook

removed the logs to increase the security

Signed-off-by: Marc Mattmüller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmüller 2023-06-13 11:30:00 +02:00
parent 15732a2cf7
commit 8b56069a38
1 changed files with 4 additions and 7 deletions

View File

@ -1,6 +1,6 @@
- name: Clone a Git Repository
hosts: linux
gather_facts: no
gather_facts: false
vars:
git_repo_path: "~/nwl-ci"
ssh_auto_sshadd_file: "./auto-sshadd"
@ -19,23 +19,20 @@
register: auto_sshadd_stat
- name: Prepare auto ssh-add file
register: prepareAutoSshAdd
ansible.builtin.shell: |
echo '#!/bin/bash' > {{ ssh_auto_sshadd_file }}
echo 'echo $SSH_PASS' >> {{ ssh_auto_sshadd_file }}
chmod +x {{ ssh_auto_sshadd_file }}
no_log: true
when: not auto_sshadd_stat.stat.exists
- name: Clone and Update Repository
register: clonerepo
ansible.builtin.shell: |
eval `ssh-agent -s`
SSH_PASS={{ssh_passphrase}} DISPLAY=1 SSH_ASKPASS="{{ssh_auto_sshadd_file}}" ssh-add {{ssh_keyfile}} < /dev/null
git clone ssh://git@bitbucket.gad.local:7999/nm-nsp/nwl-ci.git {{git_repo_path}}
cd nwl-ci
cd {{git_repo_path}}
git checkout develop
git fetch -ap
git pull
- name: Display ssh key loading output
debug:
msg: "{{clonerepo.stdout_lines}}"
no_log: true