SHA256
1
0

Compare commits

...

2 Commits

Author SHA256 Message Date
f2ce25bfca Add symlink support 2025-12-14 21:19:13 -05:00
201543a9c4 Add pwrstatd config 2025-12-14 19:48:17 -05:00
5 changed files with 234 additions and 160 deletions

View File

@@ -5,6 +5,8 @@
}
],
"settings": {
"ansible.python.interpreterPath": "/home/bryan/.virtualenvs/deploy/bin/python"
}
"ansible.python.interpreterPath": "/home/bryan/.virtualenvs/deploy/bin/python",
"search.followSymlinks": false,
},
}

View File

@@ -0,0 +1,8 @@
# see `man dnf.conf` for defaults and possible options
[main]
# installonly_limit=3
# best=False
skip_if_unavailable=True
deltarpm=True
fastestmirror=True

View File

@@ -0,0 +1,131 @@
#
# pwrstatd configuration file
#
# You must restart pwrstatd after changing this file in order for changes to take effect.
# Ex:/etc/init.d/pwrstatd restart
#
# Action setting for event of Power Failure
#
# A delay time in seconds since event of Power Failure occur then to run shell
# script and shutdown system. Allowed range is 0 ~ 3600. Default is 60 sec.
powerfail-delay = 60
# Enable to run shell script when the event of Power Failure occur.
# The allowed options are yes and no. Default is yes.
powerfail-active = no
# Assign a path of script file for event of Power Failure.
# The default is /etc/pwrstatd-powerfail.sh
powerfail-cmd-path = /etc/pwrstatd-powerfail.sh
# How much time in seconds to take script running for event of Power Failure.
# The allowed range is 0 ~ 3600. Default is 0 sec.
powerfail-duration = 0
# Allow Daemon to shutdown system for event of Power Failure.
# The allowed options are yes and no. Default is yes.
powerfail-shutdown = no
#
# Action setting for event of Battery Low
#
# A threshold of Battery Capacity, If the battery capacity is lower than this
# value and a event of Battery Low will be identified. The unit is percentage.
# The allowed range is 0 ~ 90. Default is 35 %.
lowbatt-threshold = 10
# A threshold of Remaining Runtime, If the Remaining Runtime is lower than this
# value and a event of Battery Low will be identified. The unit is second.
# The allowed range is 0 ~ 3600. Default is 300 sec.
# Note: When meet this condition the below 'shutdown-sustain' property
# will be ignored.
runtime-threshold = 180
# Enable to run shell script when the event of Battery Low occur.
# The allowed options are yes and no. Default is yes.
lowbatt-active = no
# Assign a path of script file for event of Battery Low.
# The default is /etc/pwrstatd-lowbatt.sh
lowbatt-cmd-path = /etc/pwrstatd-lowbatt.sh
# How much time in seconds to take script running for event of Battery Low.
# The allowed range is 0 ~ 60. Default is 0 sec.
lowbatt-duration = 0
# Allow Daemon to shutdown system for event of Battery Low.
# The allowed options are yes and no. Default is yes.
lowbatt-shutdown = yes
# Turn UPS alarm on or off.
# The allowed options are yes and no. Default is yes.
enable-alarm = yes
# The necessary time in seconds for system shutdown.
# The UPS will turn power off when this time is expired.
# The allowed range is 0 ~ 3600. Default is 600 sec.(10 min.)
# If the computer shutdown is cause by low runtime condition, the UPS will
# turn power off when the time is expired that time is assigned on
# 'runtime-threshold' property and it is no longer to refer the
# 'shutdown-sustain' property.
shutdown-sustain = 0
# Daemon will turn UPS power off once it ask system shutdown cause by a power
# event. Allowed options are yes and no. Default is yes.
turn-ups-off = no
# The period of polling UPS in seconds.
# The allowed range is 1 ~ 60. Default is 3 sec.
ups-polling-rate = 5
# the period of re-try to find available UPS in seconds since find nothing at
# last time. The allowed range is 1 ~ 300. Default is 10 sec.
ups-retry-rate = 10
# Prohibiting daemon to provide communication mechanism for client, such as
# pwrstat command. normally, it should be 'no'. It can be 'yes' if any security
# consideration. Allowed options are yes and no. Default is no.
prohibit-client-access = no
# The pwrstatd accepts four types of device node which includes the 'ttyS',
# 'ttyUSB', 'hiddev', and 'libusb' for communication with UPS. The pwrstatd
# defaults to enumerate all acceptable device nodes and pick up to use an
# available device node automatically. But this may cause a disturbance to the
# device node which is occupied by other software. Therefore, you can restrict
# this enumerate behave by using allowed-device-nodes option. You can assign
# the single device node path or multiple device node paths divided by a
# semicolon at this option. All groups of 'ttyS', 'ttyUSB', 'hiddev', or
# 'libusb' device node are enumerated without a suffix number assignment.
# Note, the 'libusb' does not support suffix number only.
#
# For example: restrict to use ttyS1, ttyS2 and hiddev1 device nodes at /dev
# path only.
# allowed-device-nodes = /dev/ttyS1;/dev/ttyS2;/dev/hiddev1
#
# For example: restrict to use ttyS and ttyUSB two groups of device node at
# /dev,/dev/usb, and /dev/usb/hid paths(includes ttyS0 to ttySN and ttyUSB0 to
# ttyUSBN, N is number).
# allowed-device-nodes = ttyS;ttyUSB
#
# For example: restrict to use hiddev group of device node at /dev,/dev/usb,
# and /dev/usb/hid paths(includes hiddev0 to hiddevN, N is number).
# allowed-device-nodes = hiddev
#
# For example: restrict to use libusb device.
# allowed-device-nodes = libusb
allowed-device-nodes =
# Daemon will hibernate system to instead of system shutdown when power
# event occur. Allowed options are yes and no. Default is no.
hibernate = no
# Enable cloud solution.
# The allowed options are yes and no. Default is no.
cloud-active = no
# Account for cloud server login.
cloud-account =

