diff options
author | Aaron LI <aly@aaronly.me> | 2018-05-14 13:09:34 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-05-14 13:09:34 +0800 |
commit | 3c47dcd8060626f351b9bc1a0cff34a4c4c79ac1 (patch) | |
tree | f42f19df3637bbb73f1bc24c6dc5ecaa77eb95a2 | |
parent | c8dc9e163b50272bf8e3972c8ef37ea3e871b247 (diff) | |
download | ansible-dfly-vps-3c47dcd8060626f351b9bc1a0cff34a4c4c79ac1.tar.bz2 |
git: update github keyname to be keyfile to the full path to the key
-rw-r--r-- | group_vars/all/vars.yml | 2 | ||||
-rw-r--r-- | roles/git/tasks/main.yml | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 5c7cead..f1ce97f 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -199,7 +199,7 @@ git: user: liweitianux api: "https://api.github.com" url: "git@github.com" - keyname: "github.key" + keyfile: "{{ playbook_dir }}/private/ssh/github.key" keytype: ed25519 # Export public repositories cgit: diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 5348810..caf04f8 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -48,7 +48,7 @@ - name: (local) github sync - check ssh key existence become: false stat: - path: "{{ playbook_dir }}/private/git/{{ git.github.keyname }}" + path: "{{ git.github.keyfile }}" delegate_to: localhost register: stat_result @@ -56,7 +56,7 @@ become: false command: > ssh-keygen -t ed25519 -C "git:github-sync" -N "" - -f "{{ playbook_dir }}/private/git/{{ git.github.keyname }}" + -f "{{ git.github.keyfile }}" delegate_to: localhost when: not stat_result.stat.exists @@ -70,7 +70,7 @@ - name: github sync - copy public key to the server copy: - src: "{{ playbook_dir }}/private/git/{{ git.github.keyname }}" + src: "{{ git.github.keyfile }}" dest: "{{ git.user.home }}/.ssh/id_{{ git.github.keytype }}" owner: "{{ git.user.name }}" mode: 0400 |