initial commit
This commit is contained in:
commit
e61fe7e3f7
16 changed files with 740 additions and 0 deletions
3
ansible/README.md
Normal file
3
ansible/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
https://runebook.dev/fr/docs/ansible/collections/community/general/pacman_module
|
||||
https://docs.ansible.com/ansible/2.8/modules/pacman_module.html
|
||||
https://docs.ansible.com/ansible/latest/collections/community/general/pacman_module.html
|
||||
16
ansible/ansible.cfg
Normal file
16
ansible/ansible.cfg
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[defaults]
|
||||
remote_user = root
|
||||
#nocows = True
|
||||
gathering = smart
|
||||
fact_caching = jsonfile
|
||||
interpreter_python = /usr/bin/python3
|
||||
strategy = free
|
||||
forks = 2
|
||||
|
||||
# two hours timeout
|
||||
fact_caching_timeout = 7200
|
||||
fact_caching_uri = ./.fact_cache.json
|
||||
|
||||
[ssh_connection]
|
||||
# when developing on local machine
|
||||
pipelining = True
|
||||
1
ansible/arch_packages.json
Normal file
1
ansible/arch_packages.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
["util-linux", "less", "git", "moreutils", "tmux", "openssh", "base-devel", "moreutils", "fzf", "lf", "ripgrep", "fd", "bat", "pv", "at", "jo", "jq", "fx", "yq", "xsv", "unzip", "unoconv", "pandoc", "libqalculate", "wget", "nmap", "wireguard-tools", "tcpdump", "socat", "rsync", "rclone", "lsof", "w3m", "acpi", "smartmontools", "lshw", "ffmpeg", "imagemagick", "mpv", "yt-dlp", "tesseract", "tesseract-data-fra", "tesseract-data-eng", "gopass", "vim", "helix", "gcc", "make", "jwt-cli", "fish", "dash", "pavucontrol", "wev", "wtype", "wl-clipboard", "wofi", "sway", "swaylock", "swayidle", "cliphist", "firefox-developer-edition", "torbrowser-launcher", "alacritty", "thunderbird", "zathura", "krita", "inkscape", "libreoffice-still", "ttf-font-awesome", "ttf-fira-code"]
|
||||
133
ansible/arch_packages.yaml
Normal file
133
ansible/arch_packages.yaml
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
categories:
|
||||
base:
|
||||
- util-linux
|
||||
- less
|
||||
- git
|
||||
- moreutils
|
||||
- tmux
|
||||
- openssh
|
||||
- base-devel
|
||||
|
||||
utils:
|
||||
_:
|
||||
- moreutils
|
||||
- fzf
|
||||
- lf
|
||||
- ripgrep
|
||||
- fd
|
||||
- bat
|
||||
- name: pv
|
||||
desc: pipe viewer
|
||||
- name: at
|
||||
desc: scheduler
|
||||
text_processing:
|
||||
json:
|
||||
- jo
|
||||
- jq
|
||||
- fx
|
||||
yaml:
|
||||
- yq
|
||||
csv:
|
||||
- xsv # rust CSV toolkit
|
||||
archives:
|
||||
- unzip
|
||||
bureautique:
|
||||
- unoconv # can be used to export ODT to pdf
|
||||
- pandoc # general purpose document converter
|
||||
math:
|
||||
- libqalculate # qalc
|
||||
network:
|
||||
- wget
|
||||
- nmap
|
||||
- wireguard-tools
|
||||
- tcpdump
|
||||
- socat # TCP proxy or relay
|
||||
- rsync
|
||||
- rclone
|
||||
fs:
|
||||
- lsof
|
||||
tui:
|
||||
browser:
|
||||
- w3m
|
||||
|
||||
hardware:
|
||||
- acpi
|
||||
- smartmontools # monitor drive (SSD) health
|
||||
- lshw
|
||||
|
||||
multimedia:
|
||||
- ffmpeg
|
||||
- imagemagick
|
||||
- mpv
|
||||
- yt-dlp
|
||||
- tesseract
|
||||
- tesseract-data-fra
|
||||
- tesseract-data-eng
|
||||
|
||||
security:
|
||||
- gopass
|
||||
|
||||
dev:
|
||||
editor:
|
||||
- vim
|
||||
- helix
|
||||
c:
|
||||
- gcc
|
||||
- make
|
||||
|
||||
http_utils:
|
||||
- jwt-cli
|
||||
|
||||
shell:
|
||||
- fish
|
||||
- aur/fish-fzf
|
||||
- name: dash
|
||||
desc: Simple POSIX compliant shell
|
||||
|
||||
- name: aur/shellcheck-bin
|
||||
desc: Static analyzer for shell script
|
||||
|
||||
sound:
|
||||
control:
|
||||
- pavucontrol
|
||||
|
||||
desktop:
|
||||
wayland:
|
||||
- wev
|
||||
- wtype
|
||||
- wl-clipboard
|
||||
- name: wofi
|
||||
desc: remplacement for rofi
|
||||
- sway
|
||||
- swaylock
|
||||
- swayidle
|
||||
|
||||
desktop_utils:
|
||||
- cliphist
|
||||
|
||||
GUI:
|
||||
browser:
|
||||
- firefox-developer-edition
|
||||
- torbrowser-launcher
|
||||
terminal_emulator:
|
||||
- alacritty
|
||||
mail:
|
||||
- thunderbird
|
||||
viewer:
|
||||
- zathura
|
||||
images:
|
||||
art:
|
||||
- krita
|
||||
svg:
|
||||
- inkscape
|
||||
bureautique:
|
||||
- libreoffice-still
|
||||
geo:
|
||||
- aur/mepo
|
||||
_:
|
||||
- name: aur/screen-message
|
||||
description: Utility to write in big on the screen
|
||||
|
||||
fonts:
|
||||
- ttf-font-awesome
|
||||
- ttf-fira-code
|
||||
5
ansible/inventory.yaml
Normal file
5
ansible/inventory.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
workstation:
|
||||
hosts:
|
||||
127.0.0.1: {}
|
||||
# 192.168.11.229: {}
|
||||
35
ansible/parse_arch_packages.py
Normal file
35
ansible/parse_arch_packages.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import json
|
||||
import yaml
|
||||
|
||||
packages_tree = None
|
||||
with open("arch_packages.yaml", 'r') as config_f:
|
||||
packages_tree = yaml.safe_load(config_f)
|
||||
|
||||
assert packages_tree is not None, "Must have load valid package tree"
|
||||
|
||||
def flatten_packages(item):
|
||||
packages = []
|
||||
if isinstance(item, str):
|
||||
return {'name': item}
|
||||
if isinstance(item, dict) and 'name' in item:
|
||||
return item
|
||||
if isinstance(item, list):
|
||||
return [flatten_packages(p) for p in item]
|
||||
if isinstance(item, dict):
|
||||
packages = []
|
||||
for k, v in item.items():
|
||||
packages += flatten_packages(v)
|
||||
return packages
|
||||
return []
|
||||
|
||||
flat_packages = flatten_packages(packages_tree)
|
||||
|
||||
names = []
|
||||
for p in flat_packages:
|
||||
assert isinstance(p, dict)
|
||||
if p['name'].startswith('aur/'):
|
||||
continue
|
||||
names.append(p['name'])
|
||||
|
||||
print(json.dumps(names))
|
||||
# print(' '.join(names))
|
||||
8
ansible/roles/popequer_notebook/tasks/main.yaml
Normal file
8
ansible/roles/popequer_notebook/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
- name: Create dir
|
||||
file:
|
||||
path: /home/mbess/notebooks
|
||||
state: directory
|
||||
- name: Clone personal notebook
|
||||
ansible.builtin.git:
|
||||
repo: "git@forge.lefuturiste.fr:mbess/main-popequer-notebook.git"
|
||||
dest: /home/mbess/notebooks/personal
|
||||
18
ansible/run_ansible_playbook.sh
Executable file
18
ansible/run_ansible_playbook.sh
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
workdir="$(pwd)"
|
||||
base="$(realpath $(dirname "$0"))"
|
||||
|
||||
export ANSIBLE_CACHE_PLUGIN=jsonfile
|
||||
export ANSIBLE_CONFIG=$base/ansible.cfg
|
||||
|
||||
cd $base
|
||||
python3 parse_arch_packages.py > arch_packages.json
|
||||
cd $workdir
|
||||
|
||||
ansible-playbook $base/workstation.yaml \
|
||||
--ask-become-pass \
|
||||
-u "mbess" \
|
||||
-i "$base/inventory.yaml" \
|
||||
--ssh-extra-args "-o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2222 -i ./sshkey" \
|
||||
--extra-vars "@$base/vars.yaml"
|
||||
0
ansible/vars.example.yaml
Normal file
0
ansible/vars.example.yaml
Normal file
4
ansible/vars.yaml
Normal file
4
ansible/vars.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
user: mbess
|
||||
foo: barladladsl
|
||||
device_name: grayblower
|
||||
|
||||
65
ansible/workstation.yaml
Normal file
65
ansible/workstation.yaml
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
- hosts: workstation
|
||||
gather_facts: False
|
||||
vars:
|
||||
config_files:
|
||||
- dir: tmux
|
||||
name: tmux.conf
|
||||
- dir: alacritty
|
||||
name: alacritty.toml
|
||||
- dir: wofi
|
||||
name: style.css
|
||||
tasks:
|
||||
- name: Init arch
|
||||
block:
|
||||
- file:
|
||||
path: /home/mbess/.workstation_setup_state
|
||||
state: touch
|
||||
- copy: content="2024-05-20T11:28:07.552Z c385e8f1-9f34-47d3-9155-0cc1f04c4550" dest=/home/mbess/.workstation_setup_state
|
||||
- name: Install some packages
|
||||
become: true
|
||||
community.general.pacman:
|
||||
name:
|
||||
- jq
|
||||
- fx
|
||||
- jo
|
||||
- yq
|
||||
|
||||
- name: Install packages from YAML files (excluding AUR)
|
||||
become: true
|
||||
community.general.pacman:
|
||||
name: "{{ lookup('file', 'arch_packages.json') | from_json }}" # the python script will return a list of packages
|
||||
|
||||
# - name: Install yay, an AUR helper
|
||||
|
||||
|
||||
- name: Clone books sources
|
||||
ansible.builtin.git:
|
||||
repo: "git@forge.lefuturiste.fr:mbess/books-sources.git"
|
||||
dest: /home/mbess/workspace/books_sources
|
||||
- name: Setup config directories
|
||||
file:
|
||||
path: "/home/mbess/.config/{{ item.dir }}"
|
||||
state: directory
|
||||
recurse: true
|
||||
loop: "{{ config_files }}"
|
||||
- name: Setup symbolic links to config files
|
||||
file:
|
||||
src: "/home/mbess/.dots/config/{{ item.dir }}/{{ item.name }}"
|
||||
dest: "/home/mbess/.config/{{ item.dir }}/{{ item.name }}"
|
||||
state: link
|
||||
loop: "{{ config_files }}"
|
||||
- name: Setup main popequer notebook
|
||||
include_role:
|
||||
name: popequer_notebook
|
||||
|
||||
- name: Setup quick notes folder
|
||||
file:
|
||||
path: "/home/mbess/.hidden/quick_notes/"
|
||||
state: directory
|
||||
recurse: true
|
||||
- name: Setup temporary secrets folder (cookies jar)
|
||||
file:
|
||||
path: "/home/mbess/.cache/secrets/"
|
||||
state: directory
|
||||
recurse: true
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue