From ea38d38d0632d6552b0782157ad45a25e81becce Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Fri, 20 Mar 2020 00:05:07 +0100 Subject: [PATCH] Attempt to run ansible pre-deploy steps --- ansible/pre-deploy.yml | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/ansible/pre-deploy.yml b/ansible/pre-deploy.yml index eb7e847..9ddd6e4 100644 --- a/ansible/pre-deploy.yml +++ b/ansible/pre-deploy.yml @@ -1,5 +1,42 @@ --- - hosts: all tasks: - - name: Echo test - shell: echo 'pre-deploy!' + - name: Setup host Gitea group + group: + name: gitea + system: true + state: present + + - name: Setup host Gitea user + user: + name: gitea + comment: gitea user + create_home: true + home: /var/lib/gitea + group: gitea + system: true + state: present + generate_ssh_key: true + ssh_key_bits: 2048 + ssh_key_file: .ssh/id_rsa + + - name: Get uid/guid of the gitea user + getent: + database: passwd + key: gitea + split: ":" + + - name: Store gitea git user uid/guid + set_fact: + gitea_user_uid: "{{ getent_passwd['gitea'][1] }}" + gitea_user_guid: "{{ getent_passwd['gitea'][2] }}" + + - name: Configure the dokku app environment + dokku_config: + app: gitea + restart: false + config: + USER_GID: "{{ gitea_user_guid }}" + USER_UID: "{{ gitea_user_uid }}" + become: true + become_user: dokku