playbooks for my setup

main
Andrew Coleman 2021-04-16 12:59:28 -04:00
commit 46aa5ef390
12 changed files with 399 additions and 0 deletions

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# FreeBSD
# as root
pkg install py37-ansible python3 sudo bash
visudo # allow user to sudo without password
# as your user
ansible-galaxy collection install community.general
./playbook.sh
# Fedora
sudo visudo # allow user to sudo without password
sudo dnf install -y ansible ansible-collection-general
./playbook.sh
# All operating systems
bw server https://bitwarden.penguincoder.org
bw login
# configure `BW_SESSION`
chezmoi init ssh://git@git.penguincoder.org:2222/penguincoder/dotfiles.git
chezmoi apply

5
apt.yml Normal file
View File

@ -0,0 +1,5 @@
---
- name: install apt applications
apt:
name: jq,vim,emacs,curl,htop,tmux,git,build-essential,libssl-dev,libncurses5-dev,cmake,fzf,awscli,most
state: present

91
base16-outrun-dark-256.sh Executable file
View File

@ -0,0 +1,91 @@
#!/usr/bin/env bash
# Base16 Outrun Dark - Gnome Terminal color scheme install script
# Hugo Delahousse (http://github.com/hugodelahousse/)
set -x
[[ -f "$HOME/.config/.gnome-terminal-profile-created" ]] && exit 0
[[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="Base 16 Outrun Dark 256"
[[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="base-16-outrun-dark-256"
[[ -z "$DCONF" ]] && DCONF=dconf
[[ -z "$UUIDGEN" ]] && UUIDGEN=uuidgen
dset() {
local key="$1"; shift
local val="$1"; shift
if [[ "$type" == "string" ]]; then
val="'$val'"
fi
"$DCONF" write "$PROFILE_KEY/$key" "$val"
}
# Because dconf still doesn't have "append"
dlist_append() {
local key="$1"; shift
local val="$1"; shift
local entries="$(
{
"$DCONF" read "$key" | tr -d '[]' | tr , "\n" | fgrep -v "$val"
echo "'$val'"
} | perl -pe 'chomp if eof' | tr "\n" ,
)"
"$DCONF" write "$key" "[$entries]"
}
# Newest versions of gnome-terminal use dconf
if which "$DCONF" > /dev/null 2>&1; then
# Check that uuidgen is available
type $UUIDGEN >/dev/null 2>&1 || { echo >&2 "Requires uuidgen but it's not installed. Aborting!"; exit 1; }
[[ -z "$BASE_KEY_NEW" ]] && BASE_KEY_NEW=/org/gnome/terminal/legacy/profiles:
if [[ -n "`$DCONF list $BASE_KEY_NEW/`" ]]; then
if which "$UUIDGEN" > /dev/null 2>&1; then
PROFILE_SLUG=`uuidgen`
fi
if [[ -n "`$DCONF read $BASE_KEY_NEW/default`" ]]; then
DEFAULT_SLUG=`$DCONF read $BASE_KEY_NEW/default | tr -d \'`
else
DEFAULT_SLUG=`$DCONF list $BASE_KEY_NEW/ | grep '^:' | head -n1 | tr -d :/`
fi
DEFAULT_KEY="$BASE_KEY_NEW/:$DEFAULT_SLUG"
PROFILE_KEY="$BASE_KEY_NEW/:$PROFILE_SLUG"
# Copy existing settings from default profile
$DCONF dump "$DEFAULT_KEY/" | $DCONF load "$PROFILE_KEY/"
# Add new copy to list of profiles
dlist_append $BASE_KEY_NEW/list "$PROFILE_SLUG"
# Update profile values with theme options
dset visible-name "'$PROFILE_NAME'"
dset palette "['#00002a', '#ff4242', '#59f176', '#f3e877', '#66b0ff', '#f10596', '#0ef0f0', '#d0d0fa', '#50507a', '#ff4242', '#59f176', '#f3e877', '#66b0ff', '#f10596', '#0ef0f0', '#f5f5ff']"
dset background-color "'#00002a'"
dset foreground-color "'#d0d0fa'"
dset bold-color "'#d0d0fa'"
dset bold-color-same-as-fg "true"
dset cursor-colors-set "true"
dset cursor-background-color "'#d0d0fa'"
dset cursor-foreground-color "'#00002a'"
dset use-theme-colors "false"
dset use-theme-background "false"
unset PROFILE_NAME
unset PROFILE_SLUG
unset PROFILE_KEY
unset DCONF
unset UUIDGEN
unset DEFAULT_KEY
unset DEFAULT_SLUG
unset BASE_NEW_KEY
touch "$HOME/.config/.gnome-terminal-profile-created"
exit 0
fi
fi
echo "dconf not found"
exit 1

8
dnf.yml Normal file
View File

@ -0,0 +1,8 @@
---
- name: install dnf applications
become: yes
become_user: root
become_method: sudo
dnf:
name: jq,vim,emacs,curl,htop,tmux,git,sqlite,sqlite-devel,make,automake,gcc,gcc-c++,kernel-devel,llvm,cmake,awscli,skopeo,ShellCheck,libtool,alien,fakeroot,openssl-devel,zlib-devel,flex,bison,uuid-devel,libtirpc-devel,libaio-devel,elfutils-libelf-devel,libffi-devel,libudev-devel,libblkid-devel,libuuid-devel,podman,libvirt-daemon-kvm,qemu-kvm,most,fzf,nodejs,npm,golang,llvm10,clang
state: present

6
freebsd-inventory.yml Normal file
View File

@ -0,0 +1,6 @@
all:
hosts:
localhost
vars:
ansible_connection: local
ansible_python_interpreter: /usr/local/bin/python3

12
gnome-terminal.yml Normal file
View File

@ -0,0 +1,12 @@
---
- name: create linux gnome-terminal profile
when: ansible_facts['system']|lower == 'linux'
script: base16-outrun-dark-256.sh
args:
creates: "{{ ansible_env.HOME }}/.config/.gnome-terminal-profile-created"
- name: create freebsd gnome-terminal profile
when: ansible_facts['system']|lower == 'freebsd'
script: base16-outrun-dark-256.sh
args:
creates: "{{ ansible_env.HOME }}/.config/.gnome-terminal-profile-created"

6
linux-inventory.yml Normal file
View File

@ -0,0 +1,6 @@
all:
hosts:
localhost
vars:
ansible_connection: local
ansible_python_interpreter: /usr/bin/python3

26
localdev.yml Normal file
View File

@ -0,0 +1,26 @@
---
- name: localdev configuration
hosts: all
tasks:
- name: Install the packages for Fedora
import_tasks: dnf.yml
when: ansible_facts['os_family']|lower == 'redhat'
- name: Install the packages for Debian
import_tasks: apt.yml
when: ansible_facts['os_family']|lower == 'debian'
- name: Install the packages for Ubuntu
import_tasks: apt.yml
when: ansible_facts['os_family']|lower == 'ubuntu'
- name: Install the packages for FreeBSD
import_tasks: pkg.yml
when: ansible_facts['os_family']|lower == 'freebsd'
- name: Install rust via rustup
import_tasks: rust.yml
- name: Configure gnome-terminal profile
import_tasks: gnome-terminal.yml

5
neovim.yml Normal file
View File

@ -0,0 +1,5 @@
---
- name: clone neovim github repo
ansible.builtin.shell: "cd ~/dev && git clone https://github.com/neovim/neovim.git && cd neovim && gmake && sudo gmake install"
args:
creates: /usr/local/bin/nvim

60
pkg.yml Normal file
View File

@ -0,0 +1,60 @@
---
- name: install pkg applications
become: yes
become_user: root
become_method: sudo
community.general.pkgng:
name: libtool,autogen,libuv,gettext,autoconf,automake,gmake,coreutils,bash,tmux,git,most,node,npm,go,cmake,llvm10
state: present
- name: install desktop pkg applications
become: yes
become_user: root
become_method: sudo
community.general.pkgng:
name: gnome3,gdm,firefox,nerd-fonts,cantarell-fonts,evolution,evolution-ews,drm-kmod
state: present
- name: enable dbus
become: yes
become_user: root
become_method: sudo
community.general.sysrc:
name: dbus_enable
state: value_present
value: "YES"
- name: enable hald
become: yes
become_user: root
become_method: sudo
community.general.sysrc:
name: hald_enable
state: value_present
value: "YES"
- name: enable gdm
become: yes
become_user: root
become_method: sudo
community.general.sysrc:
name: gdm_enable
state: value_present
value: "YES"
- name: fetch ports snapshot
become: yes
become_user: root
become_method: sudo
command: portsnap fetch extract
args:
creates: /usr/ports/.portsnap.INDEX
- name: install htop
become: yes
become_user: root
become_method: sudo
command: make install-missing-packages install clean
args:
chdir: /usr/ports/sysutils/htop
creates: /usr/local/bin/htop

7
playbook.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ "$(uname -s)" = "Linux" ] ; then
ansible-playbook -i linux-inventory.yml localdev.yml
elif [ "$(uname -s)" = "FreeBSD" ] ; then
ansible-playbook -i freebsd-inventory.yml localdev.yml
fi

151
rust.yml Normal file
View File

@ -0,0 +1,151 @@
---
- name: install rustup
command: curl -o t.sh https://sh.rustup.rs -sSf && chmod 700 t.sh && ./t.sh --no-modify-path --verbose -y --default-toolchain stable && rm -f t.sh && ~/.cargo/bin/rustup install toolchain nightly
args:
warn: False
creates: "{{ ansible_env.HOME }}/.cargo/bin/rustup"
- name: install amber
command: cargo install amber
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/ambr"
- name: install basic-http-server
command: cargo install basic-http-server
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/basic-http-server"
- name: install bat
command: cargo install bat
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/bat"
- name: install btm
command: cargo install btm
when: ansible_facts['system']|lower == 'linux'
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/btm"
- name: install choose
command: cargo install choose
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/choose"
- name: install delta
command: cargo install git-delta
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/delta"
- name: install dust
command: cargo install du-dust
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/dust"
- name: install endbasic
command: cargo install endbasic
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/endbasic"
- name: install exa
command: cargo install exa
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/exa"
- name: install fd
command: cargo install fd-find
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/fd"
- name: install frawk freebsd
shell: LLVM_SYS_100_PREFIX=/usr/local/llvm10 cargo +nightly install frawk
when: ansible_facts['system']|lower == 'freebsd'
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/frawk"
- name: install frawk linux
command: cargo +nightly install frawk
when: ansible_facts['system']|lower == 'linux'
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/frawk"
- name: install git-gone
command: cargo install git-gone
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/git-gone"
- name: install gitui
command: cargo install gitui
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/gitui"
- name: install gget
command: cargo install gget
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/gget"
- name: install grex
command: cargo install grex
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/grex"
- name: install hexyl
command: cargo install hexyl
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/hexyl"
- name: install hyperfine
command: cargo install hyperfine
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/hyperfine"
- name: install kondo
command: cargo install kondo
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/kondo"
- name: install kubie
command: cargo install kubie
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/kubie"
- name: install lsd
command: cargo install lsd
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/lsd"
- name: install mdbook
command: cargo install mdbook
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/mdbook"
- name: install ncgopher
command: cargo install ncgopher
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/ncgopher"
- name: install rg
command: cargo install ripgrep
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/rg"
- name: install stargazer
command: cargo install stargazer
when: ansible_facts['system']|lower == 'linux'
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/stargazer"
- name: install wasm-pack
command: cargo install wasm-pack
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/wasm-pack"
- name: install xcp
command: cargo install xcp
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/xcp"
- name: install ytop
command: cargo install ytop
when: ansible_facts['system']|lower == 'linux'
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/ytop"