Set up home server.

This commit is contained in:
Tom Alexander
2024-04-22 17:23:20 -04:00
parent f1b3e3a81f
commit 32eca75f4e
25 changed files with 398 additions and 54 deletions

View File

@@ -0,0 +1,55 @@
# - name: Create directories
# file:
# name: "{{ item }}"
# state: directory
# mode: 0755
# owner: root
# group: wheel
# loop:
# - /foo/bar
# - name: Install scripts
# copy:
# src: "files/{{ item.src }}"
# dest: "{{ item.dest }}"
# mode: 0755
# owner: root
# group: wheel
# loop:
# - src: foo.bash
# dest: /usr/local/bin/foo
# - name: Install Configuration
# copy:
# src: "files/{{ item.src }}"
# dest: "{{ item.dest }}"
# mode: 0600
# owner: root
# group: wheel
# loop:
# - src: foo.conf
# dest: /usr/local/etc/foo.conf
# - name: Clone Source
# git:
# repo: "https://foo.bar/baz.git"
# dest: /foo/bar
# version: "v1.0.2"
# force: true
# diff: false
- 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 }}"
when: users is defined
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
loop_control:
loop_var: initialize_user

View File

@@ -0,0 +1,32 @@
# FreeBSD 14 added support for terminfo, so I'm leaving the termcap stuff commented out in case I need it.
# - name: See if the alacritty termcap has been added
# lineinfile:
# name: /usr/share/misc/termcap
# regexp: |-
# ^alacritty\|
# state: absent
# check_mode: false
# changed_when: false
# register: alacritty_cap
# # Termcap generated by:
# # cat <(infocmp -Cr alacritty) <(infocmp -Cr alacritty-direct)
# - 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: Append alacritty terminfo
command: "tic -xe alacritty,alacritty-direct -"
args:
creates: "/usr/share/terminfo/a/alacritty-direct"
# Also creates: "/usr/share/terminfo/a/alacritty"
stdin: "{{ lookup('file', 'files/alacritty.info') }}"

View File

@@ -0,0 +1,29 @@
# - name: Build aur packages
# register: buildaur
# become_user: "{{ build_user.name }}"
# command: "aurutils-sync --no-view {{ item }}"
# args:
# creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
# loop:
# - foo
# - name: Update cache
# when: buildaur.changed
# pacman:
# name: []
# state: present
# update_cache: true
# - name: Install packages
# package:
# name:
# - foo
# state: present
# - name: Enable services
# systemd:
# enabled: yes
# name: "{{ item }}"
# daemon_reload: yes
# loop:
# - foo.service

View File

@@ -0,0 +1,2 @@
- import_tasks: tasks/common.yaml
# when: foo is defined

View File

@@ -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"'