View File

@@ -0,0 +1,20 @@
---
symlinks:
- name: develop
src: "{{ lookup('env', 'HOME') }}/documents/develop"
dest: "{{ lookup('env', 'HOME') }}/develop"
- name: music
src: "{{ lookup('env', 'HOME') }}/media/music"
dest: "{{ lookup('env', 'HOME') }}/music"
- name: pictures
src: "{{ lookup('env', 'HOME') }}/media/pictures"
dest: "{{ lookup('env', 'HOME') }}/pictures"
- name: videos
src: "{{ lookup('env', 'HOME') }}/media/videos"
dest: "{{ lookup('env', 'HOME') }}/videos"
- name: ebooks
src: "{{ lookup('env', 'HOME') }}/media/ebooks"
dest: "{{ lookup('env', 'HOME') }}/ebooks"
- name: bin
src: "{{ lookup('env', 'HOME') }}/.local/bin"
dest: "{{ lookup('env', 'HOME') }}/bin"

View File

@@ -1,202 +1,115 @@
---
- name: Find common home dotfiles (excluding templates)
- name: Find home dotfiles (excluding templates)
ansible.builtin.find:
paths: "{{ playbook_dir }}/dotfiles/common/home"
paths:
- "{{ playbook_dir }}/dotfiles/common/home"
- "{{ playbook_dir }}/dotfiles/{{ group_names[0] }}/home"
recurse: true
file_type: file
hidden: true
excludes: "*.j2"
delegate_to: localhost
register: dotfiles_common_home_files
register: dotfiles_home_files
run_once: true
ignore_errors: true
- name: Find common root dotfiles (excluding templates)
- name: Find root dotfiles (excluding templates)
ansible.builtin.find:
paths: "{{ playbook_dir }}/dotfiles/common/root"
paths:
- "{{ playbook_dir }}/dotfiles/common/root"
- "{{ playbook_dir }}/dotfiles/{{ group_names[0] }}/root"
recurse: true
file_type: file
hidden: true
excludes: "*.j2"
delegate_to: localhost
register: dotfiles_common_root_files
register: dotfiles_root_files
run_once: true
ignore_errors: true
- name: Find group home dotfiles (excluding templates)
- name: Find home template files
ansible.builtin.find:
paths: "{{ playbook_dir }}/dotfiles/{{ item }}/home"
recurse: true
file_type: file
hidden: true
excludes: "*.j2"
loop: "{{ group_names | default([]) }}"
delegate_to: localhost
register: dotfiles_group_home_files
run_once: true
ignore_errors: true
- name: Find group root dotfiles (excluding templates)
ansible.builtin.find:
paths: "{{ playbook_dir }}/dotfiles/{{ item }}/root"
recurse: true
file_type: file
hidden: true
excludes: "*.j2"
loop: "{{ group_names | default([]) }}"
delegate_to: localhost
register: dotfiles_group_root_files
run_once: true
ignore_errors: true
- name: Deploy common home dotfiles (remote)
ansible.builtin.copy:
src: "{{ item.path }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.path | replace(playbook_dir + '/dotfiles/common/home/', '') }}"
mode: preserve
loop: "{{ dotfiles_common_home_files.files }}"
when: ansible_connection not in ['local', 'localhost']
- name: Deploy common root dotfiles (remote)
ansible.builtin.copy:
src: "{{ item.path }}"
dest: "/{{ item.path | replace(playbook_dir + '/dotfiles/common/root/', '') }}"
mode: preserve
loop: "{{ dotfiles_common_root_files.files }}"
when: ansible_connection not in ['local', 'localhost']
become: true
- name: Deploy group home dotfiles (remote)
ansible.builtin.copy:
src: "{{ item.1.path }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.1.path | replace(playbook_dir + '/dotfiles/' + item.0.item + '/home/', '') }}"
mode: preserve
loop: "{{ dotfiles_group_home_files.results | subelements('files', skip_missing=True) }}"
when: ansible_connection not in ['local', 'localhost']
- name: Deploy group root dotfiles (remote)
ansible.builtin.copy:
src: "{{ item.1.path }}"
dest: "/{{ item.1.path | replace(playbook_dir + '/dotfiles/' + item.0.item + '/root/', '') }}"
mode: preserve
loop: "{{ dotfiles_group_root_files.results | subelements('files', skip_missing=True) }}"
when: ansible_connection not in ['local', 'localhost']
become: true
- name: Symlink common home dotfiles (local)
ansible.builtin.file:
src: "{{ item.path }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.path | replace((playbook_dir + '/dotfiles/common/home/'), '') }}"
state: link
force: true
loop: "{{ dotfiles_common_home_files.files }}"
when: ansible_connection in ['local', 'localhost']
- name: Symlink common root dotfiles (local)
ansible.builtin.file:
src: "{{ item.path }}"
dest: "/{{ item.path | replace((playbook_dir + '/dotfiles/common/root/'), '') }}"
state: link
force: true
loop: "{{ dotfiles_common_root_files.files }}"
when: ansible_connection in ['local', 'localhost']
become: true
- name: Symlink group home dotfiles (local)
ansible.builtin.file:
src: "{{ item.1.path }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.1.path | replace((playbook_dir + '/dotfiles/' + item.0.item + '/home/'), '') }}"
state: link
force: true
loop: "{{ dotfiles_group_home_files.results | subelements('files', skip_missing=True) }}"
when: ansible_connection in ['local', 'localhost']
- name: Symlink group root dotfiles (local)
ansible.builtin.file:
src: "{{ item.1.path }}"
dest: "/{{ item.1.path | replace((playbook_dir + '/dotfiles/' + item.0.item + '/root/'), '') }}"
state: link
force: true
loop: "{{ dotfiles_group_root_files.results | subelements('files', skip_missing=True) }}"
when: ansible_connection in ['local', 'localhost']
become: true
- name: Find template files in common home dotfiles
ansible.builtin.find:
paths: "{{ playbook_dir }}/dotfiles/common/home"
paths:
- "{{ playbook_dir }}/dotfiles/common/home"
- "{{ playbook_dir }}/dotfiles/{{ group_names[0] }}/home"
recurse: true
file_type: file
hidden: true
patterns: "*.j2"
delegate_to: localhost
register: dotfiles_common_home_templates
register: dotfiles_home_templates
run_once: true
ignore_errors: true
- name: Find template files in common root dotfiles
- name: Find root template files
ansible.builtin.find:
paths: "{{ playbook_dir }}/dotfiles/common/root"
paths:
- "{{ playbook_dir }}/dotfiles/common/root"
- "{{ playbook_dir }}/dotfiles/{{ group_names[0] }}/root"
recurse: true
file_type: file
hidden: true
patterns: "*.j2"
delegate_to: localhost
register: dotfiles_common_root_templates
register: dotfiles_root_templates
run_once: true
ignore_errors: true
- name: Find template files in group home dotfiles
ansible.builtin.find:
paths: "{{ playbook_dir }}/dotfiles/{{ item }}/home"
recurse: true
file_type: file
hidden: true
patterns: "*.j2"
loop: "{{ group_names | default([]) }}"
delegate_to: localhost
register: dotfiles_group_home_templates
run_once: true
ignore_errors: true
- name: Find template files in group root dotfiles
ansible.builtin.find:
paths: "{{ playbook_dir }}/dotfiles/{{ item }}/root"
recurse: true
file_type: file
hidden: true
patterns: "*.j2"
loop: "{{ group_names | default([]) }}"
delegate_to: localhost
register: dotfiles_group_root_templates
run_once: true
ignore_errors: true
- name: Template common home dotfiles
ansible.builtin.template:
- name: Symlink home dotfiles (local)
ansible.builtin.file:
src: "{{ item.path }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.path | replace(playbook_dir + '/dotfiles/common/home/', '') | replace('.j2', '') }}"
mode: '0600'
loop: "{{ dotfiles_common_home_templates.files }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.path | regex_replace('^.+/dotfiles/(?:common|' + group_names[0] + ')/home/', '') }}"
state: link
force: true
loop: "{{ dotfiles_home_files.files }}"
when: ansible_connection in ['local', 'localhost']
- name: Template common root dotfiles
ansible.builtin.template:
- name: Symlink root dotfiles (local)
ansible.builtin.file:
src: "{{ item.path }}"
dest: "/{{ item.path | replace(playbook_dir + '/dotfiles/common/root/', '') | replace('.j2', '') }}"
mode: '0600'
loop: "{{ dotfiles_common_root_templates.files }}"
dest: "/{{ item.path | regex_replace('^.+/dotfiles/(?:common|' + group_names[0] + ')/root/', '') }}"
state: link
force: true
loop: "{{ dotfiles_root_files.files }}"
when: ansible_connection in ['local', 'localhost']
become: true
- name: Template group home dotfiles
ansible.builtin.template:
src: "{{ item.1.path }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.1.path | replace(playbook_dir + '/dotfiles/' + item.0.item + '/home/', '') | replace('.j2', '') }}"
mode: '0600'
loop: "{{ dotfiles_group_home_templates.results | subelements('files', skip_missing=True) }}"
- name: Deploy home dotfiles (remote)
ansible.builtin.copy:
src: "{{ item.path }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.path | regex_replace('^.+/dotfiles/(?:common|' + group_names[0] + ')/home/', '') }}"
mode: preserve
loop: "{{ dotfiles_home_files.files }}"
when: ansible_connection not in ['local', 'localhost']
- name: Template group root dotfiles
ansible.builtin.template:
src: "{{ item.1.path }}"
dest: "/{{ item.1.path | replace(playbook_dir + '/dotfiles/' + item.0.item + '/root/', '') | replace('.j2', '') }}"
mode: '0600'
loop: "{{ dotfiles_group_root_templates.results | subelements('files', skip_missing=True) }}"
- name: Deploy root dotfiles (remote)
ansible.builtin.copy:
src: "{{ item.path }}"
dest: "/{{ item.path | regex_replace('^.+/dotfiles/(?:common|' + group_names[0] + ')/root/', '') }}"
mode: preserve
loop: "{{ dotfiles_root_files.files }}"
when: ansible_connection not in ['local', 'localhost']
become: true
- name: Template home dotfiles
ansible.builtin.template:
src: "{{ item.path }}"
dest: "{{ ansible_facts['env']['HOME'] }}/{{ item.path | regex_replace('^.+/dotfiles/(?:common|' + group_names[0] + ')/home/', '') | replace('.j2', '') }}"
mode: '0600'
loop: "{{ dotfiles_home_templates.files }}"
- name: Template root dotfiles
ansible.builtin.template:
src: "{{ item.path }}"
dest: "/{{ item.path | regex_replace('^.+/dotfiles/(?:common|' + group_names[0] + ')/root/', '') | replace('.j2', '') }}"
mode: '0600'
loop: "{{ dotfiles_root_templates.files }}"
become: true
- name: Deploy symlinks
ansible.builtin.file:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
state: link
force: true
loop: "{{ symlinks | default([]) }}"