From 0cc68fea6d0c08e0046c889a3d7f65a82038e129 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Mon, 23 Mar 2020 18:07:49 +0100 Subject: [PATCH] Wire up the SSH passthrough --- ansible/post-deploy.yml | 12 ++++++++++++ ansible/templates/gitea.j2 | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ansible/post-deploy.yml b/ansible/post-deploy.yml index 67856e4..78cf587 100644 --- a/ansible/post-deploy.yml +++ b/ansible/post-deploy.yml @@ -41,7 +41,19 @@ - "https:443:3000" state: present + - name: Ensure jq package is installed + apt: + name: jq + state: present + + - name: Retrieve application container IP address + shell: "dokku ps:inspect gitea | jq .[0].NetworkSettings.IPAddress" + register: dokku_container_ip + - name: Symlink the authorized keys configuration + vars: + ssh_listen_port: "{{ ssh_listen_port }}" + dokku_container_ip: "{{ dokku_container_ip }}" file: src: /var/lib/gitea/git/.ssh/authorized_keys dest: /home/git/.ssh/authorized_keys diff --git a/ansible/templates/gitea.j2 b/ansible/templates/gitea.j2 index 40c7581..414f8bc 100755 --- a/ansible/templates/gitea.j2 +++ b/ansible/templates/gitea.j2 @@ -1,2 +1,2 @@ #!/bin/sh -ssh -p $GIT_SSH_PORT -o StrictHostKeyChecking=no git@127.0.0.1 "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@" +ssh -p {{ ssh_listen_port }} -o StrictHostKeyChecking=no git@{{ dokku_container_ip }} "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"