Attempt to run ansible pre-deploy steps

This commit is contained in:
Luke Murphy 2020-03-20 00:05:07 +01:00
parent b626f5eb97
commit ea38d38d06
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 39 additions and 2 deletions

View File

@ -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