Replace per-user htoprc with system-wide config

Also update to newer htoprc layout from BLSE.
This commit is contained in:
Joshua Boniface 2023-09-01 15:42:29 -04:00
parent 5a48ec4d79
commit a79961605a
3 changed files with 65 additions and 47 deletions

View File

@ -596,6 +596,14 @@
state: absent state: absent
tags: base-shell tags: base-shell
# htop
- name: install htop configuration
template:
src: "etc/htoprc.j2"
dest: "/etc/htoprc"
mode: 0644
tags: base-shell
# fail2ban # fail2ban
- name: install fail2ban configurations - name: install fail2ban configurations
template: template:
@ -741,11 +749,13 @@
- users - users
- user-root - user-root
- name: write htoprc to homedir - name: remove root htoprc
template: file:
src: var/home/user/config/htop/htoprc.j2 dest: "{{ item }}"
dest: /root/.htoprc state: absent
mode: 0600 loop:
- /root/.htoprc
- /root/.config/htop
tags: tags:
- users - users
- user-root - user-root
@ -960,25 +970,10 @@
- users - users
- user-admin - user-admin
- name: ensure htop config directory exists - name: remove user htop configuration directory
file: file:
dest: "/var/home/{{ item.name }}/.config/htop" dest: "/var/home/{{ item.name }}/.config/htop"
state: directory state: absent
owner: "{{ item.name }}"
group: operator
mode: 0755
with_items: "{{ admin_users }}"
tags:
- users
- user-admin
- name: write htoprc to homedir
template:
src: var/home/user/config/htop/htoprc.j2
dest: "/var/home/{{ item.name }}/.config/htop/htoprc"
owner: "{{ item.name }}"
group: operator
mode: 0644
with_items: "{{ admin_users }}" with_items: "{{ admin_users }}"
tags: tags:
- users - users

View File

@ -0,0 +1,48 @@
# htop configuration file (Debian)
# {{ ansible_managed }}
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
{% if debian_version|int >= 11 %}
sort_direction=0
{% else %}
sort_direction=1
{% endif %}
tree_sort_key=0
tree_sort_direction=1
hide_kernel_threads=0
hide_userland_threads=0
shadow_other_users=0
show_thread_names=1
show_program_path=1
highlight_base_name=1
highlight_megabytes=1
highlight_threads=1
highlight_changes=0
highlight_changes_delay_secs=5
find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=0
tree_view=0
tree_view_always_by_pid=0
header_margin=1
detailed_cpu_time=1
cpu_count_from_one=1
show_cpu_usage=1
show_cpu_frequency=1
show_cpu_temperature=1
degree_fahrenheit=0
update_process_names=1
account_guest_in_cpu_meter=1
color_scheme=0
enable_mouse=1
delay=10
left_meters=Hostname Clock Uptime Blank LeftCPUs2 Blank CPU Blank
left_meter_modes=2 2 2 2 1 2 1 2
{% if debian_version|int >= 11 %}
right_meters=LoadAverage Tasks Systemd Blank RightCPUs2 Blank Memory Swap
right_meter_modes=2 2 2 2 1 2 1 1
{% else %}
right_meters=LoadAverage Tasks Blank Blank RightCPUs2 Blank Memory Swap
right_meter_modes=2 2 2 2 1 2 1 1
{% endif %}
hide_function_bar=0

View File

@ -1,25 +0,0 @@
# htop config file
# {{ ansible_managed }}
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=0
hide_userland_threads=0
shadow_other_users=0
show_thread_names=1
highlight_base_name=1
highlight_megabytes=1
highlight_threads=1
tree_view=0
header_margin=1
detailed_cpu_time=1
cpu_count_from_zero=0
update_process_names=1
account_guest_in_cpu_meter=1
color_scheme=0
delay=15
left_meters=LeftCPUs2 Blank CPU Blank Blank Memory Swap
left_meter_modes=1 2 1 2 2 1 1
right_meters=RightCPUs2 Blank LoadAverage Tasks Blank Hostname Clock Uptime Blank
right_meter_modes=1 2 2 2 2 2 2 2 2