Save Battery Life (#32)
* Added parameters (also made the script more of a program). * Add additional options for unplugged devices. * Allow disabling of cron jobs and lowering of telegraf frequency through new config options. * Fix cron package name. * Fix ssh service name for Ubuntu. * Add output to the options so user knows they were switched. * Prevent some tasks when device is mobile. * Enhance and add to comments. * Add function to check flatpak app disk usage. * Add repair into flatpak commands to help clean disk space of unused apps. * Remove "Done!" output from flatpak-usage. * Go ahead and add function for purging Flatpak apps. * Few more comment changes.
This commit is contained in:
@ -41,6 +41,13 @@
|
||||
;
|
||||
; pentesting : Set to true to install tools such as metasploit (nmap is already provided for reporting)
|
||||
;
|
||||
; no_telem : Set to true to avoid setting up telemetry services.
|
||||
; Disables GitHub updates to this project.
|
||||
; Disables all telegraf pings.
|
||||
;
|
||||
; battery : Set to true to attempt to save battery life.
|
||||
; Slows down the rate of services such as telegraf and cron.
|
||||
;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config'
|
||||
state: present
|
||||
@ -54,6 +61,8 @@
|
||||
user_desc: "{{ lookup('ini', 'user_desc file={{gen_file}} default=Hyperling') }}"
|
||||
branch: "{{ lookup('ini', 'branch file={{gen_file}} default=main') }}"
|
||||
pentesting: "{{ lookup('ini', 'pentesting file={{gen_file}} default=false') }}"
|
||||
no_telem: "{{ lookup('ini', 'no_telem file={{gen_file}} default=false') }}"
|
||||
battery: "{{ lookup('ini', 'battery file={{gen_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | List
|
||||
set_fact:
|
||||
@ -64,6 +73,8 @@
|
||||
- { 'user_desc': "{{ user_desc }}" }
|
||||
- { 'branch': "{{ branch }}" }
|
||||
- { 'pentesting': "{{ pentesting }}" }
|
||||
- { 'no_telem': "{{ no_telem }}" }
|
||||
- { 'battery': "{{ battery }}" }
|
||||
|
||||
|
||||
## Workstation ##
|
||||
@ -91,6 +102,10 @@
|
||||
; bsd_gpu : Set to [] to install GPU driver
|
||||
; Example: amdgpu
|
||||
;
|
||||
; mobile : Set to true if not using an amd64 processor.
|
||||
; Not used yet but expecting it to be helpful for Pinephone.
|
||||
; May eventually avoid things like Flatpak if they don't play well.
|
||||
;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Workstation Config'
|
||||
state: present
|
||||
@ -106,6 +121,7 @@
|
||||
rdp: "{{ lookup('ini', 'rdp file={{wrk_file}} default=false') }}"
|
||||
vnc: "{{ lookup('ini', 'vnc file={{wrk_file}} default=false') }}"
|
||||
bsd_gpu: "{{ lookup('ini', 'bsd_gpu file={{wrk_file}} default=false') }}"
|
||||
mobile: "{{ lookup('ini', 'mobile file={{wrk_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | List
|
||||
set_fact:
|
||||
@ -118,6 +134,7 @@
|
||||
- { 'rdp': "{{ rdp }}" }
|
||||
- { 'vnc': "{{ vnc }}" }
|
||||
- { 'bsd_gpu': "{{ bsd_gpu }}" }
|
||||
- { 'mobile': "{{ mobile }}" }
|
||||
|
||||
# No longer mining, this is now considered deprecated.
|
||||
### Miner ##
|
||||
@ -223,6 +240,10 @@
|
||||
;
|
||||
; certbot : Set to true to add cron job for `certbot renew`.
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; Never got these fully working or did not understand how to use them.
|
||||
;
|
||||
; hugo : Set to true to install HUGO static website generator.
|
||||
;
|
||||
; gitlab : ee - Installs Enterprise Edition Free Tier. Basically CE with an easier upgrade path for Paid Features.
|
||||
@ -247,6 +268,7 @@
|
||||
; git_sep : Separator for git variables above.
|
||||
; Example: #
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Server Config'
|
||||
state: present
|
||||
|
@ -259,6 +259,24 @@
|
||||
check-trash --clean
|
||||
sudo df -h
|
||||
}
|
||||
function_flatpak_usage: |
|
||||
function flatpak-usage() {
|
||||
flatpak list --columns=application | while read app; do
|
||||
size=`flatpak info -s $app 2>/dev/null`
|
||||
if [[ ! -z $size ]]; then
|
||||
mb=$(( size / (1000*1000) ))
|
||||
echo "${mb} MB, $size Bytes, $app"
|
||||
fi
|
||||
done | sort -n
|
||||
}
|
||||
function_flatpak_purge: |
|
||||
function flatpak-purge() {
|
||||
flatpak remove --all --delete-data &&
|
||||
flatpak repair &&
|
||||
echo "Finished purging all Flatpak apps. Executable may still need uninstalled." &&
|
||||
return
|
||||
echo "ERROR: Something went wrong while removing Flatpak apps!"
|
||||
}
|
||||
|
||||
- name: General | Account Management | Users | Files | Common Variable
|
||||
set_fact:
|
||||
@ -282,6 +300,8 @@
|
||||
{{ edit_config }}
|
||||
{{ function_check_trash }}
|
||||
{{ function_clean }}
|
||||
{{ function_flatpak_usage }}
|
||||
{{ function_flatpak_purge }}
|
||||
|
||||
- name: General | Account Management | Users | Files | .bashrc
|
||||
blockinfile:
|
||||
|
Reference in New Issue
Block a user