Compare commits

..

No commits in common. "9c3dcba2e59df66b6b1945caccb107208b8252b5" and "5cb4e9f3f6599a1733ff234ca77e99cf060f4f3c" have entirely different histories.

18 changed files with 340 additions and 347 deletions

View file

@ -1,4 +1,3 @@
---
- name: Default - name: Default
hosts: all hosts: all
roles: roles:

View file

@ -1,23 +1,22 @@
---
- name: Set variables - name: Set variables
ansible.builtin.set_fact: set_fact:
manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}" manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}"
- name: Enable passwordless sudo access to wheel group (Others) - name: Enable passwordless sudo access to wheel group (Others)
ansible.builtin.lineinfile: lineinfile:
path: /etc/sudoers path: /etc/sudoers
line: "%wheel ALL=(ALL) NOPASSWD: ALL" line: "%wheel ALL=(ALL) NOPASSWD: ALL"
regexp: "^#? *%wheel ALL=\\(ALL\\) NOPASSWD: ALL$" regexp: "^#? *%wheel ALL=\\(ALL\\) NOPASSWD: ALL$"
become: true become: yes
when: not manjaro when: not manjaro
- name: Enable passwordless sudo access to wheel group (Manjaro) - name: Enable passwordless sudo access to wheel group (Manjaro)
ansible.builtin.copy: copy:
content: "%wheel ALL=(ALL) NOPASSWD: ALL" content: "%wheel ALL=(ALL) NOPASSWD: ALL"
dest: /etc/sudoers.d/11-wheel-nopasswd dest: /etc/sudoers.d/11-wheel-nopasswd
mode: u=rwx,g=rx,o= mode: "u=rwx,g=rx,o="
when: manjaro when: manjaro
become: true become: yes
# /etc/sudoers.d/10-installer is the same thing, # /etc/sudoers.d/10-installer is the same thing,
# but **with** a password, and it's overwritten # but **with** a password, and it's overwritten
# with each upgrade of manjaro-system, hence this. # with each upgrade of manjaro-system, hence this.

View file

@ -1,11 +1,14 @@
--- - name: xrdb-reload
- name: Xrdb-reload command: "xrdb -I{{ ansible_env.HOME }} {{ ansible_env.HOME }}/.config/Xresources/main"
ansible.builtin.command: xrdb -I{{ ansible_env.HOME }} {{ ansible_env.HOME }}/.config/Xresources/main
- name: I3-reload - name: i3-reload
ansible.builtin.command: i3-msg reload command: i3-msg reload
- name: Shell-reload
ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" - name: shell-reload
- name: Fzf-reload command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
ansible.builtin.command: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf
- name: Qutebrowser-reload - name: fzf-reload
ansible.builtin.shell: "! pgrep qutebrowser || qutebrowser :config-source" shell: "source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf"
- name: qutebrowser-reload
shell: "! pgrep qutebrowser || qutebrowser :config-source"

View file

@ -1,24 +1,22 @@
---
- name: Ensure directories for desktop applications are present - name: Ensure directories for desktop applications are present
ansible.builtin.file: file:
state: directory state: directory
path: "{{ ansible_user_dir }}/{{ item }}" path: "{{ ansible_user_dir }}/{{ item }}"
mode: u=rwx,g=rx,o=rx mode: "u=rwx,g=rx,o=rx"
with_items: with_items:
- .config/Xresources - ".config/Xresources"
- .config/rofi - ".config/rofi"
- .local/bin - ".local/bin"
- .local/share/fonts - ".local/share/fonts"
- .config/qutebrowser - ".config/qutebrowser"
- .config/tridactyl/themes - ".config/tridactyl/themes"
# Download fonts # Download fonts
- name: Download Nerd fonts - name: Download Nerd fonts
ansible.builtin.get_url: get_url:
url: https://raw.githubusercontent.com/ryanoasis/nerd-fonts/704336735f576781b2a57b12a0c723e3316cbdec/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{ url: "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{ item.filename | urlencode }}"
item.filename | urlencode }}
dest: "{{ ansible_user_dir }}/.local/share/fonts/{{ item.filename }}" dest: "{{ ansible_user_dir }}/.local/share/fonts/{{ item.filename }}"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
loop: loop:
- filename: DejaVu Sans Mono Bold Nerd Font Complete Mono.ttf - filename: DejaVu Sans Mono Bold Nerd Font Complete Mono.ttf
folder: Bold folder: Bold
@ -30,16 +28,15 @@
folder: Italic folder: Italic
- name: Download icon fonts - name: Download icon fonts
ansible.builtin.get_url: get_url:
url: https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/fonts/fontawesome-webfont.ttf url: "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/fonts/fontawesome-webfont.ttf"
dest: "{{ ansible_user_dir }}/.local/share/fonts/fontawesome-webfont.ttf" dest: "{{ ansible_user_dir }}/.local/share/fonts/fontawesome-webfont.ttf"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
# TODO Either replace with ForkAwesome or Nerd Fonts # TODO Either replace with ForkAwesome or Nerd Fonts
- name: Install python dependencies for lemonbar - name: Install python dependencies for lemonbar
ansible.builtin.pip: pip:
requirements: "{{ ansible_user_dir }}/.dotfiles/config/lemonbar/requirements.txt" requirements: "{{ ansible_user_dir }}/.dotfiles/config/lemonbar/requirements.txt"
extra_args: --break-system-packages # It's fine, it's local anyways
# Build a single color scheme and template and assign it to a variable # Build a single color scheme and template and assign it to a variable
- base16_builder: - base16_builder:
@ -61,20 +58,20 @@
- i3 - i3
- name: Configure Alacritty - name: Configure Alacritty
ansible.builtin.template: template:
src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2" src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2"
dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml" dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
# Alacritty has live config reload, so no command to execute # Alacritty has live config reload, so no command to execute
# However, it doesn't work with yaml includes, hence the template # However, it doesn't work with yaml includes, hence the template
tags: tags:
- color - color
- name: Set base16 theme for Xresources - name: Set base16 theme for Xresources
ansible.builtin.copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['xresources']['xresources']['base16-' + base16_scheme + '-256.Xresources'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['xresources']['xresources']['base16-' + base16_scheme + '-256.Xresources'] }}"
dest: "{{ ansible_env.HOME }}/.config/Xresources/theme" dest: "{{ ansible_env.HOME }}/.config/Xresources/theme"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
notify: notify:
- xrdb-reload - xrdb-reload
tags: tags:
@ -82,30 +79,30 @@
when: display_server == 'x11' when: display_server == 'x11'
- name: Download base16 theme for qutebrowser - name: Download base16 theme for qutebrowser
ansible.builtin.copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}"
dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py" dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
notify: notify:
- qutebrowser-reload - qutebrowser-reload
tags: tags:
- color - color
- name: Download base16 theme for Tridactyl - name: Download base16 theme for Tridactyl
ansible.builtin.copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['tridactyl']['base16-' + base16_scheme + '.config.py'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['tridactyl']['base16-' + base16_scheme + '.config.py'] }}"
# url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css" # url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css"
dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css" dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
when: false # Not currently used when: False # Not currently used
tags: tags:
- color - color
- name: Configure i3 - name: Configure i3
ansible.builtin.template: template:
src: "{{ ansible_env.HOME }}/.config/i3/config.j2" src: "{{ ansible_env.HOME }}/.config/i3/config.j2"
dest: "{{ ansible_env.HOME }}/.config/i3/config" dest: "{{ ansible_env.HOME }}/.config/i3/config"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
notify: notify:
- i3-reload - i3-reload
tags: tags:
@ -114,10 +111,10 @@
when: display_server == 'x11' when: display_server == 'x11'
- name: Set base16 theme for rofi - name: Set base16 theme for rofi
ansible.builtin.copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}"
dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}" dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
tags: tags:
- color - color
loop: loop:
@ -125,49 +122,49 @@
- rasi - rasi
- name: Configure Dunst - name: Configure Dunst
ansible.builtin.template: template:
src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2" src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2"
dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc" dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
tags: tags:
- color - color
when: display_server == 'x11' when: display_server == 'x11'
- name: Download base16 theme for fzf - name: Download base16 theme for fzf
ansible.builtin.copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf" dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
notify: notify:
- fzf-reload - fzf-reload
tags: tags:
- color - color
- name: Download base16 theme for shell - name: Download base16 theme for shell
ansible.builtin.copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
mode: u=rwx,g=rx,o=rx mode: "u=rwx,g=rx,o=rx"
notify: notify:
- shell-reload - shell-reload
when: false # Not currently used when: False # Not currently used
tags: tags:
- color - color
- name: Set used base16 theme for vim - name: Set used base16 theme for vim
ansible.builtin.copy: copy:
path: "{{ ansible_env.HOME }}/.config/vim/colorscheme.vim" path: "{{ ansible_env.HOME }}/.config/vim/colorscheme.vim"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
content: colorscheme base16-{{ base16_scheme }} content: "colorscheme base16-{{ base16_scheme }}"
when: false # Not currently used when: False # Not currently used
tags: tags:
- color - color
- name: Enable user services - name: Enable user services
ansible.builtin.systemd: systemd:
name: "{{ item }}" name: "{{ item }}"
state: started state: started
enabled: true enabled: yes
scope: user scope: user
loop: loop:
- pulseaudio - pulseaudio

