diff --git a/all.yml b/all.yml index b6765cb..c6dfd2e 100644 --- a/all.yml +++ b/all.yml @@ -36,3 +36,7 @@ - hosts: file-host tags: containers, file-host roles: [file-host] + +- hosts: homepage + tags: containers, homepage + roles: [homepage] diff --git a/roles/haproxy/templates/haproxy.cfg.j2 b/roles/haproxy/templates/haproxy.cfg.j2 index 794938e..790f569 100644 --- a/roles/haproxy/templates/haproxy.cfg.j2 +++ b/roles/haproxy/templates/haproxy.cfg.j2 @@ -41,7 +41,7 @@ frontend main {% endif %} {% endfor %} - default_backend gitea + default_backend homepage {% for c in groups['containers'] %} {# NOTE: don't add haproxy to list of containers :P #} diff --git a/roles/homepage/tasks/main.yml b/roles/homepage/tasks/main.yml new file mode 100644 index 0000000..78b0781 --- /dev/null +++ b/roles/homepage/tasks/main.yml @@ -0,0 +1,46 @@ +--- +- name: install packages + apk: + name: + - lighttpd + state: installed + +- vars: + block: + - name: start and enable lighttpd + service: + name: lighttpd + state: restarted + enabled: yes + + - name: add homepage user + user: + name: homepage + home: /var/www/localhost + password: '' + + - name: set homepage user as owner of http docroot + file: + path: /var/www/localhost + state: directory + recurse: yes + owner: homepage + group: homepage + + - name: add ssh path for homepage user + file: + path: /var/www/localhost/.ssh + state: directory + owner: homepage + group: homepage + mode: 0700 + + - name: copy ssh pubkey for homepage user + copy: + remote_src: yes + owner: homepage + group: homepage + src: /root/.ssh/authorized_keys + dest: /var/www/localhost/.ssh/authorized_keys + mode: 0600 +