aurbis access to /opt
This commit is contained in:
1 parent
26449924b8
commit
2dc4b4443a
7 files changed
+70
-23
No files matched your search
+11
-8
@@ -61,6 +61,13 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Update
|
- name: Update
|
||||||
include_tasks: tasks/install_docker_debian.yml
|
include_tasks: tasks/install_docker_debian.yml
|
||||||
|
- name: Aurbis access to /opt
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
remote_user: nerevar
|
||||||
|
tasks:
|
||||||
|
- import_tasks: tasks/aurbis.yml
|
||||||
|
tags: aurbis
|
||||||
- name: Add utility scripts
|
- name: Add utility scripts
|
||||||
hosts: all
|
hosts: all
|
||||||
become: true
|
become: true
|
||||||
@@ -110,14 +117,10 @@
|
|||||||
package:
|
package:
|
||||||
name: [rsync, curl, sqlite3]
|
name: [rsync, curl, sqlite3]
|
||||||
state: present
|
state: present
|
||||||
- name: Normalise /opt app ownership to root:aurbis (top dir only, not recursive)
|
- import_tasks: tasks/aurbis_tree.yml
|
||||||
file:
|
vars:
|
||||||
path: "/opt/{{ item }}"
|
tree_path: /opt/hoekveen.net
|
||||||
state: directory
|
tags: aurbis
|
||||||
owner: root
|
|
||||||
group: aurbis
|
|
||||||
mode: "0775"
|
|
||||||
loop: [nextcloud, hdwiki, gitea, authentik, drone, "hoekveen.net"]
|
|
||||||
- import_tasks: tasks/swapfile.yml
|
- import_tasks: tasks/swapfile.yml
|
||||||
tags: swap
|
tags: swap
|
||||||
- import_tasks: tasks/nextcloud.yml
|
- import_tasks: tasks/nextcloud.yml
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# Service data below the top level stays with whatever uid its container runs as.
|
||||||
|
- name: Let aurbis create services in /opt
|
||||||
|
file:
|
||||||
|
path: /opt
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: aurbis
|
||||||
|
mode: "02775"
|
||||||
|
- name: Give aurbis every /opt service directory
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: [find, /opt, -mindepth, "1", -maxdepth, "1", -type, d, "!", -name, containerd,
|
||||||
|
"!", "(", -group, aurbis, -perm, "-2070", ")",
|
||||||
|
-print, -exec, chgrp, aurbis, "{}", "+", -exec, chmod, g+rwxs, "{}", "+"]
|
||||||
|
register: aurbis_opt_dirs
|
||||||
|
changed_when: aurbis_opt_dirs.stdout != ""
|
||||||
|
- name: Give aurbis the top-level files of every /opt service
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: [find, /opt, -mindepth, "2", -maxdepth, "2", -type, f, "!", -path, "/opt/containerd/*",
|
||||||
|
"!", "(", -group, aurbis, -perm, -g+rw, ")",
|
||||||
|
-print, -exec, chgrp, aurbis, "{}", "+", -exec, chmod, g+rw, "{}", "+"]
|
||||||
|
register: aurbis_opt_files
|
||||||
|
changed_when: aurbis_opt_files.stdout != ""
|
||||||
|
- name: Keep /opt .env files from other users
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: [find, /opt, -mindepth, "2", -maxdepth, "2", -type, f, -name, .env, -perm, /o+rwx,
|
||||||
|
-print, -exec, chmod, o-rwx, "{}", "+"]
|
||||||
|
register: aurbis_opt_env
|
||||||
|
changed_when: aurbis_opt_env.stdout != ""
|
||||||
|
|
||||||
|
- name: Look up the docker group
|
||||||
|
getent:
|
||||||
|
database: group
|
||||||
|
key: docker
|
||||||
|
fail_key: false
|
||||||
|
- name: Let aurbis members run docker
|
||||||
|
user:
|
||||||
|
name: "{{ item }}"
|
||||||
|
groups: docker
|
||||||
|
append: true
|
||||||
|
loop: "{{ users | default([]) }}"
|
||||||
|
when: ansible_facts.getent_group.docker is not none
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
- name: Give aurbis write access to {{ tree_path }}
|
||||||
|
file:
|
||||||
|
path: "{{ tree_path }}"
|
||||||
|
state: directory
|
||||||
|
recurse: true
|
||||||
|
group: aurbis
|
||||||
|
mode: g+rwX
|
||||||
|
- name: Make {{ tree_path }} directories hand their group to new files
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "find {{ tree_path }} -type d ! -perm -g+s -print -exec chmod g+s {} +"
|
||||||
|
register: aurbis_tree_setgid
|
||||||
|
changed_when: aurbis_tree_setgid.stdout != ""
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: "{{ service_group | default('aurbis') }}"
|
group: "{{ service_group | default('aurbis') }}"
|
||||||
mode: "0775"
|
mode: "02775"
|
||||||
- name: Copy docker-compose file
|
- name: Copy docker-compose file
|
||||||
template:
|
template:
|
||||||
src: "{{ service_name }}/docker-compose.yml.j2"
|
src: "{{ service_name }}/docker-compose.yml.j2"
|
||||||
|
|||||||
@@ -46,15 +46,6 @@
|
|||||||
register: checkout_pull
|
register: checkout_pull
|
||||||
changed_when: "'updated' in checkout_pull.stdout"
|
changed_when: "'updated' in checkout_pull.stdout"
|
||||||
when: checkout_update | default(true)
|
when: checkout_update | default(true)
|
||||||
- name: Give aurbis write access to {{ checkout_repo }}
|
- import_tasks: aurbis_tree.yml
|
||||||
file:
|
vars:
|
||||||
path: "{{ checkout_dest }}"
|
tree_path: "{{ checkout_dest }}"
|
||||||
state: directory
|
|
||||||
recurse: true
|
|
||||||
group: aurbis
|
|
||||||
mode: g+rwX
|
|
||||||
- name: Make {{ checkout_repo }} directories hand their group to new files
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: "find {{ checkout_dest }} -type d ! -perm -g+s -print -exec chmod g+s {} +"
|
|
||||||
register: checkout_setgid
|
|
||||||
changed_when: checkout_setgid.stdout != ""
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: aurbis
|
group: aurbis
|
||||||
mode: "0775"
|
mode: "02775"
|
||||||
|
|
||||||
- name: Create mosquitto config directory
|
- name: Create mosquitto config directory
|
||||||
file:
|
file:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: aurbis
|
group: aurbis
|
||||||
mode: "0775"
|
mode: "02775"
|
||||||
|
|
||||||
# Song library. Read-only for nightingale.
|
# Song library. Read-only for nightingale.
|
||||||
# Keep this in sync with the /karaoke mount in nextcloud
|
# Keep this in sync with the /karaoke mount in nextcloud
|
||||||
|
|||||||
Reference in new issue
Block a user