View file

@ -1,3 +1,3 @@
--- - name: install dotfiles
- name: Install dotfiles command: "{{ ansible_user_dir }}/.dotfiles/config/scripts/dotfiles install"
ansible.builtin.command: "{{ ansible_user_dir }}/.dotfiles/config/scripts/dotfiles install" # TODO A python module to do that, so without an handler

View file

@ -1,32 +1,31 @@
---
- name: Ensure directories for applications are present - name: Ensure directories for applications are present
ansible.builtin.file: file:
state: directory state: directory
path: "{{ ansible_user_dir }}/{{ item }}" path: "{{ ansible_user_dir }}/{{ item }}"
mode: u=rwx,g=rx,o=rx mode: "u=rwx,g=rx,o=rx"
with_items: with_items:
- .cache/zsh - ".cache/zsh"
- .cache/mpd - ".cache/mpd"
- .ssh - ".ssh"
- .local/bin - ".local/bin"
- .ansible/collections/ansible_collections/geoffreyfrogeye - ".ansible/collections/ansible_collections/geoffreyfrogeye"
- name: Install dotfiles repository - name: Install dotfiles repository
ansible.builtin.git: git:
repo: "{% if has_forge_access %}git@git.frogeye.fr:{% else %}https://git.frogeye.fr/{% endif %}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" dest: "{{ ansible_user_dir }}/.dotfiles"
update: true update: yes
notify: install dotfiles notify: install dotfiles
tags: dotfiles_repo tags: dotfiles_repo
# TODO Put actual dotfiles in a subdirectory of the repo, so we don't have to put everything in config # TODO Put actual dotfiles in a subdirectory of the repo, so we don't have to put everything in config
- name: Register as Ansible collection - name: Register as Ansible collection
ansible.builtin.file: file:
state: link state: link
src: "{{ ansible_user_dir }}/.dotfiles/config/automatrop" src: "{{ ansible_user_dir }}/.dotfiles/config/automatrop"
path: "{{ ansible_user_dir }}/.ansible/collections/ansible_collections/geoffreyfrogeye/automatrop" path: "{{ ansible_user_dir }}/.ansible/collections/ansible_collections/geoffreyfrogeye/automatrop"
- name: Install python dependencies for scripts - name: Install python dependencies for scripts
ansible.builtin.pip: pip:
requirements: "{{ ansible_user_dir }}/.dotfiles/config/scripts/requirements.txt" requirements: "{{ ansible_user_dir }}/.dotfiles/config/scripts/requirements.txt"
extra_args: --break-system-packages # It's fine, it's local anyways

View file

@ -1,35 +1,34 @@
---
- name: Setup pam_encryptfs auth - name: Setup pam_encryptfs auth
ansible.builtin.blockinfile: blockinfile:
path: /etc/pam.d/system-auth path: /etc/pam.d/system-auth
block: | block: |
auth [success=1 default=ignore] pam_succeed_if.so service = systemd-user quiet auth [success=1 default=ignore] pam_succeed_if.so service = systemd-user quiet
auth required pam_ecryptfs.so unwrap auth required pam_ecryptfs.so unwrap
insertafter: ^(auth\s+required\s+pam_unix.so|auth\s+\[default=die\]\s+pam_faillock.so\s+authfail)$ insertafter: '^(auth\s+required\s+pam_unix.so|auth\s+\[default=die\]\s+pam_faillock.so\s+authfail)$'
marker: "# {mark} AUTOMATROP ECRYPTFS_AUTOMOUNT AUTH" marker: "# {mark} AUTOMATROP ECRYPTFS_AUTOMOUNT AUTH"
become: true become: yes
notify: notify:
- etc changed - etc changed
- name: Setup pam_encryptfs password - name: Setup pam_encryptfs password
ansible.builtin.blockinfile: blockinfile:
path: /etc/pam.d/system-auth path: /etc/pam.d/system-auth
block: | block: |
password optional pam_ecryptfs.so unwrap password optional pam_ecryptfs.so unwrap
insertbefore: ^(password\s+required\s+pam_unix.so|-password\s+\[success=1\s+default=ignore\]\s+pam_systemd_home.so)$ insertbefore: '^(password\s+required\s+pam_unix.so|-password\s+\[success=1\s+default=ignore\]\s+pam_systemd_home.so)$'
marker: "# {mark} AUTOMATROP ECRYPTFS_AUTOMOUNT PASSWORD" marker: "# {mark} AUTOMATROP ECRYPTFS_AUTOMOUNT PASSWORD"
become: true become: yes
notify: notify:
- etc changed - etc changed
- name: Setup pam_encryptfs session - name: Setup pam_encryptfs session
ansible.builtin.blockinfile: blockinfile:
path: /etc/pam.d/system-auth path: /etc/pam.d/system-auth
block: | block: |
session [success=1 default=ignore] pam_succeed_if.so service = systemd-user quiet session [success=1 default=ignore] pam_succeed_if.so service = systemd-user quiet
session optional pam_ecryptfs.so unwrap session optional pam_ecryptfs.so unwrap
insertafter: ^session\s+required\s+pam_unix.so$ insertafter: '^session\s+required\s+pam_unix.so$'
marker: "# {mark} AUTOMATROP ECRYPTFS_AUTOMOUNT SESSION" marker: "# {mark} AUTOMATROP ECRYPTFS_AUTOMOUNT SESSION"
become: true become: yes
notify: notify:
- etc changed - etc changed

