Move install-prefs to Ansible

I never ended up moving to this installation system, did I?
prenix
Geoffrey Frogeye 2021-06-19 16:52:28 +02:00
parent fb5a885e3c
commit 16bb2362ad
Signed by: geoffrey
GPG Key ID: C72403E7F82E6AD8
9 changed files with 124 additions and 138 deletions

View File

@ -21,3 +21,5 @@ has_battery: no
# Activate numlock by default
auto_numlock: no
# Machine has SSH key to access git.frogeye.fr
has_forge_access: no

View File

@ -9,3 +9,4 @@ dev_stuffs:
software_full: yes
has_battery: yes
auto_numlock: yes
has_forge_access: yes

View File

@ -1,4 +1,4 @@
- name: Ensure directories for theme are present
- name: Ensure directories for desktop applications are present
file:
state: directory
path: "{{ ansible_user_dir }}/{{ item }}"
@ -153,6 +153,16 @@
tags:
- color
- name: Enable user services
systemd:
name: "{{ item }}"
state: started
enabled: yes
scope: user
loop:
- pulseaudio
- mpd
# TODO bar (might change bar in the future, so...)
# TODO highlight (there IS a template but the colors look different from vim and mostly the same from when there's no config)
# TODO https://github.com/makuto/auto-base16-theme ? :P

View File

@ -1,9 +1,28 @@
- name: Ensure directories for applications are present
file:
state: directory
path: "{{ ansible_user_dir }}/{{ item }}"
mode: "u=rwx,g=rx,o=rx"
with_items:
- ".cache/zsh"
- ".cache/mpd"
- ".ssh"
- ".local/bin"
- name: Install dotfiles repository
git:
repo: https://git.frogeye.fr/geoffrey/dotfiles.git
repo: "{% if has_forge_access %}git@git.frogeye.fr:{% else %}https://git.frogeye.fr/{% endif %}geoffrey/dotfiles.git"
dest: "{{ ansible_user_dir }}/.dotfiles"
update: "{{ not has_forge_access }}"
notify: install dotfiles
- name: Install python dependencies for scripts
pip:
requirements: "{{ ansible_user_dir }}/.dotfiles/config/scripts/requirements.txt"
- name: Install Neovim plugins
command: "nvim +PlugUpgrade +PlugUpdate +PlugInstall +qall"
failed_when: no
changed_when: yes
# TODO Build Neovim configuration better

View File

@ -57,6 +57,60 @@
# WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
# You should consider upgrading via the '/data/data/com.termux/files/usr/bin/python3 -m pip install --upgrade pip' command.
# Arch configuration
- name: Install ccache
pacman:
name: ccache
state: present
extra_args: "--asdeps"
become: yes
when: arch_based
- name: Enable makepkg ccache
replace:
path: /etc/makepkg.conf
regexp: '^BUILDENV=(.+)!ccache(.+)$'
replace: 'BUILDENV=\1ccache\2'
become: yes
when: arch_based
- name: Set makepkg MAKEFLAGS
replace:
path: /etc/makepkg.conf
regexp: '^#? *MAKEFLAGS=(.+)-j[0-9]+(.+)$'
replace: "MAKEFLAGS=\\1-j{{ j }}\\2"
become: yes
vars:
j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}"
when: arch_based
- name: Enable makepkg color
replace:
path: /etc/makepkg.conf
regexp: '^BUILDENV=(.+)!color(.+)$'
replace: 'BUILDENV=\1color\2'
become: yes
when: arch_based
- name: Enable pacman colors
lineinfile:
path: /etc/pacman.conf
regexp: "^#?Color"
line: "Color"
become: yes
when: arch_based
- name: Enable pacman pac-man
lineinfile:
path: /etc/pacman.conf
regexp: "^#?ILoveCandy"
line: "ILoveCandy"
insertafter: "^#?Color"
become: yes
when: arch_based
# Install alternative package managers
- name: Install dependencies for AUR helpers
pacman:
@ -108,3 +162,13 @@
notify: "software changed"
tags: softwarelist
when: arch_based and root_access
# translate-shell
# $ curl -L git.io/trans > ~/.local/bin/trans
# $ chmod +x ~/.local/bin/trans
# sct
# $ TMP=$(mktemp /tmp/XXXXXXXXXX.c)
# $ wget https://gist.githubusercontent.com/ajnirp/208c03d3aa7f02c743d2/raw/55bf3eed25739173d8be57b5179ed5542cf40ed6/sct.c -O $TMP
# $ cc $TMP --std=c99 -lX11 -lXrandr -o $HOME/.local/bin/sct
# $ rm $TMP

View File

@ -0,0 +1,5 @@
etckeeper
tlp
dhcpcd
wpa_supplicant
chrony

View File

