diff --git a/ansible/playbook.yaml b/ansible/playbook.yaml index fb1182f..f6d0dec 100644 --- a/ansible/playbook.yaml +++ b/ansible/playbook.yaml @@ -2,25 +2,26 @@ vars: ansible_become: True roles: - - sudo - - users - - package_manager - - zrepl - - zsh - - network - - sshd - - base - - firewall - - cpu - - ntp - - build - - graphics - - gpg - - fonts - - alacritty - - sway - - emacs - - firefox - - devfs - - ssh_client - - jail + # - sudo + # - users + # - package_manager + # - zrepl + # - zsh + # - network + # - sshd + # - base + # - firewall + # - cpu + # - ntp + # - build + # - graphics + # - gpg + # - fonts + # - alacritty + # - sway + # - emacs + # - firefox + # - devfs + # - ssh_client + # - jail + - autofs diff --git a/ansible/roles/autofs/files/auto_master b/ansible/roles/autofs/files/auto_master new file mode 100644 index 0000000..72bedfe --- /dev/null +++ b/ansible/roles/autofs/files/auto_master @@ -0,0 +1,11 @@ +# $FreeBSD$ +# +# Automounter master map, see auto_master(5) for details. +# +/net -hosts -nobrowse,nosuid,intr +# When using the -media special map, make sure to edit devd.conf(5) +# to move the call to "automount -c" out of the comments section. +/media -media -nosuid,noatime,autoro +#/- -noauto + +# /mtp -simple-mtpfs -allow_other diff --git a/ansible/roles/autofs/files/autofs_devd.conf b/ansible/roles/autofs/files/autofs_devd.conf new file mode 100644 index 0000000..e1e2c97 --- /dev/null +++ b/ansible/roles/autofs/files/autofs_devd.conf @@ -0,0 +1,6 @@ +# Discard autofs caches, useful for the -media special map. +notify 100 { + match "system" "GEOM"; + match "subsystem" "DEV"; + action "/usr/sbin/automount -c"; +}; diff --git a/ansible/roles/autofs/files/autofs_loader.conf b/ansible/roles/autofs/files/autofs_loader.conf new file mode 100644 index 0000000..2a85905 --- /dev/null +++ b/ansible/roles/autofs/files/autofs_loader.conf @@ -0,0 +1 @@ +autofs_load=YES diff --git a/ansible/roles/autofs/files/automount_rc.conf b/ansible/roles/autofs/files/automount_rc.conf new file mode 100644 index 0000000..302cc36 --- /dev/null +++ b/ansible/roles/autofs/files/automount_rc.conf @@ -0,0 +1 @@ +autofs_enable="YES" diff --git a/ansible/roles/autofs/tasks/common.yaml b/ansible/roles/autofs/tasks/common.yaml new file mode 100644 index 0000000..d7c1735 --- /dev/null +++ b/ansible/roles/autofs/tasks/common.yaml @@ -0,0 +1,14 @@ +- import_tasks: tasks/freebsd.yaml + when: 'os_flavor == "freebsd"' + +- import_tasks: tasks/linux.yaml + when: 'os_flavor == "linux"' + +- include_tasks: + file: tasks/peruser.yaml + apply: + become: yes + become_user: "{{ initialize_user }}" + loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}" + loop_control: + loop_var: initialize_user diff --git a/ansible/roles/autofs/tasks/freebsd.yaml b/ansible/roles/autofs/tasks/freebsd.yaml new file mode 100644 index 0000000..f5c8cae --- /dev/null +++ b/ansible/roles/autofs/tasks/freebsd.yaml @@ -0,0 +1,50 @@ +- name: Install service configuration + copy: + src: "files/{{ item }}_rc.conf" + dest: "/etc/rc.conf.d/{{ item }}" + mode: 0644 + owner: root + group: wheel + loop: + - automount + +- name: Install Configuration + copy: + src: "files/{{ item.src }}" + dest: "{{ item.dest }}" + mode: 0644 + owner: root + group: wheel + loop: + - src: auto_master + dest: /etc/auto_master + +- name: Install loader.conf + copy: + src: "files/{{ item }}_loader.conf" + dest: "/boot/loader.conf.d/{{ item }}.conf" + mode: 0644 + owner: root + group: wheel + loop: + - autofs + +- name: Create directories + file: + name: "{{ item }}" + state: directory + mode: 0755 + owner: root + group: wheel + loop: + - /usr/local/etc/devd + +- name: Install devd Configuration + copy: + src: "files/{{ item.src }}_devd.conf" + dest: "/usr/local/etc/devd/{{ item.dest|default(item.src) }}.conf" + mode: 0644 + owner: root + group: wheel + loop: + - src: autofs diff --git a/ansible/roles/autofs/tasks/linux.yaml b/ansible/roles/autofs/tasks/linux.yaml new file mode 100644 index 0000000..e1835f0 --- /dev/null +++ b/ansible/roles/autofs/tasks/linux.yaml @@ -0,0 +1,6 @@ +# - name: Install packages +# pacman: +# name: +# - foo +# state: present +# update_cache: true diff --git a/ansible/roles/autofs/tasks/main.yaml b/ansible/roles/autofs/tasks/main.yaml new file mode 100644 index 0000000..5c1df6c --- /dev/null +++ b/ansible/roles/autofs/tasks/main.yaml @@ -0,0 +1 @@ +- import_tasks: tasks/common.yaml diff --git a/ansible/roles/autofs/tasks/peruser.yaml b/ansible/roles/autofs/tasks/peruser.yaml new file mode 100644 index 0000000..111e886 --- /dev/null +++ b/ansible/roles/autofs/tasks/peruser.yaml @@ -0,0 +1,29 @@ +- include_role: + name: per_user + +# - name: Create directories +# file: +# name: "{{ account_homedir.stdout }}/{{ item }}" +# state: directory +# mode: 0700 +# owner: "{{ account_name.stdout }}" +# group: "{{ group_name.stdout }}" +# loop: +# - ".config/foo" + +# - name: Copy files +# copy: +# src: "files/{{ item.src }}" +# dest: "{{ account_homedir.stdout }}/{{ item.dest }}" +# mode: 0600 +# owner: "{{ account_name.stdout }}" +# group: "{{ group_name.stdout }}" +# loop: +# - src: foo.conf +# dest: .config/foo/foo.conf + +- import_tasks: tasks/peruser_freebsd.yaml + when: 'os_flavor == "freebsd"' + +- import_tasks: tasks/peruser_linux.yaml + when: 'os_flavor == "linux"' diff --git a/ansible/roles/autofs/tasks/peruser_freebsd.yaml b/ansible/roles/autofs/tasks/peruser_freebsd.yaml new file mode 100644 index 0000000..e69de29 diff --git a/ansible/roles/autofs/tasks/peruser_linux.yaml b/ansible/roles/autofs/tasks/peruser_linux.yaml new file mode 100644 index 0000000..e69de29