View file

@ -1,14 +1,13 @@
---
- name: Load extensions - name: Load extensions
ansible.builtin.include_role: include_role:
name: geoffreyfrogeye.{{ extension }}automatrop.entry name: "geoffreyfrogeye.{{ extension }}automatrop.entry"
loop: "{{ extensions }}" loop: "{{ extensions }}"
loop_control: loop_control:
loop_var: extension loop_var: extension
tags: always tags: always
- name: Configure extensions rc sourcing - name: Configure extensions rc sourcing
ansible.builtin.template: template:
src: extrc.sh.j2 src: extrc.sh.j2
dest: "{{ ansible_user_dir }}/.config/shell/extrc" dest: "{{ ansible_user_dir }}/.config/shell/extrc"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"

View file

@ -1,6 +1,5 @@
---
- name: Set facts - name: Set facts
ansible.builtin.set_fact: set_fact:
arch_based: "{{ ansible_distribution == 'Archlinux' }}" arch_based: "{{ ansible_distribution == 'Archlinux' }}"
arch: "{{ ansible_lsb.id == 'Arch' }}" arch: "{{ ansible_lsb.id == 'Arch' }}"
manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}" manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}"
@ -12,7 +11,7 @@
- always - always
- name: Set composed facts - name: Set composed facts
ansible.builtin.set_fact: set_fact:
debian_based: "{{ debian or ubuntu }}" debian_based: "{{ debian or ubuntu }}"
can_chown: "{{ not junest }}" can_chown: "{{ not junest }}"
has_systemd: "{{ not junest }}" has_systemd: "{{ not junest }}"

View file

@ -1,23 +1,22 @@
---
- name: Create GnuPG directory - name: Create GnuPG directory
ansible.builtin.file: file:
path: "{{ gnupghome }}" path: "{{ gnupghome }}"
state: directory state: directory
mode: u=rwx mode: "u=rwx"
- name: Create GnuPG configuration files - name: Create GnuPG configuration files
ansible.builtin.file: file:
path: "{{ gnupghome }}/{{ item }}" path: "{{ gnupghome }}/{{ item }}"
state: file state: file
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
loop: loop:
- gpg-agent.conf - gpg-agent.conf
- gpg.conf - gpg.conf
- name: Configure GnuPG - name: Configure GnuPG
ansible.builtin.lineinfile: lineinfile:
path: "{{ gnupghome }}/gpg.conf" path: "{{ gnupghome }}/gpg.conf"
regex: ^#?\s*{{ item.key }}\s regex: "^#?\\s*{{ item.key }}\\s"
line: "{{ item.key }}{% if item.value is defined %} {{ item.value }}{% endif %}" line: "{{ item.key }}{% if item.value is defined %} {{ item.value }}{% endif %}"
loop: loop:
# Remove fluff # Remove fluff
@ -26,7 +25,7 @@
- key: no-comments - key: no-comments
# Output format that I prefer # Output format that I prefer
- key: keyid-format - key: keyid-format
value: "0xlong" value: 0xlong
# Show fingerprints # Show fingerprints
- key: with-fingerprint - key: with-fingerprint
# Make sure to show if key is invalid # Make sure to show if key is invalid

View file

@ -1,2 +1 @@
---
gnupghome: "{{ ansible_user_dir }}/.config/gnupg" gnupghome: "{{ ansible_user_dir }}/.config/gnupg"

View file

@ -1,24 +1,23 @@
---
- name: Create and install meta package for Arch Linux - name: Create and install meta package for Arch Linux
when: arch_based
block: block:
- name: Generate meta package PKGBUILD - name: Generate meta package PKGBUILD
ansible.builtin.template: template:
src: PKGBUILD.j2 src: PKGBUILD.j2
dest: "{{ ansible_user_dir }}/.cache/automatrop/PKGBUILD" dest: "{{ ansible_user_dir }}/.cache/automatrop/PKGBUILD"
listen: software changed listen: "software changed"
- name: Install meta package - name: Install meta package
aur: aur:
name: automatrop-packages-{{ inventory_hostname_short }} name: "automatrop-packages-{{ inventory_hostname_short }}"
local_pkgbuild: "{{ ansible_user_dir }}/.cache/automatrop" local_pkgbuild: "{{ ansible_user_dir }}/.cache/automatrop"
use: makepkg use: makepkg
state: latest state: latest
listen: software changed listen: "software changed"
when: root_access when: root_access
- name: Update pacman cache when: arch_based
community.general.pacman:
update_cache: true - name: update pacman cache
become: true pacman:
update_cache: yes
become: yes
when: arch_based when: arch_based

View file

