machine_setup/ansible/roles/base/tasks/freebsd.yaml
2022-11-28 23:05:46 -05:00

162 lines
3.4 KiB
YAML

- name: Install packages
package:
name:
- pstree
- gsed
state: present
- name: See if the alacritty termcap has been added
lineinfile:
name: /usr/share/misc/termcap
regexp: |-
^alacritty\|
state: absent
check_mode: yes
changed_when: false
register: alacritty_cap
- name: Append alacritty termcap info
blockinfile:
path: /usr/share/misc/termcap
block: "{{ lookup('file', 'alacritty.termcap') }}"
marker: "# {mark} ANSIBLE MANAGED BLOCK alacritty"
when: not alacritty_cap.found
register: wrote_alacritty_cap
- name: Update cap_mkdb
command: cap_mkdb /usr/share/misc/termcap
when: wrote_alacritty_cap.changed
- name: Install login.conf
copy:
src: login.conf
dest: /etc/login.conf
owner: root
group: wheel
mode: 0644
register: login_config
- name: Update cap_mkdb
command: cap_mkdb /etc/login.conf
when: login_config.changed
- name: Enable periodic scrub
community.general.sysrc:
name: daily_scrub_zfs_enable
value: "YES"
path: /etc/periodic.conf.local
- name: Set scrub interval
community.general.sysrc:
name: daily_scrub_zfs_default_threshold
value: "7"
path: /etc/periodic.conf.local
- name: Install loader.conf
copy:
src: "{{loader_conf}}"
dest: /boot/loader.conf
owner: root
group: wheel
mode: 0644
when: loader_conf is defined
- name: Delete loader.conf
file:
path: /boot/loader.conf
state: absent
when: loader_conf is not defined
- name: Install rc.conf
copy:
src: "{{rc_conf}}"
dest: /etc/rc.conf
mode: 0644
owner: root
group: wheel
when: rc_conf is defined
- name: Delete rc.conf
file:
path: /etc/rc.conf
state: absent
when: rc_conf is not defined
- name: Add fstab entries
mount:
name: "{{ item.dst }}"
src: "{{ item.src }}"
fstype: "{{ item.fstype }}"
opts: "{{ item.opts }}"
state: present
loop:
- dst: /tmp
src: tmpfs
fstype: tmpfs
opts: rw,mode=777
- name: Add fstab entries
when: efi_dev is defined
mount:
name: "{{ item.dst }}"
src: "{{ item.src }}"
fstype: "{{ item.fstype }}"
opts: "{{ item.opts }}"
state: present
loop:
- dst: /boot/efi
src: "{{ efi_dev }}"
fstype: msdosfs
opts: rw
- name: Install scripts
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
owner: root
group: wheel
loop:
- src: bemount.bash
dest: /usr/local/bin/bemount
- name: Install rc script
copy:
src: "files/{{ item.src }}"
dest: "/usr/local/etc/rc.d/{{ item.dest|default(item.src) }}"
owner: root
group: wheel
mode: 0755
loop:
- src: bemount_rc.sh
dest: bemount
- name: Enable bemount
community.general.sysrc:
name: bemount_enable
value: "YES"
path: /etc/rc.conf.d/bemount
- name: Install loader.conf
copy:
src: "files/{{ item }}_loader.conf"
dest: "/boot/loader.conf.d/{{ item }}.conf"
mode: 0644
owner: root
group: wheel
loop:
- disk_labels
- name: Configure sysctls
when: sound_default_unit is defined
sysctl:
name: "{{ item.name }}"
value: "{{ item.value }}"
state: present
sysctl_file: "/etc/sysctl.conf.local"
# Disabling loading the sysctl because the unit does not exist when not docked.
reload: false
loop:
- name: hw.snd.default_unit
value: "{{ sound_default_unit }}"