From d77e686d06916156700c5f298b5edb4ba3e9642b Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Wed, 24 Dec 2025 13:22:27 +0200 Subject: Improvements --- tasks/general.yml | 10 ++++++++++ tasks/jails_dataset.yml | 3 +++ tasks/jails_single.yml | 3 --- templates/etc_devfs.rules.j2 | 4 ++++ templates/etc_jail.conf.d_[jailname].conf.j2 | 10 ++++++++++ templates/etc_rc.conf.j2 | 1 + templates/root_bashrc | 7 +++++++ 7 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 templates/root_bashrc diff --git a/tasks/general.yml b/tasks/general.yml index b8d3f45..7643420 100644 --- a/tasks/general.yml +++ b/tasks/general.yml @@ -11,6 +11,8 @@ - python - py311-pip - vm-bhyve + - fastfetch + - drm-kmod - name: Set up periodic.conf template: @@ -142,3 +144,11 @@ - name: Run vm init shell: vm init + +- name: Install .bashrc + file: + src: templates/root_bashr + dest: /root/.bashrc + owner: root + group: wheel + mode: "0644" diff --git a/tasks/jails_dataset.yml b/tasks/jails_dataset.yml index c97e14a..3925a8c 100644 --- a/tasks/jails_dataset.yml +++ b/tasks/jails_dataset.yml @@ -45,6 +45,9 @@ cat /etc/resolv.conf > /usr/local/jails/templates/{{ dataset.userland }}/etc/resolv.conf chmod 644 /usr/local/jails/templates/{{ dataset.userland }}/etc/resolv.conf + - name: Disable resolvconf in the template + shell: echo 'resolvconf=NO' >> /usr/local/jails/templates/{{ dataset.userland }}/etc/resolvconf.conf + - name: Update userland to latest patch level shell: freebsd-update -b /usr/local/jails/templates/{{ dataset.userland }}/ fetch install diff --git a/tasks/jails_single.yml b/tasks/jails_single.yml index 274688b..3225d50 100644 --- a/tasks/jails_single.yml +++ b/tasks/jails_single.yml @@ -8,9 +8,6 @@ shell: zfs clone zroot/jails/templates/{{ jail.userland }}@base "zroot/jails/containers/{{ jail.name }}" when: check_jail_directory.rc != 0 -- name: Make resolv.conf immutable - shell: chflags schg /usr/local/jails/containers/{{ jail.name }}/etc/resolv.conf - - name: Configure jail.conf.d/{{ jail.name }}.conf template: src: etc_jail.conf.d_[jailname].conf.j2 diff --git a/templates/etc_devfs.rules.j2 b/templates/etc_devfs.rules.j2 index 4f0e186..531b767 100644 --- a/templates/etc_devfs.rules.j2 +++ b/templates/etc_devfs.rules.j2 @@ -65,6 +65,10 @@ add path 'fd/*' unhide add path stdin unhide add path stdout unhide add path stderr unhide +add path 'drm' unhide +add path 'drm/*' unhide +add path 'dri' unhide +add path 'dri/*' unhide [devfsrules_jail=4] add include $devfsrules_hide_all diff --git a/templates/etc_jail.conf.d_[jailname].conf.j2 b/templates/etc_jail.conf.d_[jailname].conf.j2 index b4ed513..d87439c 100644 --- a/templates/etc_jail.conf.d_[jailname].conf.j2 +++ b/templates/etc_jail.conf.d_[jailname].conf.j2 @@ -8,6 +8,7 @@ exec.prestart = "ifconfig epair{{ jail.num }}000 create || echo 'Failed to create epair{{ jail.num }}000'"; exec.prestart += "ifconfig epair{{ jail.num }}000a name epl{{ jail.num }}a"; exec.prestart += "ifconfig epair{{ jail.num }}000b name epl{{ jail.num }}b"; + exec.prestart += "ifconfig epl{{ jail.num }}b ether random"; exec.prestart += "ifconfig brlan0 addm epl{{ jail.num }}a"; {% if jail.name == "ingress" -%} exec.prestart += "ifconfig epair{{ jail.num }}001 create || echo 'Failed to create epair{{ jail.num }}001'"; @@ -38,6 +39,12 @@ exec.poststart += "mount -t nullfs /usr/local/jails/containers/goaccess/var/www/goaccess /usr/local/jails/containers/ingress/mnt/www_goaccess"; {% endif %} + {% if jail.name == "dl" -%} + exec.poststart += "jexec ${name} sh ~/random_tunnel.sh"; + {% elif jail.name == "plex" -%} + exec.poststart += "jexec ${name} sh ~/start_plex.sh"; + {% endif %} + exec.stop = "/bin/sh /etc/rc.shutdown"; exec.poststop += "ifconfig epl{{ jail.num }}a destroy"; @@ -57,6 +64,9 @@ devfs_ruleset = 5; {% elif jail.name == "ingress" -%} devfs_ruleset = 6; + {% elif jail.name == "dl" -%} + devfs_ruleset = 4; + allow.mlock; {% else %} devfs_ruleset = 4; {% endif %} diff --git a/templates/etc_rc.conf.j2 b/templates/etc_rc.conf.j2 index 5df2d7c..5158051 100644 --- a/templates/etc_rc.conf.j2 +++ b/templates/etc_rc.conf.j2 @@ -33,3 +33,4 @@ auditd_enable="YES" devd_enable="YES" vm_enable="YES" vm_dir="zfs:zroot/vm" +kld_list="if_wg i915kms" diff --git a/templates/root_bashrc b/templates/root_bashrc new file mode 100644 index 0000000..f580db6 --- /dev/null +++ b/templates/root_bashrc @@ -0,0 +1,7 @@ +HISTCONTROL=ignoredups:erasedups # no duplicate entries +HISTSIZE=100000 # big big history +HISTFILESIZE=100000 # big big history +shopt -s histappend # append to history, don't overwrite it + +# Save and reload the history after each command finishes +PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" -- cgit v1.3