@ -1,43 +1,43 @@
---
# TODO Install python if not done # TODO Install python if not done
# Or maybe not, it requires a lot of automation for something that can be done # Or maybe not, it requires a lot of automation for something that can be done
# very quickly manually and is usually already installed # very quickly manually and is usually already installed
- name: Install python-apt dependency for Termux - name: Install python-apt dependency for Termux
when: termux
vars:
version: 2.39
block: block:
# TODO Check if the correct version # TODO Check if the correct version
- name: Check for DistUtilsExtra (Termux) - name: Check for DistUtilsExtra (Termux)
ansible.builtin.command: python -c 'import DistUtilsExtra' command: python -c 'import DistUtilsExtra'
changed_when: false changed_when: False
rescue: rescue:
- name: Create temporarty folder for DistUtilsExtra (Termux) - name: Create temporarty folder for DistUtilsExtra (Termux)
ansible.builtin.tempfile: tempfile:
state: directory state: directory
suffix: python-distutils-extra suffix: python-distutils-extra
# path: /data/data/com.termux/files/usr/tmp/ # path: /data/data/com.termux/files/usr/tmp/
register: pde_tempdir register: pde_tempdir
- name: Download DistUtilsExtra (Termux) - name: Download DistUtilsExtra (Termux)
ansible.builtin.get_url: get_url:
url: https://launchpad.net/python-distutils-extra/trunk/{{ version }}/+download/python-distutils-extra-{{ version }}.tar.gz url: "https://launchpad.net/python-distutils-extra/trunk/{{ version }}/+download/python-distutils-extra-{{ version }}.tar.gz"
dest: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz" dest: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz"
- name: Extract DistUtilsExtra (Termux) - name: Extract DistUtilsExtra (Termux)
ansible.builtin.unarchive: unarchive:
src: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz" src: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz"
remote_src: true remote_src: yes
dest: "{{ pde_tempdir.path }}" dest: "{{ pde_tempdir.path }}"
- name: Install DistUtilsExtra (Termux) - name: Install DistUtilsExtra (Termux)
ansible.builtin.command: command:
cmd: python3 setup.py install cmd: python3 setup.py install
chdir: "{{ pde_tempdir.path }}/python-distutils-extra-{{ version }}" chdir: "{{ pde_tempdir.path }}/python-distutils-extra-{{ version }}"
when: termux
vars:
version: 2.39
- name: Install python-apt (Termux) - name: Install python-apt (Termux)
ansible.builtin.pip: pip:
name: python-apt name: python-apt
when: termux when: termux
@ -62,110 +62,116 @@
# TODO Patch sudo-fake so it allows using -u so `become` works # TODO Patch sudo-fake so it allows using -u so `become` works
- name: Enable multilib repo - name: Enable multilib repo
ansible.builtin.lineinfile: lineinfile:
path: /etc/pacman.conf path: /etc/pacman.conf
regexp: ^#?\s*\[multilib\]$ regexp: '^#?\s*\[multilib\]$'
line: "[multilib]" line: '[multilib]'
become: true become: yes
when: arch_based and ansible_architecture == "x86_64" when: arch_based and ansible_architecture == "x86_64"
notify: udpate pacman cache notify: udpate pacman cache
- name: Configure multilib repo - name: Configure multilib repo
ansible.builtin.lineinfile: lineinfile:
path: /etc/pacman.conf path: /etc/pacman.conf
regexp: ^#?\s*Include\s*=\s*/etc/pacman.d/mirrorlist regexp: '^#?\s*Include\s*=\s*/etc/pacman.d/mirrorlist'
line: Include = /etc/pacman.d/mirrorlist line: 'Include = /etc/pacman.d/mirrorlist'
insertafter: ^\[multilib\]$ insertafter: '^\[multilib\]$'
become: true become: yes
when: arch_based and ansible_architecture == "x86_64" when: arch_based and ansible_architecture == "x86_64"
notify: udpate pacman cache notify: udpate pacman cache
- name: Update cache if needed - name: Update cache if needed
ansible.builtin.meta: flush_handlers meta: flush_handlers
- name: Install ccache - name: Install ccache
community.general.pacman: pacman:
name: ccache name: ccache
state: present state: present
extra_args: --asdeps extra_args: "--asdeps"
become: true become: yes
when: arch_based when: arch_based
- name: Enable makepkg color - name: Enable makepkg color
ansible.builtin.replace: replace:
path: /etc/makepkg.conf path: /etc/makepkg.conf
regexp: ^BUILDENV=(.+)!color(.+)$ regexp: '^BUILDENV=(.+)!color(.+)$'
replace: BUILDENV=\1color\2 replace: 'BUILDENV=\1color\2'
become: true become: yes
when: arch_based when: arch_based
- name: Enable makepkg ccache - name: Enable makepkg ccache
ansible.builtin.replace: replace:
path: /etc/makepkg.conf path: /etc/makepkg.conf
regexp: ^BUILDENV=(.+)!ccache(.+)$ regexp: '^BUILDENV=(.+)!ccache(.+)$'
replace: BUILDENV=\1ccache\2 replace: 'BUILDENV=\1ccache\2'
become: true become: yes
when: arch_based when: arch_based
- name: Remove -mtune from makepkg CFLAGS - name: Remove -mtune from makepkg CFLAGS
ansible.builtin.replace: replace:
path: /etc/makepkg.conf path: /etc/makepkg.conf
regexp: ^#? *CFLAGS=(.+)-mtune=\S+\s(.*)$ regexp: '^#? *CFLAGS=(.+)-mtune=\S+\s(.*)$'
replace: CFLAGS=\1\2 replace: "CFLAGS=\\1\\2"
become: true become: yes
when: arch_based when: arch_based
- name: Change -march to native from makepkg CFLAGS - name: Change -march to native from makepkg CFLAGS
ansible.builtin.replace: replace:
path: /etc/makepkg.conf path: /etc/makepkg.conf
regexp: ^#? *CFLAGS=(.+)-march=\S+(\s)(.*)$ regexp: '^#? *CFLAGS=(.+)-march=\S+(\s)(.*)$'
replace: CFLAGS=\1-march=native\2\3 replace: "CFLAGS=\\1-march=native\\2\\3"
become: true become: yes
when: arch_based when: arch_based
- name: Set makepkg MAKEFLAGS - name: Set makepkg MAKEFLAGS
ansible.builtin.replace: replace:
path: /etc/makepkg.conf path: /etc/makepkg.conf
regexp: ^#? *MAKEFLAGS=(.+)-j[0-9]+(.+)$ regexp: '^#? *MAKEFLAGS=(.+)-j[0-9]+(.+)$'
replace: MAKEFLAGS=\1-j{{ j }}\2 replace: "MAKEFLAGS=\\1-j{{ j }}\\2"
become: true become: yes
vars: vars:
j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}" j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}"
when: arch_based when: arch_based
- name: Enable pacman ParallelDownloads - name: Enable pacman ParallelDownloads
ansible.builtin.lineinfile: lineinfile:
path: /etc/pacman.conf path: /etc/pacman.conf
regexp: ^#?ParallelDownloads regexp: '^#?ParallelDownloads'
line: ParallelDownloads = 5 line: 'ParallelDownloads = 5'
insertafter: ^\[options\]$ insertafter: '^\[options\]$'
become: true become: yes
when: arch_based when: arch_based
- name: Enable pacman colors - name: Enable pacman colors
ansible.builtin.lineinfile: lineinfile:
path: /etc/pacman.conf path: /etc/pacman.conf
regexp: ^#?Color regexp: '^#?Color'
line: Color line: 'Color'
insertafter: ^\[options\]$ insertafter: '^\[options\]$'
become: true become: yes
when: arch_based when: arch_based
- name: Enable pacman pac-man - name: Enable pacman pac-man
ansible.builtin.lineinfile: lineinfile:
path: /etc/pacman.conf path: /etc/pacman.conf
regexp: ^#?ILoveCandy regexp: '^#?ILoveCandy'
line: ILoveCandy line: 'ILoveCandy'
insertafter: ^#?Color insertafter: '^#?Color'
become: true become: yes
when: arch_based when: arch_based
# Install alternative package managers # Install alternative package managers
- name: List packages from base-devel
command: pacman -Sqg base-devel
register: base_devel_packages
changed_when: no
check_mode: no
- name: Install dependencies for AUR helpers - name: Install dependencies for AUR helpers
community.general.pacman: pacman:
name: name: "{{ (base_devel_packages.stdout | split('\n') | reject('eq', 'sudo')) + ['fakeroot'] }}"
- base-devel become: yes
- fakeroot
become: true
when: arch_based when: arch_based
# Do not install sudo because maybe sudo-fake is installed (otherwise it conflicts) # Do not install sudo because maybe sudo-fake is installed (otherwise it conflicts)
# It should already be installed already anyway # It should already be installed already anyway
@ -176,41 +182,41 @@
when: arch when: arch
- name: Install AUR package manager (Manjaro) - name: Install AUR package manager (Manjaro)
community.general.pacman: pacman:
name: yay name: yay
become: true become: yes
when: manjaro when: manjaro
# Not sure if regular Manjaro has yay in its community packages, # Not sure if regular Manjaro has yay in its community packages,
# but Manjaro-ARM sure does # but Manjaro-ARM sure does
- name: Create cache folder - name: Create cache folder
ansible.builtin.file: file:
state: directory state: directory
mode: u=rwx,g=rx,o=rx mode: "u=rwx,g=rx,o=rx"
path: "{{ ansible_user_dir }}/.cache/automatrop" path: "{{ ansible_user_dir }}/.cache/automatrop"
- name: Generate list of packages for package manager - name: Generate list of packages for package manager
ansible.builtin.set_fact: set_fact:
packages: "{{ query('template', 'package_manager.j2')[0].split('\n')[:-1]|sort|unique }}" packages: "{{ query('template', 'package_manager.j2')[0].split('\n')[:-1]|sort|unique }}"
tags: softwarelist tags: softwarelist
- name: Install packages (Arch-based) - name: Install packages (Arch-based)
aur: aur:
name: "{{ packages }}" name: "{{ packages }}"
extra_args: --asdeps --needed extra_args: "--asdeps --needed"
# Nothing is set as installed manually so it can # Nothing is set as installed manually so it can
# be removed by dependency check. # be removed by dependency check.
# Current packages will be kept by the meta package # Current packages will be kept by the meta package
use: yay use: yay
notify: software changed notify: "software changed"
tags: softwarelist tags: softwarelist
when: arch_based when: arch_based
- name: Check if list of packages changed - name: Check if list of packages changed
ansible.builtin.copy: copy:
content: "{% for package in packages %}{{ package }}\n{% endfor %}" content: "{% for package in packages %}{{ package }}\n{% endfor %}"
dest: "{{ ansible_user_dir }}/.cache/automatrop/package_manager" dest: "{{ ansible_user_dir }}/.cache/automatrop/package_manager"
notify: software changed notify: "software changed"
tags: softwarelist tags: softwarelist
# translate-shell # translate-shell

