From 7a0586a7df4b012451960b33c19495ed74860ef5 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Wed, 9 Feb 2022 13:07:09 -0500 Subject: [PATCH] add files user for file-host role --- all.yml | 2 +- roles/file-host/tasks/main.yml | 31 +++++++++++++++++++++++++++++++ roles/gitea/tasks/main.yml | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/all.yml b/all.yml index 6c78061..b6765cb 100644 --- a/all.yml +++ b/all.yml @@ -34,5 +34,5 @@ roles: [gitea] - hosts: file-host - tags: containers, file_host + tags: containers, file-host roles: [file-host] diff --git a/roles/file-host/tasks/main.yml b/roles/file-host/tasks/main.yml index 102fb4d..d86a43a 100644 --- a/roles/file-host/tasks/main.yml +++ b/roles/file-host/tasks/main.yml @@ -13,3 +13,34 @@ state: restarted enabled: yes + - name: add files user + user: + name: files + home: /var/www/localhost + password: '' + + - name: set files user as owner of http docroot + file: + path: /var/www/localhost + state: directory + recurse: yes + owner: files + group: files + + - name: add ssh path for files user + file: + path: /var/www/localhost/.ssh + state: directory + owner: files + group: files + mode: 0700 + + - name: copy ssh pubkey for files user + copy: + remote_src: yes + owner: files + group: files + src: /root/.ssh/authorized_keys + dest: /var/www/localhost/.ssh/authorized_keys + mode: 0600 + diff --git a/roles/gitea/tasks/main.yml b/roles/gitea/tasks/main.yml index 78bf5b4..d1c67ea 100644 --- a/roles/gitea/tasks/main.yml +++ b/roles/gitea/tasks/main.yml @@ -14,7 +14,7 @@ - name: patch gitea init script # see) https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/gitea/gitea.initd - - template: + template: src: templates/gitea.initd dest: /etc/init.d/gitea