Initial import.

This commit is contained in:
Kyle Isom 2023-04-10 19:55:24 -07:00
commit e2543baf2d
17 changed files with 492 additions and 0 deletions

15
Makefile Normal file
View File

@ -0,0 +1,15 @@
I := inventory
L := "$(shell hostname -s)"
C := -c local
K := -K
P := site.yml
all: deploy
check:
ansible-playbook -i $I -l $L $C $K --syntax-check $P
deploy:
ansible-playbook -i $I -l $L $C $K $P
.PHONY: all check deploy

4
answer Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
pushd $HOME/src/ansible
ansible-playbook -i inventory -l $(hostname -s) -c local -K site.yml

54
cmd/rsha256/main.go Normal file
View File

@ -0,0 +1,54 @@
package main
import (
"crypto/sha256"
"flag"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"path/filepath"
"github.com/kisom/goutils/lib"
)
func fetch(remote string) ([]byte, error) {
resp, err := http.Get(remote)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return body, nil
}
func main() {
flag.Parse()
for _, remote := range flag.Args() {
u, err := url.Parse(remote)
if err != nil {
lib.Warn(err, "parsing %s", remote)
continue
}
name := filepath.Base(u.Path)
if name == "" {
lib.Warnx("source URL doesn't appear to name a file")
continue
}
body, err := fetch(remote)
if err != nil {
lib.Warn(err, "fetching %s", remote)
continue
}
h := sha256.Sum256(body)
fmt.Printf("%s: sha256:%x\n", name, h)
}
}

7
go.mod Normal file
View File

@ -0,0 +1,7 @@
module git.wntrmute.dev/kyle/ansible
go 1.20
require github.com/kisom/goutils v1.4.3
require golang.org/x/sys v0.7.0 // indirect

4
go.sum Normal file
View File

@ -0,0 +1,4 @@
github.com/kisom/goutils v1.4.3 h1:N81mTXtO2LCpoqVtOrKthH5Abm0MknjX54QS8DmpQIk=
github.com/kisom/goutils v1.4.3/go.mod h1:Lp5qrquG7yhYnWzZCI/68Pa/GpFynw//od6EkGnWpac=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

2
inventory Normal file
View File

@ -0,0 +1,2 @@
[laptop]
petrichor

View File

@ -0,0 +1,11 @@
# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS="ctrl:swapcaps,compose:ralt"
BACKSPACE="guess"

67
roles/base/tasks/main.yml Normal file
View File

@ -0,0 +1,67 @@
- name: set up keyboard controls
become: true
ansible.builtin.copy:
dest: /etc/default/keyboard
owner: root
group: root
mode: 0644
content: |
# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
# managed by ansible
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS="ctrl:swapcaps,compose:ralt"
BACKSPACE="guess"
- name: set up common tools
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- acpitool
- curl
- emacs
- htop
- iftop
- iotop
- imagemagick
- keychain
- mg
- pandoc
- par
- powertop
- pwgen
- ranger
- rlwrap
- rsync
- silversearcher-ag
- sudo
- tcpdump
- time
- tmux
- tree
- unzip
- vim-gtk
- zsh
- name: set up desktop environments
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- i3
- i3lock
- name: set up xprogs
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- arandr
- evince
- feh
- firefox
- gparted
- scrot
- vlc

View File

@ -0,0 +1,2 @@
go_version: 1.20.3
bazelisk_version: 1.16.0

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
- name: Restart docker service
become: true
ansible.builtin.service:
name: docker
state: restarted
listen: "restart docker service"

View File