View file

@ -1,47 +1,46 @@
---
- name: Create a etckeeper commit - name: Create a etckeeper commit
ansible.builtin.command: etckeeper commit 'automatrop {{ ansible_date_time.iso8601 }}' command: "etckeeper commit 'automatrop {{ ansible_date_time.iso8601 }}'"
listen: etc changed listen: "etc changed"
become: true become: yes
register: etckeeper_commit register: etckeeper_commit
failed_when: etckeeper_commit.rc != 0 and 'nothing to commit' not in etckeeper_commit.stdout failed_when: "etckeeper_commit.rc != 0 and 'nothing to commit' not in etckeeper_commit.stdout"
changed_when: "'nothing to commit' not in etckeeper_commit.stdout" changed_when: "'nothing to commit' not in etckeeper_commit.stdout"
- name: Restart chrony - name: Restart chrony
ansible.builtin.systemd: systemd:
name: chronyd name: chronyd
state: restarted state: restarted
listen: chrony reconfigured listen: chrony reconfigured
become: true become: yes
- name: Reload systemd daemon - name: Reload systemd daemon
ansible.builtin.systemd: systemd:
daemon_reload: true daemon_reload: yes
listen: systemd changed listen: systemd changed
become: true become: yes
- name: Restart wpa_supplicant - name: Restart wpa_supplicant
ansible.builtin.systemd: systemd:
name: wpa_supplicant@{{ item }} name: "wpa_supplicant@{{ item }}"
state: restarted state: restarted
become: true become: yes
loop: "{{ ansible_interfaces }}" loop: "{{ ansible_interfaces }}"
when: item.startswith('wl') when: "item.startswith('wl')"
listen: wpa_supplicant changed listen: wpa_supplicant changed
# Could probably use something better like # Could probably use something better like
# listing /sys/class/ieee80211/*/device/net/ # listing /sys/class/ieee80211/*/device/net/
- name: Warn about changed Wi-Fi setup - name: Warn about changed Wi-Fi setup
ansible.builtin.debug: debug:
msg: The Wi-Fi configuration was changed, but not applied to let this playbook finish. A reboot is required. msg: "The Wi-Fi configuration was changed, but not applied to let this playbook finish. A reboot is required."
listen: wifi setup changed listen: wifi setup changed
- name: Warn about changed Panfrost config - name: Warn about changed Panfrost config
ansible.builtin.debug: debug:
msg: The Panfrost display driver configuration was changed, but needs a reboot to be applied. msg: "The Panfrost display driver configuration was changed, but needs a reboot to be applied."
listen: panfrost config changed listen: panfrost config changed
- name: Reload systemd-logind - name: Reload systemd-logind
ansible.builtin.command: systemctl kill -s HUP systemd-logind command: systemctl kill -s HUP systemd-logind
become: true become: yes
listen: systemd-logind config changed listen: systemd-logind config changed

View file

