General Enhancements, NixOS Support (#47)
* Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
srv_file: "{{ prov_dir }}/server.ini"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Create Directory
|
||||
file:
|
||||
file:
|
||||
path: "{{ prov_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
@ -29,24 +29,46 @@
|
||||
;;;;;;; Available options - all require lowercase values ;;;;;;
|
||||
;
|
||||
; enable : Provide true for the provision to occur.
|
||||
; Default: false
|
||||
;
|
||||
; user : Provide the name of the user account.
|
||||
; Example: tom, jerry, kim, sarah
|
||||
; Default: ling
|
||||
;
|
||||
; user_desc : Provide the description of the user account.
|
||||
; Example: Thomas, Jerry, Kimberly, Sarah
|
||||
; Default: Hyperling
|
||||
;
|
||||
; branch : Provide the Github branch that the machine should poll.
|
||||
; Example: main, dev
|
||||
; Default: main
|
||||
;
|
||||
; pentesting : Set to true to install tools such as metasploit (nmap is already provided for reporting)
|
||||
; pentesting : Set to true to install tools such as metasploit.
|
||||
; nmap is already provided for reporting
|
||||
; Default: false
|
||||
;
|
||||
; no_telem : Set to true to avoid setting up telemetry services.
|
||||
; Disables GitHub updates to this project.
|
||||
; Disables all telegraf pings.
|
||||
; Disables GitHub updates to this project.
|
||||
; Disables all telegraf pings.
|
||||
; Default: false
|
||||
;
|
||||
; battery : Set to true to attempt to save battery life.
|
||||
; Slows down the rate of services such as telegraf and cron.
|
||||
; Slows down the rate of services such as telegraf and cron.
|
||||
; Default: false
|
||||
;
|
||||
; swap_block : Set to the block size if dd should create a swapfile.
|
||||
; Preferably keep this under 2G for integrity sakes, the
|
||||
; value is multiplied by count if you need a larger file.
|
||||
; Example: 500M, 512MB, 1G
|
||||
; Default: false
|
||||
;
|
||||
; swap_count : Set to the number of blocks to multiply the file size by.
|
||||
; Example: 8
|
||||
; Default: 1
|
||||
;
|
||||
; swap_file : Set to the name and location of where the file should be.
|
||||
; Example: /usr/local/swap
|
||||
; Default: /swapfile
|
||||
;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config'
|
||||
@ -63,9 +85,12 @@
|
||||
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') }}"
|
||||
swap_block: "{{ lookup('ini', 'swap_block file={{gen_file}} default=false') }}"
|
||||
swap_count: "{{ lookup('ini', 'swap_count file={{gen_file}} default=1') }}"
|
||||
swap_file: "{{ lookup('ini', 'swap_file file={{gen_file}} default=/swapfile') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | List
|
||||
set_fact:
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- { 'provision': "{{ provision }}" }
|
||||
@ -75,6 +100,9 @@
|
||||
- { 'pentesting': "{{ pentesting }}" }
|
||||
- { 'no_telem': "{{ no_telem }}" }
|
||||
- { 'battery': "{{ battery }}" }
|
||||
- { 'swap_block': "{{ swap_block }}" }
|
||||
- { 'swap_count': "{{ swap_count }}" }
|
||||
- { 'swap_file': "{{ swap_file }}" }
|
||||
|
||||
|
||||
## Workstation ##
|
||||
@ -123,7 +151,7 @@
|
||||
mobile: "{{ lookup('ini', 'mobile file={{wrk_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | List
|
||||
set_fact:
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- { 'workstation': "{{ workstation }}" }
|
||||
@ -150,7 +178,7 @@
|
||||
# ;
|
||||
# ; nanominer : Set to true for installation of nanominer
|
||||
# ;
|
||||
# ; nanominer_cpu : Set to coin code that you'd like the CPU to work on
|
||||
# ; nanominer_cpu : Set to coin code that you'd like the CPU to work on
|
||||
# ; Valid values: xmr
|
||||
# ;
|
||||
# ; nanominer_cpu_pool : Set to pool organization to use for CPU mining
|
||||
@ -199,7 +227,7 @@
|
||||
# xmr_stak_cpu: "{{ lookup('ini', 'xmr_stak_cpu file={{mnr_file}} default=false') }}"
|
||||
#
|
||||
#- name: General | Account Management | Provisioning Configuration | Miner | List
|
||||
# set_fact:
|
||||
# set_fact:
|
||||
# provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
# loop:
|
||||
# - { 'miner': "{{ miner }}" }
|
||||
@ -253,7 +281,7 @@
|
||||
; Regardless of whether you choose http or https, the Certbot config will be skipped since the maintainer uses a reverse proxy.
|
||||
; Example: https://gitlab
|
||||
;
|
||||
; git : Set to true for this server to be configured as an HTTP git server.
|
||||
; git : Set to true for this server to be configured as an HTTP git server.
|
||||
;
|
||||
; git_name : Name(s) of project(s) that the Git server should host.
|
||||
; Example: ansible#ansible-dev
|
||||
@ -293,7 +321,7 @@
|
||||
git_sep: "{{ lookup('ini', 'git_sep file={{srv_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Server | List
|
||||
set_fact:
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- { 'server': "{{ server }}" }
|
||||
@ -323,5 +351,5 @@
|
||||
## Display values ##
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Print
|
||||
debug:
|
||||
debug:
|
||||
var: provision_variables
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
# Create users for all machines.
|
||||
# Create and configure default users for all machines.
|
||||
|
||||
## Variables ##
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
## Superuser ##
|
||||
|
||||
- name: General | Account Management | Users | Hyperling
|
||||
- name: General | Account Management | Users | User
|
||||
user:
|
||||
name: "{{ user }}"
|
||||
comment: "{{ user_desc }}"
|
||||
@ -72,7 +72,7 @@
|
||||
generate_ssh_key: yes
|
||||
register: user_user
|
||||
|
||||
- name: General | Account Management | Users | Hyperling | Test Logging In
|
||||
- name: General | Account Management | Users | User | Test Logging In
|
||||
shell: "echo SUCCESS"
|
||||
args:
|
||||
executable: "{{ user_shell }}"
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
## Folders ##
|
||||
|
||||
- name: General | Account Management | Users | Folders | Root | Create bin, Downloads, TRASH
|
||||
- name: General | Account Management | Users | Root | Create Folders
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
@ -92,7 +92,7 @@
|
||||
- "{{ user_root.home }}/TRASH"
|
||||
when: user_root.home != ""
|
||||
|
||||
- name: General | Account Management | Users | Folders | Hyperling | Create bin, LBRY, TRASH
|
||||
- name: General | Account Management | Users | User | Create Folders
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
@ -106,7 +106,7 @@
|
||||
become_user: "{{ user }}"
|
||||
when: user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | Folders | Home Directories 700
|
||||
- name: General | Account Management | Users | Home Permissions
|
||||
shell: "chmod 700 {{ user_user.home }}/../*"
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@
|
||||
alias_rm: alias rm='echo "Use mv ~/TRASH/ instead!"'
|
||||
alias_clean_dir: alias clean-dir='mv * ~/TRASH/'
|
||||
alias_clean_trash: alias clean-trash='sh -c "rm -rfv ~/TRASH/*"'
|
||||
export_path_additions: export PATH="~/bin:$PATH"
|
||||
export_path_additions: export PATH="~/bin:"{{ global_bin }}":$PATH"
|
||||
function_wttr: |
|
||||
function weather() {
|
||||
# 20210301 - Someone showed me an awesome weather API! Had to implement it!
|
||||
@ -138,7 +138,14 @@
|
||||
curl "https://wttr.in/${1//\ /+}"
|
||||
}
|
||||
export_PS1: export PS1='[\u@\h \w]\$ '
|
||||
alias_remount: alias remount='sudo umount /mnt/*; sudo umount /mnt/*/*; sudo mount -a; echo -e "\nRemount completed!"; mount | grep /mnt'
|
||||
alias_remount: |
|
||||
alias remount='
|
||||
sudo umount /mnt/*
|
||||
sudo umount /mnt/*/*
|
||||
sudo mount -a
|
||||
echo -e "\nRemount completed!"
|
||||
mount | grep /mnt
|
||||
'
|
||||
function_update: |
|
||||
function update() {
|
||||
PROG=$FUNCNAME
|
||||
@ -171,9 +178,18 @@
|
||||
alias_sync: alias sync='date && echo "Syncing!" && sync && date'
|
||||
export_editor: export EDITOR='vi'
|
||||
init_aliases: |
|
||||
alias init-video='mkdir -v raw; mkdir -v exports; cp ~/Templates/*video* ./'
|
||||
alias init-video='
|
||||
mkdir -v raw
|
||||
mkdir -v exports
|
||||
cp ~/Templates/*video* ./
|
||||
'
|
||||
alias init-vid=init-video
|
||||
alias init-program='echo -e "#!/bin/bash\n# `date +%Y-%m-%d` by Hyperling\n# REASON\n\nexit 0\n"'
|
||||
alias init-program='
|
||||
echo "#!/usr/bin/env bash"
|
||||
echo "# `date +%Y-%m-%d` Hyperling"
|
||||
echo ""
|
||||
echo "exit 0"
|
||||
'
|
||||
alias init-prog=init-program
|
||||
bye_aliases: |
|
||||
alias bye="{{ shutdown_command }}"
|
||||
@ -186,7 +202,15 @@
|
||||
alias show-config-wrk="cat {{ wrk_file }}"
|
||||
alias show-config-mnr="cat {{ mnr_file }}"
|
||||
alias show-config-srv="cat {{ srv_file }}"
|
||||
alias show-config-all="show-config-gen && echo '' && show-config-wrk && echo '' && show-config-mnr && echo '' && show-config-srv"
|
||||
alias show-config-all="
|
||||
show-config-gen &&
|
||||
echo '' &&
|
||||
show-config-wrk &&
|
||||
echo '' &&
|
||||
show-config-mnr &&
|
||||
echo '' &&
|
||||
show-config-srv
|
||||
"
|
||||
alias show-config="show-config-all"
|
||||
edit_config_aliases: |
|
||||
alias edit-config-gen="sudo $EDITOR {{ gen_file }}"
|
||||
@ -278,14 +302,26 @@
|
||||
function flatpak-purge() {
|
||||
flatpak remove --all --delete-data &&
|
||||
flatpak repair &&
|
||||
echo "Finished purging all Flatpak apps. Executable may still need uninstalled." &&
|
||||
echo -n "Finished purging all Flatpak apps. " &&
|
||||
echo "Executable may still need uninstalled." &&
|
||||
return
|
||||
echo "ERROR: Something went wrong while removing Flatpak apps!" >&2
|
||||
}
|
||||
alias_vim: alias vi=vim
|
||||
alias_here: alias here='ls -alh `pwd`/*'
|
||||
alias_docker_reload: alias docker-reload='docker compose down && docker compose build && docker compose up -d'
|
||||
alias_docker_update: alias docker-update='docker compose down && docker compose pull && docker compose build && docker compose up -d'
|
||||
alias_docker_reload: |
|
||||
alias docker-reload='
|
||||
docker compose down &&
|
||||
docker compose build &&
|
||||
docker compose up -d
|
||||
'
|
||||
alias_docker_update: |
|
||||
alias docker-update='
|
||||
docker compose down &&
|
||||
docker compose pull &&
|
||||
docker compose build &&
|
||||
docker compose up -d
|
||||
'
|
||||
function_docker_upgrade: |
|
||||
function docker-upgrade() {
|
||||
# Wrapper for a full-scale upgrade and log view of a container.
|
||||
@ -320,8 +356,72 @@
|
||||
echo "Press ^C to escape." &&
|
||||
docker logs -f $container
|
||||
}
|
||||
alias_docker_restart: alias docker-restart='docker compose down && docker compose up -d'
|
||||
alias_code_check: alias code-check='ls -d ~/Code/* | while read project; do echo "*** `basename $project` ***"; cd $project; git push; git pull; done'
|
||||
alias_docker_restart: |
|
||||
alias docker-restart='docker compose down && docker compose up -d'
|
||||
alias_code_check: |
|
||||
alias code-check='
|
||||
ls -d ~/Code/* | while read project; do
|
||||
echo "*** `basename $project` ***"
|
||||
cd $project
|
||||
git pull
|
||||
git push
|
||||
done
|
||||
'
|
||||
alias_code_reset: |
|
||||
alias code-reset='
|
||||
ls -d ~/Code/* | while read project
|
||||
do echo "*** `basename $project` ***"
|
||||
cd $project
|
||||
git switch main
|
||||
git pull
|
||||
git branch -D dev
|
||||
git checkout dev
|
||||
done
|
||||
'
|
||||
alias_code_reseed: |
|
||||
alias code-reseed='
|
||||
unseed_dir="$HOME/TRASH/`date +%Y-%m-%d`_UnseededCodeProjects"
|
||||
mkdir -pv "$unseed_dir"
|
||||
mv -v ~/Code/*{ansible,docker,nix,break,habit}* \
|
||||
"$unseed_dir"/ 2>/dev/null
|
||||
git clone git@github.com:Hyperling/Ansible \
|
||||
--branch dev ~/Code/ansible-dev
|
||||
git clone git@github.com:Hyperling/Docker \
|
||||
--branch dev ~/Code/docker-dev
|
||||
git clone git@github.com:Hyperling/NixOS \
|
||||
--branch dev ~/Code/nixos-dev
|
||||
git clone git@github.com:Hyperling/BreakTheHabit \
|
||||
--branch dev ~/Code/breakthehabit-dev
|
||||
'
|
||||
function_clean_filenames: |
|
||||
function clean-filenames() {
|
||||
# Must provide the directory you'd like to clean all the filenames in.
|
||||
# Otherwise defaults to the current directory and all of its files.
|
||||
dir="$1"
|
||||
if [[ -z $dir ]]; then
|
||||
echo -e "Using current directory."
|
||||
dir="."
|
||||
fi
|
||||
ls "$dir" | while read file; do
|
||||
clean="${file//IMG/}"
|
||||
clean="${clean//_/}"
|
||||
clean="${clean//-/}"
|
||||
clean="${clean// /}"
|
||||
if [[ "$file" != "$clean" && ! -d "$file" ]]; then
|
||||
mv -v "$dir"/"$file" "$dir"/"$clean"
|
||||
fi
|
||||
done
|
||||
}
|
||||
function_clean_filenames_tree: |
|
||||
function clean-filenames-tree() {
|
||||
find ./ | while read folder; do
|
||||
if [[ -d "$folder" ]]; then
|
||||
echo -e "\n*** Checking '$folder' ***"
|
||||
clean-filenames "$folder"
|
||||
fi
|
||||
done
|
||||
echo -e "\nDone!\n"
|
||||
}
|
||||
|
||||
- name: General | Account Management | Users | Files | Common Variable
|
||||
set_fact:
|
||||
@ -354,13 +454,18 @@
|
||||
{{ function_docker_upgrade }}
|
||||
{{ alias_docker_restart }}
|
||||
{{ alias_code_check }}
|
||||
{{ alias_code_reset }}
|
||||
{{ alias_code_reseed }}
|
||||
{{ function_clean_filenames }}
|
||||
{{ function_clean_filenames_tree }}
|
||||
|
||||
- name: General | Account Management | Users | Files | .bashrc
|
||||
blockinfile:
|
||||
path: "{{ item }}/.bashrc"
|
||||
block: |
|
||||
{{ rc_common }}
|
||||
[[ $(whoami) != "root" ]] && echo "`date` - Ansible .bashrc preferences loaded successfully!"
|
||||
[[ $(whoami) != "root" ]] &&
|
||||
echo "`date` - Ansible .bashrc loaded successfully!"
|
||||
marker: '# {mark} MANAGED BY ANSIBLE | Aliases'
|
||||
state: present
|
||||
create: yes
|
||||
@ -376,7 +481,8 @@
|
||||
path: "{{ item }}/.zshrc"
|
||||
block: |
|
||||
{{ rc_common }}
|
||||
[[ $(whoami) != "root" ]] && echo "`date` - Ansible .zshrc preferences loaded successfully!"
|
||||
[[ $(whoami) != "root" ]] &&
|
||||
echo "`date` - Ansible .zshrc loaded successfully!"
|
||||
marker: '# {mark} MANAGED BY ANSIBLE | Aliases'
|
||||
state: present
|
||||
create: yes
|
||||
@ -411,3 +517,13 @@
|
||||
- "{{ user_user.home }}"
|
||||
ignore_errors: yes
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | Files | Ownership
|
||||
file:
|
||||
path: "{{ user_user.home }}/{{ item }}"
|
||||
owner: "{{ user }}"
|
||||
mode: '0755'
|
||||
loop:
|
||||
- .bashrc
|
||||
- .zshrc
|
||||
- .vimrc
|
||||
|
@ -14,3 +14,13 @@
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: '0755'
|
||||
|
||||
- name: General | Scripts | Install | Remove Old Scripts
|
||||
shell: |
|
||||
if [[ -e {{ global_bin }}/{{ item }} ]]; then
|
||||
rm -v {{ global_bin }}/{{ item }}
|
||||
fi
|
||||
loop:
|
||||
- compress-video.sh
|
||||
- compress-images.sh
|
||||
ignore_errors: true
|
||||
|
@ -16,7 +16,7 @@
|
||||
create: yes
|
||||
|
||||
- name: General | Scripts | Root | scm.sh Permissions
|
||||
file:
|
||||
file:
|
||||
path: "{{ user_root.home }}/bin/scm.sh"
|
||||
mode: '0755'
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
path: "{{ user_root.home }}/bin/scm-dev.sh"
|
||||
block: |
|
||||
# 20210713 - Make life easier for development!
|
||||
|
||||
|
||||
## Variables ##
|
||||
|
||||
# Use a specific branch if it was asked for.
|
||||
@ -35,7 +35,6 @@
|
||||
branch="$1"
|
||||
fi
|
||||
|
||||
|
||||
## Main ##
|
||||
|
||||
time {{ ansible_pull_exec.stdout }} -U {{ repo_github }} --checkout $branch
|
||||
@ -47,6 +46,6 @@
|
||||
create: yes
|
||||
|
||||
- name: General | Scripts | Root | scm-dev.sh Permissions
|
||||
file:
|
||||
file:
|
||||
path: "{{ user_root.home }}/bin/scm-dev.sh"
|
||||
mode: '0755'
|
||||
|
@ -16,7 +16,7 @@
|
||||
create: yes
|
||||
|
||||
- name: General | Scripts | User | scm.sh Permissions
|
||||
file:
|
||||
file:
|
||||
path: "{{ user_user.home }}/bin/scm.sh"
|
||||
mode: '0755'
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
path: "{{ user_user.home }}/bin/scm-dev.sh"
|
||||
block: |
|
||||
# 20210713 - Make life easier for development!
|
||||
|
||||
|
||||
## Variables ##
|
||||
|
||||
# Use a specific branch if it was asked for.
|
||||
@ -35,7 +35,6 @@
|
||||
branch="$1"
|
||||
fi
|
||||
|
||||
|
||||
## Main ##
|
||||
|
||||
time sudo {{ ansible_pull_exec.stdout }} -U {{ repo_github }} --checkout $branch
|
||||
@ -47,6 +46,6 @@
|
||||
create: yes
|
||||
|
||||
- name: General | Scripts | User | scm-dev.sh Permissions
|
||||
file:
|
||||
file:
|
||||
path: "{{ user_user.home }}/bin/scm-dev.sh"
|
||||
mode: '0755'
|
||||
|
37
tasks/general/software/nix.yml
Normal file
37
tasks/general/software/nix.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
# Install the Nix package manager
|
||||
# https://nixos.org/download/
|
||||
|
||||
## TBD ##
|
||||
# This may be able to replace Flatpak if it works well, is easy to use, takes up
|
||||
# less space, is faster, etc etc. It also is supposed to have the benefit of
|
||||
# working with FreeBSD and MacOS which is something that the current array of
|
||||
# Ansible/package/Flatpak combo is lacking. Honestly might make FreeBSD as a
|
||||
# desktop a possibility again since it was software availability that continues
|
||||
# to be the reason to leave it. Could also get rid of all the distro-specific
|
||||
# package names, and maybe packages.yml in general?? That stuff can be a mess.
|
||||
###
|
||||
|
||||
- name: Nix Variables
|
||||
set_fact:
|
||||
nix_exe: ~/.deleteme.nix.sh
|
||||
|
||||
- name: Install Nix
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "curl -L https://nixos.org/nix/install > {{ nix_exe }}"
|
||||
- "chmod 755 {{ nix_exe }}"
|
||||
- "{{ nix_exe }} --daemon --yes"
|
||||
- "rm -v {{ nix_exe }}"
|
||||
become_user: "{{ user }}"
|
||||
|
||||
- name: Install Nix Software
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "nix-env -iA nixpkgs.lbry" # Installs, but doesnt launch?
|
||||
#$ lbry
|
||||
#Gtk-Message: 16:22:43.390: Failed to load module "canberra-gtk-module"
|
||||
#Gtk-Message: 16:22:43.391: Failed to load module "canberra-gtk-module"
|
||||
#[35:0100/000000.410595:ERROR:angle_platform_impl.cc(44)] Display.cpp:940 (initialize): ANGLE Display::initialize error 12289: glXQueryExtensionsString returned NULL
|
||||
#[35:0100/000000.482531:ERROR:gl_surface_egl.cc(808)] EGL Driver message (Critical) eglInitialize: glXQueryExtensionsString returned NULL
|
||||
#[35:0100/000000.482570:ERROR:gl_surface_egl.cc(1430)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
|
42
tasks/general/software/nixos.yml
Normal file
42
tasks/general/software/nixos.yml
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
# Update the Nix configuration at github.com/Hyperling/NixOS.
|
||||
# This is also done in setup.sh if ansible is not found.
|
||||
|
||||
- name: General | Software | NixOS | Facts
|
||||
set_fact:
|
||||
nixos_working_dir: ~/nixos-config-deleteme
|
||||
nixos_working_exe: activate.sh
|
||||
|
||||
- name: General | Software | NixOS | Facts [Swap]
|
||||
set_fact:
|
||||
nixos_swap: "swapDevices = [ { device = \"{{ swap_file }}\";} ];"
|
||||
when: swap_block != false
|
||||
|
||||
- name: General | Software | NixOS | Update Config Project
|
||||
shell: "files/scripts/nixos.sh -b {{ branch }}"
|
||||
|
||||
- name: General | Software | NixOS | Create Ansible Nix Config
|
||||
blockinfile:
|
||||
path: /etc/nixos/ansible.nix
|
||||
block: |
|
||||
# This file was created by https://github.com/Hyperling/Ansible
|
||||
# Please do not alter it by hand. Use the proper ini files instead.
|
||||
{ config, pkgs, nix, ... }:
|
||||
|
||||
{
|
||||
# tasks/general/software/swap.yml
|
||||
# Use general.ini to set up the swap commands for ths field to be used.
|
||||
{{ nixos_swap }}
|
||||
}
|
||||
state: present
|
||||
backup: yes
|
||||
create: yes
|
||||
|
||||
|
||||
# Maybe do home manager here? Or should it be under Workstation? Or maybe
|
||||
# this is the spot where I start creating workstation.nix, server.nix, etc.
|
||||
#- name: General | Software | NixOS | Home Manager? *.nix file management?
|
||||
# shell:
|
||||
# loop:
|
||||
# - ???
|
||||
# - ???
|
@ -84,3 +84,15 @@
|
||||
shell: journalctl --vacuum-size=100M
|
||||
when: ansible_system == "Linux"
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
## Bluetooth ##
|
||||
# Do people seriously depend on Bluetooth? Plug your devices in, silly!
|
||||
|
||||
- name: General | Software | Services | Bluetooth | Disable
|
||||
service:
|
||||
name: "{{ bluetooth }}"
|
||||
pattern: "{{ bluetooth_pattern }}"
|
||||
state: stopped
|
||||
enabled: no
|
||||
ignore_errors: yes
|
||||
|
40
tasks/general/software/swap.yml
Normal file
40
tasks/general/software/swap.yml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
# Setup swap file on systems without any swap available.
|
||||
# Must have the swap amount preferred set up in general.ini.
|
||||
# This does not handle if the user changes the file name or location later on.
|
||||
|
||||
- name: General | Software | Swap
|
||||
block:
|
||||
|
||||
- name: General | Software | Swap | Check For Swapfile
|
||||
stat:
|
||||
path: "{{ swap_file }}"
|
||||
register: swap_check
|
||||
|
||||
- name: General | Software | Swap | Install Block
|
||||
block:
|
||||
|
||||
- name: General | Software | Swap | Create Swapfile
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- dd if=/dev/zero of={{ swap_file }} bs={{ swap_block }}
|
||||
count={{ swap_count }} status=progress
|
||||
- chmod 600 {{ swap_file }}
|
||||
- mkswap {{ swap_file }}
|
||||
- swapon {{ swap_file }}
|
||||
|
||||
# Only do the swapfile generation if it does not already exist.
|
||||
when: not swap_check.stat.exists
|
||||
|
||||
# NixOS's swap setup is handled in nixos.yml when ansible.nix is created.
|
||||
- name: General | Software | Swap | Add to FSTAB
|
||||
lineinfile:
|
||||
path: /etc/fstab
|
||||
regexp: '^[\#]?{{ swap_file }}'
|
||||
line: '{{ swap_file }} none swap sw 0 0'
|
||||
state: present
|
||||
backup: yes
|
||||
when: ansible_distribution != "NixOS"
|
||||
|
||||
# Only run through this file if the ini has been changed from false.
|
||||
when: swap_block != false
|
@ -4,7 +4,7 @@
|
||||
- name: General | Tests | nmap | Set Facts
|
||||
set_fact:
|
||||
nmap_file: "{{ user_user.home }}/Reports/{{ nmap_report }}"
|
||||
nmap_separator: "\n*******************************\n\n"
|
||||
nmap_separator: "\n*******************************\n"
|
||||
|
||||
- name: General | Tests | nmap | Set Facts 2
|
||||
set_fact:
|
||||
@ -12,15 +12,15 @@
|
||||
|
||||
- name: General | Tests | nmap | Create Report
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
loop:
|
||||
- "date > {{ nmap_temp_file }}"
|
||||
- "printf '{{ nmap_separator }}' >> {{ nmap_temp_file }}"
|
||||
- "echo '-=Open Ports=-' >> {{ nmap_temp_file }}"
|
||||
- "echo '\n-=Open Ports=-\n' >> {{ nmap_temp_file }}"
|
||||
- "printf 'Number of open ports: ' >> {{ nmap_temp_file }}"
|
||||
- "nmap --open localhost | grep -c open >> {{ nmap_temp_file }}; echo success"
|
||||
- "nmap --open localhost | grep open >> {{ nmap_temp_file }}; echo success"
|
||||
- "printf '{{ nmap_separator }}' >> {{ nmap_temp_file }}"
|
||||
- "echo '-=Aggressive Vulnerability Check=-' >> {{ nmap_temp_file }}"
|
||||
- "echo '\n-=Aggressive Vulnerability Check=-\n' >> {{ nmap_temp_file }}"
|
||||
- "nmap -A localhost >> {{ nmap_temp_file }}; echo success"
|
||||
- "mv {{ nmap_temp_file }} {{ nmap_file }}"
|
||||
|
||||
|
27
tasks/general/tests/services.yml
Normal file
27
tasks/general/tests/services.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
# List all the services under the Reports folder.
|
||||
|
||||
- name: General | Tests | Services | Set Facts
|
||||
set_fact:
|
||||
services_report_file: "{{ user_user.home }}/Reports/services.txt"
|
||||
services_enabled_file: "{{ user_user.home }}/Reports/services-enabled.txt"
|
||||
services_command: "systemctl list-unit-files"
|
||||
|
||||
- name: General | Tests | Services | Create Main Report
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "date > {{ services_report_file }}"
|
||||
- "echo '\n-= {{ services_command }} =-\n' >> {{ services_report_file }}"
|
||||
- "{{ services_command }} >> {{ services_report_file }}"
|
||||
|
||||
- name: General | Tests | Services | Create Enabled Report
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "date > {{ services_enabled_file }}"
|
||||
- "echo '\n-= Enabled + Sorted =-\n' >> {{ services_enabled_file }}"
|
||||
- "grep 'enabled' {{ services_report_file }} | sort >> {{ services_enabled_file }}"
|
||||
|
||||
- name: General | Tests | Services | Make Viewable
|
||||
file:
|
||||
path: "{{ services_report_file }}"
|
||||
mode: '0644'
|
Reference in New Issue
Block a user