@ -0,0 +1,210 @@
- name: install dev tools
ansible.builtin.apt: name={{ item }} state=present
become: true
with_items:
- autoconf
- automake
- build-essential
- clang
- cloc
- cmake
- devscripts
- erlang
- gcc
- golang-google-genproto-dev
- golang-goprotobuf-dev
- golang-protobuf-extensions-dev
- git
- ipython3
- libprotobuf-dev
- lua5.3
- luarocks
- make
- protobuf-compiler
- python3-pip
- sbcl
- texinfo
- tig
- zlib1g
- zlib1g-dev
## golang
- name: install godeb
become: true
ansible.builtin.unarchive:
src: "{{ role_path }}/files/godeb-amd64.tar.gz"
dest: /usr/local/bin
creates: /usr/local/bin/godeb
- name: install go
become: true
ansible.builtin.command: godeb install "{{ go_version }}"
args:
chdir: /tmp
creates: /usr/local/go/bin/go
## bazel
- name: "install bazelisk v{{ bazelisk_version }}"
ansible.builtin.get_url:
checksum: sha256:168851e70cf5f95c0e215e7f3aaca5132ffc3c8dd8f585a4157b0be2b53cfe32
dest: "/home/{{ laptop_user }}/.local/bin/bazelisk"
mode: 0755
url: "https://github.com/bazelbuild/bazelisk/releases/download/v{{ bazelisk_version }}/bazelisk-linux-amd64"
# the process of getting buildifier in an automated way is onerous, ergo
# this hack.
- name: install buildifier
ansible.builtin.unarchive:
src: "{{ role_path }}/files/buildifier.tgz"
dest: "/home/{{ laptop_user }}/.local/bin"
creates: "/home/{{ laptop_user }}/.local/bin/buildifier"
## virtualization and containerization
- name: ensure repository key is installed
become: true
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: ensure docker registry is available
become: true
ansible.builtin.apt_repository: repo='deb https://download.docker.com/linux/ubuntu bionic stable' state=present
- name: rootfs building tools
ansible.builtin.apt: name={{ item }} state=present
become: true
with_items:
- dracut
- fusecram
- genext2fs
- genisoimage
- genromfs
- initramfs-tools
- makebootfat
- mmdebstrap
- proot
- pxelinux
- syslinux
- syslinux-efi
- syslinux-utils
- name: install container and virtualisation management
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- conman
- crun
- docker-ce
- docker-compose
- ipxe-qemu
- kvmtool
- podman
- qemubuilder
- qemu-efi-aarch64
- qemu-efi-arm
- qemu-system-arm
- qemu-system
- qemu-system-x86
- qemu-system-gui
- qemu-user-static
- sbuild-qemu
- seabios
- u-boot-qemu
- virt-manager
- virt-top
notify: "restart docker service"
- name: Ensure kvm group exists
become: true
ansible.builtin.group:
name: kvm
state: present
- name: Ensure docker group exists
become: true
ansible.builtin.group:
name: docker
state: present
- name: add laptop user {{ laptop_user }} to docker group
become: true
ansible.builtin.user:
name: "{{ laptop_user }}"
append: true
groups:
- docker
## embedded dev stuff
- name: installed embedded dev tools
ansible.builtin.apt: name={{ item }} state=present
become: true
with_items:
- avr-libc
- avrdude
- binutils-arm-none-eabi
- binutils-arm-linux-gnueabi
- binutils-arm-linux-gnueabihf
- binutils-avr
- gcc-arm-none-eabi
- gcc-arm-linux-gnueabi
- gcc-arm-linux-gnueabihf
- gcc-avr
- libstdc++-arm-none-eabi-newlib
- picocom
- pulseview
- sigrok
## documentation stuff
- name: install documentation tooling
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- asciidoc
- doxygen
- pelican
- pelican-doc
- python3-sphinx
- scdoc
## vscode
- name: add VS Code repo key
become: true
ansible.builtin.apt_key:
url: https://packages.microsoft.com/keys/microsoft.asc
state: present
validate_certs: yes
- name: add VS Code repo
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
state: present
validate_certs: yes
- name: install VS Code
become: true
ansible.builtin.apt: name=code state=present
## AI/ML stuff
- name: install machine learning and AI tools
become: true
ansible.builtin.apt:
name: "{{item}}"
state: present
with_items:
- jupyter-notebook
- name: install machine learning and AI python packages
ansible.builtin.pip:
executable: pip3
name: "{{item}}"
extra_args: --user
with_items:
- Keras
- numpy
- scikit-learn
- scipy
- tensorflow
- torch

1
roles/dotfiles/files Submodule

@ -0,0 +1 @@
Subproject commit 07acc59d73dc62afd9a78cb403faaaea22847a61

View File

@ -0,0 +1,38 @@
- name: copy emacsd configuration
ansible.builtin.copy:
src: "{{ role_path }}/files/.emacs.d"
dest: "/home/{{ laptop_user }}/"
directory_mode: 0755
force: false
- name: create binary directory
ansible.builtin.file:
path: "/home/{{ laptop_user }}/.local/bin"
state: directory
mode: 0755
- name: copy em
ansible.builtin.copy:
src: "{{ role_path }}/files/bin/em"
dest: "/home/{{ laptop_user }}/.local/bin/em"
mode: 0755
- name: copy various dotfiles
ansible.builtin.copy:
src: "{{ role_path }}/files/{{ item }}"
dest: "/home/{{ laptop_user }}/{{ item }}"
mode: 0644
with_items:
- .gitconfig
- .gitignore_global
- .hgrc
- .mg
- .vimrc
- .XCompose
- name: copy vim directory
ansible.builtin.copy:
src: "{{ role_path }}/files/.vim"
dest: "/home/{{ laptop_user }}/"
directory_mode: 0755
force: false

View File

@ -0,0 +1,63 @@
- name: install Obsidian
ansible.builtin.get_url:
checksum: sha256:f215c1d30545ee9a9803a170df920bf8fa2d5e0a8fa87a21620bca11ae20b9dc
url: https://github.com/obsidianmd/obsidian-releases/releases/download/v1.1.16/Obsidian-1.1.16.AppImage
dest: "/home/{{ laptop_user }}/.local/bin/obsidian"
- name: add signal repo key
become: true
ansible.builtin.apt_key:
url: https://updates.signal.org/desktop/apt/keys.asc
state: present
validate_certs: yes
- name: add signal repo
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main
state: present
validate_certs: yes
- name: install signal desktop
become: true
ansible.builtin.apt: name=signal-desktop state=present
- name: add element repo key
become: true
ansible.builtin.apt_key:
url: https://packages.element.io/debian/element-io-archive-keyring.gpg
state: present
validate_certs: yes
- name: add element repo
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://packages.element.io/debian/ default main
state: present
validate_certs: yes
- name: install element desktop
become: true
ansible.builtin.apt: name=element-desktop state=present
- name: install larger packages
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- chromium-browser
- redshift
- snapd
- texlive-full
- name: install snap packages
become: true
community.general.snap: name={{ item }}
with_items:
- bitwarden
- spotify
- name: install heroku toolkit from snap
become: true
community.general.snap:
name: heroku
classic: true

8
site.yml Normal file
View File

@ -0,0 +1,8 @@
- hosts: laptop
roles:
- base
- dotfiles
- development
- heavy
vars:
laptop_user: kyle