@ -1,4 +1,3 @@
---
# TODO For other distributions # TODO For other distributions
# Package are installed with --asdeps because they are needed # Package are installed with --asdeps because they are needed
@ -6,96 +5,97 @@
# Etckeeper # Etckeeper
- name: Check if etckeeper is initialized - name: Check if etckeeper is initialized
ansible.builtin.stat: stat:
path: /etc/.git path: /etc/.git
register: etckeeper register: etckeeper
become: true become: yes
- name: Initialize etckeeper - name: Initialize etckeeper
ansible.builtin.command: etckeeper init command: "etckeeper init"
become: true become: yes
when: not etckeeper.stat.exists when: not etckeeper.stat.exists
changed_when: true changed_when: yes
- name: Configure git user.name for etckeeper - name: Configure git user.name for etckeeper
community.general.git_config: git_config:
scope: local scope: local
repo: /etc repo: /etc
name: "{{ item.name }}" name: "{{ item.name }}"
value: "{{ item.value }}" value: "{{ item.value }}"
loop: loop:
- name: user.name - name: "user.name"
value: etckeeper on {{ inventory_hostname_short }} value: "etckeeper on {{ inventory_hostname_short }}"
- name: user.email - name: "user.email"
value: etckeeper@{{ inventory_hostname }} value: "etckeeper@{{ inventory_hostname }}"
become: true become: yes
# Manjaro configuration # Manjaro configuration
- name: Remove Manjaro's pamac - name: Remove Manjaro's pamac
community.general.pacman: pacman:
name: pamac name: pamac
state: absent state: absent
become: true become: yes
when: arch_based and False # I'm trying to remember why I usually delete this thing when: arch_based and False # I'm trying to remember why I usually delete this thing
# Verbose logging during boot # Verbose logging during boot
- name: Check if using Uboot - name: Check if using Uboot
ansible.builtin.stat: stat:
path: /boot/extlinux/extlinux.conf path: /boot/extlinux/extlinux.conf
register: extlinux register: extlinux
# This (and the following) was made with the Pinebook in mind, # This (and the following) was made with the Pinebook in mind,
# not sure about compatibility # not sure about compatibility
- name: Remove non-tty1 console (Uboot) - name: Remove non-tty1 console (Uboot)
ansible.builtin.replace: replace:
path: /boot/extlinux/extlinux.conf path: /boot/extlinux/extlinux.conf
regexp: ^APPEND(.*) console=(?!tty1)\S+(.*)$ regexp: '^APPEND(.*) console=(?!tty1)\S+(.*)$'
replace: APPEND\1\2 replace: 'APPEND\1\2'
become: true become: yes
when: extlinux.stat.exists when: extlinux.stat.exists
# Only one console= will be removed because regular expression are either hard # Only one console= will be removed because regular expression are either hard
# or somewhat limited. It's just what I need anyway # or somewhat limited. It's just what I need anyway
- name: Remove bootsplash.bootfile (Uboot) - name: Remove bootsplash.bootfile (Uboot)
ansible.builtin.replace: replace:
path: /boot/extlinux/extlinux.conf path: /boot/extlinux/extlinux.conf
regexp: ^APPEND(.*) bootsplash.bootfile=\S+(.*)$ regexp: '^APPEND(.*) bootsplash.bootfile=\S+(.*)$'
replace: APPEND\1\2 replace: 'APPEND\1\2'
become: true become: yes
when: extlinux.stat.exists when: extlinux.stat.exists
- name: Remove bootsplash packages (Arch based) - name: Remove bootsplash packages (Arch based)
community.general.pacman: pacman:
name: name:
- bootsplash-systemd - bootsplash-systemd
- bootsplash-theme-manjaro - bootsplash-theme-manjaro
state: absent state: absent
become: true become: yes
when: arch_based when: arch_based
# Display Manager # Display Manager
- name: Remove display manager packages (Arch based) - name: Remove display manager packages (Arch based)
community.general.pacman: pacman:
name: name:
- sddm - sddm
- sddm-breath2-theme - sddm-breath2-theme
state: absent state: absent
become: true become: yes
when: arch_based when: arch_based
# Xorg configuration # Xorg configuration
- name: Check if there is nvidia-xrun is installed - name: Check if there is nvidia-xrun is installed
ansible.builtin.stat: stat:
path: /etc/X11/nvidia-xorg.conf path: /etc/X11/nvidia-xorg.conf
register: nvidia_xrun register: nvidia_xrun
when: display_server == 'x11' when: display_server == 'x11'
- name: Add nvidia-xrun xorg config directory - name: Add nvidia-xrun xorg config directory
ansible.builtin.set_fact: set_fact:
xorg_common_config_dirs: "{{ xorg_default_config_dirs + xorg_nvidia_config_dirs }}" xorg_common_config_dirs: "{{ xorg_default_config_dirs + xorg_nvidia_config_dirs }}"
vars: vars:
xorg_default_config_dirs: xorg_default_config_dirs:
@ -104,78 +104,78 @@
when: display_server == 'x11' when: display_server == 'x11'
- name: Configure Xorg keyboard layout - name: Configure Xorg keyboard layout
ansible.builtin.copy: copy:
src: xorg/keyboard.conf src: xorg/keyboard.conf
dest: "{{ item }}/00-keyboard.conf" dest: "{{ item }}/00-keyboard.conf"
become: true become: yes
when: display_server == 'x11' when: display_server == 'x11'
notify: etc changed notify: etc changed
loop: "{{ xorg_common_config_dirs }}" loop: "{{ xorg_common_config_dirs }}"
- name: Use Alt keys for numpad - name: Use Alt keys for numpad
ansible.posix.patch: patch:
src: us_qwert_alt_numpad.patch src: us_qwert_alt_numpad.patch
dest: /usr/share/X11/xkb/symbols/us_qwerty-fr dest: /usr/share/X11/xkb/symbols/us_qwerty-fr
become: true become: yes
when: display_server == 'x11' when: display_server == 'x11'
# This is not very nice but it's updated so infrequently that it's not worth # This is not very nice but it's updated so infrequently that it's not worth
# the trouble # the trouble
- name: Check if there is Intel backlight - name: Check if there is Intel backlight
ansible.builtin.stat: stat:
path: /sys/class/backlight/intel_backlight path: /sys/class/backlight/intel_backlight
register: intel_backlight register: intel_backlight
when: display_server == 'x11' when: display_server == 'x11'
- name: Install Intel video drivers (Arch based) - name: Install Intel video drivers (Arch based)
community.general.pacman: pacman:
name: xf86-video-intel name: xf86-video-intel
# state: "{{ intel_backlight.stat.exists }}" # state: "{{ intel_backlight.stat.exists }}"
state: present state: present
become: true become: yes
when: display_server == 'x11' and intel_backlight.stat.exists and arch_based when: display_server == 'x11' and intel_backlight.stat.exists and arch_based
# TODO With software role? Would permit other distributions # TODO With software role? Would permit other distributions
- name: Configure Xorg Intel backlight - name: Configure Xorg Intel backlight
ansible.builtin.copy: copy:
src: xorg/intel_backlight.conf src: xorg/intel_backlight.conf
dest: "{{ item }}/20-intel_backlight.conf" dest: "{{ item }}/20-intel_backlight.conf"
become: true become: yes
when: display_server == 'x11' and intel_backlight.stat.exists when: display_server == 'x11' and intel_backlight.stat.exists
notify: etc changed notify: etc changed
loop: "{{ xorg_common_config_dirs }}" loop: "{{ xorg_common_config_dirs }}"
- name: Configure Xorg touchpad behaviour - name: Configure Xorg touchpad behaviour
ansible.builtin.copy: copy:
src: xorg/touchpad.conf src: xorg/touchpad.conf
dest: "{{ item }}/30-touchpad.conf" dest: "{{ item }}/30-touchpad.conf"
become: true become: yes
when: display_server == 'x11' when: display_server == 'x11'
notify: etc changed notify: etc changed
loop: "{{ xorg_common_config_dirs }}" loop: "{{ xorg_common_config_dirs }}"
- name: Configure Xorg joystick behaviour - name: Configure Xorg joystick behaviour
ansible.builtin.copy: copy:
src: xorg/joystick.conf src: xorg/joystick.conf
dest: "{{ item }}/50-joystick.conf" dest: "{{ item }}/50-joystick.conf"
become: true become: yes
when: display_server == 'x11' when: display_server == 'x11'
notify: etc changed notify: etc changed
loop: "{{ xorg_common_config_dirs }}" loop: "{{ xorg_common_config_dirs }}"
- name: List modules we're using - name: List modules we're using
ansible.builtin.slurp: slurp:
src: /proc/modules src: /proc/modules
register: modules register: modules
when: display_server when: display_server
# Not sure the module will be loaded in early setup stages though # Not sure the module will be loaded in early setup stages though
- name: Make panfrost use OpenGL 3.3 - name: Make panfrost use OpenGL 3.3
ansible.builtin.lineinfile: lineinfile:
path: /etc/environment path: /etc/environment
line: PAN_MESA_DEBUG="gl3" line: 'PAN_MESA_DEBUG="gl3"'
regexp: ^#? ?PAN_MESA_DEBUG= regexp: '^#? ?PAN_MESA_DEBUG='
become: true become: yes
when: display_server and using_panfrost when: display_server and using_panfrost
vars: vars:
using_panfrost: "{{ 'panfrost' in (modules.content | b64decode) }}" using_panfrost: "{{ 'panfrost' in (modules.content | b64decode) }}"
@ -183,21 +183,21 @@
# Numlock on boot # Numlock on boot
- name: Set numlock on boot - name: set numlock on boot
ansible.builtin.copy: copy:
src: getty.service src: getty.service
dest: /etc/systemd/system/getty@.service.d/override.conf dest: /etc/systemd/system/getty@.service.d/override.conf
become: true become: yes
notify: notify:
- etc changed - etc changed
- systemd changed - systemd changed
when: auto_numlock when: auto_numlock
- name: Unset numlock on boot - name: Unset numlock on boot
ansible.builtin.file: file:
path: /etc/systemd/system/getty@.service.d/override.conf path: /etc/systemd/system/getty@.service.d/override.conf
state: absent state: absent
become: true become: yes
notify: notify:
- etc changed - etc changed
- systemd changed - systemd changed
@ -206,163 +206,163 @@
# TLP configuration # TLP configuration
- name: Start/enable TLP - name: Start/enable TLP
ansible.builtin.systemd: systemd:
name: tlp name: tlp
state: started state: started
enabled: true enabled: yes
become: true become: yes
notify: etc changed notify: etc changed
# Network configuration # Network configuration
- name: Start/enable dhcpcd - name: Start/enable dhcpcd
ansible.builtin.systemd: systemd:
name: dhcpcd name: dhcpcd
state: started state: started
enabled: true enabled: yes
become: true become: yes
notify: etc changed notify: etc changed
- name: Configure wpa_supplicant - name: Configure wpa_supplicant
ansible.builtin.template: template:
src: wpa_supplicant.conf.j2 src: wpa_supplicant.conf.j2
dest: /etc/wpa_supplicant/wpa_supplicant.conf dest: /etc/wpa_supplicant/wpa_supplicant.conf
notify: notify:
- etc changed - etc changed
- wpa_supplicant changed - wpa_supplicant changed
become: true become: yes
tags: tags:
- wificonf - wificonf
- name: Prepare directory for wpa_supplicant service override - name: Prepare directory for wpa_supplicant service override
ansible.builtin.file: file:
path: /etc/systemd/system/wpa_supplicant@.service.d path: /etc/systemd/system/wpa_supplicant@.service.d
state: directory state: directory
mode: u=rwx,g=rx,o=rx mode: "u=rwx,g=rx,o=rx"
become: true become: yes
- name: Make wpa_supplicant use a common configuration file - name: Make wpa_supplicant use a common configuration file
ansible.builtin.copy: copy:
src: wpa_supplicant.service src: wpa_supplicant.service
dest: /etc/systemd/system/wpa_supplicant@.service.d/override.conf dest: /etc/systemd/system/wpa_supplicant@.service.d/override.conf
become: true become: yes
notify: notify:
- etc changed - etc changed
- systemd changed - systemd changed
- wifi setup changed - wifi setup changed
- name: Disable wpa_supplicant for networkmanager - name: Disable wpa_supplicant for networkmanager
ansible.builtin.systemd: systemd:
name: wpa_supplicant name: wpa_supplicant
enabled: false enabled: no
become: true become: yes
notify: notify:
- etc changed - etc changed
- wifi setup changed - wifi setup changed
- name: Start/enable wpa_supplicant for interface - name: Start/enable wpa_supplicant for interface
ansible.builtin.systemd: systemd:
name: wpa_supplicant@{{ item }} name: "wpa_supplicant@{{ item }}"
enabled: true enabled: yes
become: true become: yes
notify: notify:
- etc changed - etc changed
- wifi setup changed - wifi setup changed
loop: "{{ ansible_interfaces }}" loop: "{{ ansible_interfaces }}"
when: item.startswith('wl') when: "item.startswith('wl')"
# Could probably use something better like # Could probably use something better like
# listing /sys/class/ieee80211/*/device/net/ # listing /sys/class/ieee80211/*/device/net/
- name: Uninstall networkmanager - name: Uninstall networkmanager
community.general.pacman: pacman:
name: networkmanager name: networkmanager
state: absent state: absent
extra_args: --cascade --recursive extra_args: "--cascade --recursive"
when: arch_based when: arch_based
become: true become: yes
notify: notify:
- wifi setup changed - wifi setup changed
- name: Mask systemd-networkd - name: Mask systemd-networkd
ansible.builtin.systemd: systemd:
name: systemd-networkd name: systemd-networkd
state: stopped state: stopped
enabled: false enabled: no
masked: true masked: yes
become: true become: yes
notify: etc changed notify: etc changed
# Time synchronisation # Time synchronisation
- name: Mask systemd-timesyncd - name: Mask systemd-timesyncd
ansible.builtin.systemd: systemd:
name: systemd-timesyncd name: systemd-timesyncd
state: stopped state: stopped
enabled: false enabled: no
masked: true masked: yes
become: true become: yes
notify: etc changed notify: etc changed
- name: Configure chrony - name: Configure chrony
ansible.builtin.copy: copy:
src: chrony.conf src: chrony.conf
dest: /etc/chrony.conf dest: /etc/chrony.conf
become: true become: yes
notify: notify:
- etc changed - etc changed
- chrony reconfigured - chrony reconfigured
# TODO More configuration, RTC configuration # TODO More configuration, RTC configuration
- name: Enable chronyd - name: Enable chronyd
ansible.builtin.systemd: systemd:
name: chronyd name: chronyd
enabled: true enabled: yes
become: true become: yes
notify: notify:
- etc changed - etc changed
- chrony reconfigured - chrony reconfigured
- name: Configure dhcpcd chrony hook - name: Configure dhcpcd chrony hook
ansible.builtin.copy: copy:
src: dhcpcd.exit-hook src: dhcpcd.exit-hook
dest: /etc/dhcpcd.exit-hook dest: /etc/dhcpcd.exit-hook
become: true become: yes
notify: etc changed notify: etc changed
- name: Empty motd - name: Empty motd
ansible.builtin.copy: copy:
content: "" content: ""
dest: /etc/motd dest: /etc/motd
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
become: true become: yes
notify: notify:
- etc changed - etc changed
# VPN configuration # VPN configuration
- name: Prepare directory for openvpn-client service override - name: Prepare directory for openvpn-client service override
ansible.builtin.file: file:
path: /etc/systemd/system/openvpn-client@.service.d path: /etc/systemd/system/openvpn-client@.service.d
state: directory state: directory
mode: u=rwx,g=rx,o=rx mode: "u=rwx,g=rx,o=rx"
become: true become: yes
- name: Make openvpn use hooks for resolvconf - name: Make openvpn use hooks for resolvconf
ansible.builtin.copy: copy:
src: openvpn-client.service src: openvpn-client.service
dest: /etc/systemd/system/openvpn-client@.service.d/override.conf dest: /etc/systemd/system/openvpn-client@.service.d/override.conf
become: true become: yes
notify: notify:
- etc changed - etc changed
- systemd changed - systemd changed
- name: Disable power button - name: Disable power button
ansible.builtin.lineinfile: lineinfile:
path: /etc/systemd/logind.conf path: /etc/systemd/logind.conf
line: HandlePowerKey=ignore line: 'HandlePowerKey=ignore'
regexp: ^#? *HandlePowerKey= regexp: '^#? *HandlePowerKey='
insertafter: ^\[Login\]$ insertafter: '^\[Login\]$'
become: true become: yes
notify: systemd-logind config changed notify: systemd-logind config changed
# Reason: I sometimes press it accidentally # Reason: I sometimes press it accidentally
# (hoping to start it when it's already started, # (hoping to start it when it's already started,

