Skip to content

Commit 43cdd4c

Browse files
committed
Enable copy git key from file and from string.
1 parent 64d7516 commit 43cdd4c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

defaults/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ django_system_user_home: "/home/{{ django_system_user }}"
77
django_git_url:
88
django_git_version: "master"
99
django_git_key:
10+
django_git_key_ssh_file:
1011
django_git_key_filename: "id_ed25519"
1112
django_remove_git_key: True
13+
django_copy_key_from_file: false
1214

1315
# system-wide dependencies
1416
django_python_source_version: "3.6"

tasks/install.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
- "{{ django_media_path }}"
5050
- "{{ django_system_user_home }}/.ssh"
5151

52-
- name: Copy git key
52+
- name: Copy git key from string
5353
copy:
54-
src: "{{ django_git_key }}"
54+
content: "{{ django_git_key }}"
5555
dest: "{{ django_system_user_home }}/.ssh/{{ django_git_key_filename }}"
5656
owner: "{{ django_system_user }}"
5757
mode: 0600
@@ -60,6 +60,17 @@
6060
- django_git_key is defined
6161
- django_git_key is not none
6262

63+
- name: Copy git key from file
64+
copy:
65+
src: "{{ django_git_key }}"
66+
dest: "{{ django_system_user_home }}/.ssh/{{ django_git_key_filename }}"
67+
owner: "{{ django_system_user }}"
68+
mode: 0600
69+
no_log: False
70+
when:
71+
- django_git_key_ssh_file is defined
72+
- django_git_key_ssh_file is not none
73+
6374
- name: Git clone with key
6475
git:
6576
accept_hostkey: "yes"

0 commit comments

Comments
 (0)