Skip to content

Commit

Permalink
Refactor git key file remove
Browse files Browse the repository at this point in the history
- Add a task to collect check if git key file exists
- Remove git key file if it exists and django_remove_git_key == True
  • Loading branch information
moshthepitt committed Apr 9, 2019
1 parent de01312 commit ac5f191
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,22 @@
- django_git_key is defined
- django_git_key is not none

- name: Check if Git key file exists
stat:
path: "{{ django_system_user_home }}/.ssh/{{ django_git_key_filename }}"
register: django_git_key_file
when:
- django_remove_git_key == True

- name: Remove Git Key
file:
state: absent
path: "{{ django_system_user_home }}/.ssh/{{ django_git_key_filename }}"
become: True
become_user: "{{ django_system_user }}"
when:
- django_git_key is defined
- django_git_key is not none
- django_remove_git_key == True
- django_git_key_file.stat.exists

- name: Git clone without key
git:
Expand Down

0 comments on commit ac5f191

Please sign in to comment.