View file

@ -1,17 +1,16 @@
---
- name: Create Termux directory - name: Create Termux directory
ansible.builtin.file: file:
state: directory state: directory
path: "{{ ansible_user_dir }}/.termux" path: "{{ ansible_user_dir }}/.termux"
mode: u=rwx,g=rx,o=rx mode: "u=rwx,g=rx,o=rx"
# TODO This is a dotfiles directory. # TODO This is a dotfiles directory.
# Make it not install unless it's Termux # Make it not install unless it's Termux
- name: Silence Termux login message - name: Silence Termux login message
ansible.builtin.file: file:
state: file state: file
path: "{{ ansible_user_dir }}/.hushlogin" path: "{{ ansible_user_dir }}/.hushlogin"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
# Build a single color scheme and template and assign it to a variable # Build a single color scheme and template and assign it to a variable
- base16_builder: - base16_builder:
@ -23,10 +22,10 @@
- color - color
- name: Download base16 theme for Termux - name: Download base16 theme for Termux
ansible.builtin.copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}"
dest: "{{ ansible_env.HOME }}/.termux/colors.properties" dest: "{{ ansible_env.HOME }}/.termux/colors.properties"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
tags: tags:
- color - color

View file

@ -1,12 +1,11 @@
---
- name: Upgrade Neovim plugins - name: Upgrade Neovim plugins
ansible.builtin.command: nvim +PlugUpgrade +PlugUpdate +PlugInstall +qall! command: "nvim +PlugUpgrade +PlugUpdate +PlugInstall +qall!"
listen: nvim plugins changed listen: nvim plugins changed
environment: environment:
VIMINIT: source {{ ansible_user_dir }}/.config/nvim/plugininstall.vim VIMINIT: "source {{ ansible_user_dir }}/.config/nvim/plugininstall.vim"
- name: Upgrade Vim plugins - name: Upgrade Vim plugins
ansible.builtin.command: vim +PlugUpgrade +PlugUpdate +PlugInstall +qall! command: "vim +PlugUpgrade +PlugUpdate +PlugInstall +qall!"
listen: vim plugins changed listen: vim plugins changed
environment: environment:
VIMINIT: source {{ ansible_user_dir }}/.config/vim/plugininstall.vim VIMINIT: "source {{ ansible_user_dir }}/.config/vim/plugininstall.vim"