@ -0,0 +1,10 @@
***************
*** 6,11 ****
--- 6,12 ----
{
include "us(basic)"
include "level3(ralt_switch)"
+ include "keypad(oss)"
name[Group1]= "US keyboard with french symbols - AltGr combination";

View File

@ -1,24 +1,9 @@
# TODO For other distributions
- name: Set variables
set_fact:
arch_based: "{{ ansible_distribution == 'Archlinux' }}"
# arch: "{{ ansible_lsb.id == 'Arch' }}"
# manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}"
# termux: "{{ ansible_distribution == 'OtherLinux' and ansible_python.executable == '/data/data/com.termux/files/usr/bin/python' }}"
# debian_based: "{{ ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' }}"
# debian: "{{ ansible_distribution == 'Debian' }}"
# ubuntu: "{{ ansible_distribution == 'Ubuntu' }}"
# Package are installed with --asdeps because they are needed
# Etckeeper
- name: Install etckeeper (Arch based)
pacman:
name: etckeeper
state: present
become: yes
when: arch_based
- name: Check if etckeeper is initialized
stat:
path: /etc/.git
@ -44,58 +29,6 @@
value: "etckeeper@{{ inventory_hostname }}"
become: yes
# Arch configuration
- name: Install ccache
pacman:
name: ccache
state: present
become: yes
when: arch_based
- name: Enable makepkg ccache
replace:
path: /etc/makepkg.conf
regexp: '^BUILDENV=(.+)!ccache(.+)$'
replace: 'BUILDENV=\1ccache\2'
become: yes
when: arch_based
- name: Set makepkg MAKEFLAGS
replace:
path: /etc/makepkg.conf
regexp: '^#? *MAKEFLAGS=(.+)-j[0-9]+(.+)$'
replace: "MAKEFLAGS=\\1-j{{ j }}\\2"
become: yes
vars:
j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}"
when: arch_based
- name: Enable makepkg color
replace:
path: /etc/makepkg.conf
regexp: '^BUILDENV=(.+)!color(.+)$'
replace: 'BUILDENV=\1color\2'
become: yes
when: arch_based
- name: Enable pacman colors
lineinfile:
path: /etc/pacman.conf
regexp: "^#?Color"
line: "Color"
become: yes
when: arch_based
- name: Enable pacman pacman
lineinfile:
path: /etc/pacman.conf
regexp: "^#?ILoveCandy"
line: "ILoveCandy"
insertafter: "^#?Color"
become: yes
when: arch_based
# Manjaro configuration
- name: Remove Manjaro's pamac
@ -131,6 +64,15 @@
notify: etc changed
loop: "{{ xorg_common_config_dirs }}"
- name: Use Alt keys for numpad
patch:
src: us_qwert_alt_numpad.patch
dest: /usr/share/X11/xkb/symbols/us_qwerty-fr
become: yes
when: display_server == 'x11'
# This is not very nice but it's updated so infrequently that it's not worth
# the trouble
- name: Check if there is Intel backlight
stat:
path: /sys/class/backlight/intel_backlight
@ -144,6 +86,7 @@
state: present
become: yes
when: display_server == 'x11' and intel_backlight.stat.exists and arch_based
# TODO With software role? Would permit other distributions
- name: Configure Xorg Intel backlight
copy:
@ -196,13 +139,6 @@
# TLP configuration
- name: Install TLP (Arch based)
pacman:
name: tlp
state: present
when: arch_based
become: yes
- name: Start/enable TLP
systemd:
name: tlp
@ -213,13 +149,6 @@
# Network configuration
- name: Install dhcpcd (Arch based)
pacman:
name: dhcpcd
state: present
when: arch_based
become: yes
- name: Start/enable dhcpcd
systemd:
name: dhcpcd
@ -228,15 +157,6 @@
become: yes
notify: etc changed
- name: Install wpa_supplicant (Arch based)
pacman:
name: wpa_supplicant
state: present
when: arch_based
become: yes
notify:
- wifi setup changed
- name: Configure wpa_supplicant
template:
src: wpa_supplicant.conf.j2
@ -309,13 +229,6 @@
notify: etc changed
when: arch_based
- name: Install chrony
pacman:
name: chrony
state: present
when: arch_based
become: yes
- name: Configure chrony
copy:
src: chrony.conf

View File

@ -1,38 +0,0 @@
#!/usr/bin/env bash
# Installs user preferences the way I like it
# NOTE In the process of migrating to a new install workflow.
# This holds stuff that have not been migrated yet.
# TODO A lot of stuff
mkdir -p $HOME/.cache
mkdir -p $HOME/.cache/zsh
mkdir -p $HOME/.cache/mpd
mkdir -p $HOME/.ssh
# mkdir -p $HOME/.local/bin
echo "Doing stuff cuz"
vim +PlugUpgrade +PlugUpdate +PlugInstall +qall
systemctl enable pulseaudio --user --now
systemctl enable mpd --user --now
echo '# Alt keys on keypad
# In /usr/share/X11/xkb/symbols/us_qwerty-fr add:
# include "keypad(oss)"
'
### RECYCLE BIN
# Help yourself
# # translate-shell
# curl -L git.io/trans > ~/.local/bin/trans
# chmod +x ~/.local/bin/trans
# # sct
# TMP=$(mktemp /tmp/XXXXXXXXXX.c)
# wget https://gist.githubusercontent.com/ajnirp/208c03d3aa7f02c743d2/raw/55bf3eed25739173d8be57b5179ed5542cf40ed6/sct.c -O $TMP
# cc $TMP --std=c99 -lX11 -lXrandr -o $HOME/.local/bin/sct
# rm $TMP