View file

@ -1,6 +1,5 @@
---
- name: Set vim variants to use - name: Set vim variants to use
ansible.builtin.set_fact: set_fact:
vim_variants: vim_variants:
- vim - vim
- nvim - nvim
@ -8,37 +7,37 @@
# TODO Select those in a clever way # TODO Select those in a clever way
- name: Create vim configuration directory - name: Create vim configuration directory
ansible.builtin.file: file:
state: directory state: directory
path: "{{ ansible_user_dir }}/.config/{{ item }}" path: "{{ ansible_user_dir }}/.config/{{ item }}"
mode: u=rwx,g=rx,o=rx mode: "u=rwx,g=rx,o=rx"
loop: "{{ vim_variants }}" loop: "{{ vim_variants }}"
- name: Install vim-plug - name: Install vim-plug
ansible.builtin.get_url: get_url:
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest: "{{ ansible_user_dir }}/.config/vim/plug.vim" dest: "{{ ansible_user_dir }}/.config/vim/plug.vim"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
- name: Install loader - name: Install loader
ansible.builtin.template: template:
src: loader.j2 src: loader.j2
dest: "{{ ansible_user_dir }}/.config/vim/loader.vim" dest: "{{ ansible_user_dir }}/.config/vim/loader.vim"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
- name: Install theme - name: Install theme
ansible.builtin.template: template:
src: theme.j2 src: theme.j2
dest: "{{ ansible_user_dir }}/.config/vim/theme.vim" dest: "{{ ansible_user_dir }}/.config/vim/theme.vim"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
tags: tags:
- color - color
- name: Configure vim plugin list - name: Configure vim plugin list
ansible.builtin.template: template:
src: plugininstall.j2 src: plugininstall.j2
dest: "{{ ansible_user_dir }}/.config/{{ variant }}/plugininstall.vim" dest: "{{ ansible_user_dir }}/.config/{{ variant }}/plugininstall.vim"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
notify: notify:
- "{{ variant }} plugins changed" - "{{ variant }} plugins changed"
loop: "{{ vim_variants }}" loop: "{{ vim_variants }}"
@ -46,10 +45,10 @@
loop_var: variant loop_var: variant
- name: Configure vim - name: Configure vim
ansible.builtin.template: template:
src: init.vim.j2 src: init.vim.j2
dest: "{{ ansible_user_dir }}/.config/{{ variant }}/init.vim" dest: "{{ ansible_user_dir }}/.config/{{ variant }}/init.vim"
mode: u=rw,g=r,o=r mode: "u=rw,g=r,o=r"
loop: "{{ vim_variants }}" loop: "{{ vim_variants }}"
loop_control: loop_control:
loop_var: variant loop_var: variant