From dc6399dc36cd67a21a1e93cf95d80a02bc5e2689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 18 Mar 2023 14:55:54 +0100 Subject: [PATCH 01/20] videoQuota: Add usage --- config/scripts/videoQuota | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/scripts/videoQuota b/config/scripts/videoQuota index 03e6c76..2695397 100755 --- a/config/scripts/videoQuota +++ b/config/scripts/videoQuota @@ -1,5 +1,13 @@ #!/usr/bin/env python3 +# Compress a video to make it fit under a certain size. +# Usage: videoQuota SIZE SRC DST +# SIZE: destination video size in bytes +# SRC: source video file +# DST: destination video file +# Example: videoQuota 20971520 source.mov dest.mp4 +# To make a ~20 MiB MP4 of a MOV video + import sys import subprocess import logging From 1fd1a0df7b3c003a9655cf8b806714a11201c202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 18 Mar 2023 14:58:00 +0100 Subject: [PATCH 02/20] videoQuota: Remove extra log stuff --- config/scripts/videoQuota | 6 ------ 1 file changed, 6 deletions(-) diff --git a/config/scripts/videoQuota b/config/scripts/videoQuota index 2695397..af14336 100755 --- a/config/scripts/videoQuota +++ b/config/scripts/videoQuota @@ -10,12 +10,6 @@ import sys import subprocess -import logging - -import coloredlogs - -coloredlogs.install(level="DEBUG", fmt="%(levelname)s %(message)s") -log = logging.getLogger() def duration_file(path: str) -> float: From aa0bdca44d7f38ea4a6a47cd430503d5430ab97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Fri, 14 Apr 2023 14:41:24 +0200 Subject: [PATCH 03/20] Update mpv config --- config/mpv/lua-settings/mpv_thumbnail_script.conf | 2 +- config/mpv/mpv.conf | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/mpv/lua-settings/mpv_thumbnail_script.conf b/config/mpv/lua-settings/mpv_thumbnail_script.conf index 5a740f1..c132e4f 100644 --- a/config/mpv/lua-settings/mpv_thumbnail_script.conf +++ b/config/mpv/lua-settings/mpv_thumbnail_script.conf @@ -9,7 +9,7 @@ cache_directory=/tmp/my_mpv_thumbnails # Whether to generate thumbnails automatically on video load, without a keypress # Defaults to yes -autogenerate=yes +autogenerate=no # Only automatically thumbnail videos shorter than this (in seconds) # You will have to press T (or your own keybind) to enable the thumbnail previews diff --git a/config/mpv/mpv.conf b/config/mpv/mpv.conf index 244f6b0..b5f1c61 100644 --- a/config/mpv/mpv.conf +++ b/config/mpv/mpv.conf @@ -1,3 +1,4 @@ no-audio-display +save-position-on-quit # Required by thumbnails script osc=no From 5ab08a4f77af4ddf432274c9e6887294f0c7a861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Fri, 14 Apr 2023 14:43:38 +0200 Subject: [PATCH 04/20] Change SQL language server --- .../automatrop/roles/software/templates/snippets/pm_dev_sql.j2 | 2 +- config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/automatrop/roles/software/templates/snippets/pm_dev_sql.j2 b/config/automatrop/roles/software/templates/snippets/pm_dev_sql.j2 index b90d766..e961816 100644 --- a/config/automatrop/roles/software/templates/snippets/pm_dev_sql.j2 +++ b/config/automatrop/roles/software/templates/snippets/pm_dev_sql.j2 @@ -1 +1 @@ -sqls +sql-language-server diff --git a/config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 b/config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 index ec9f88e..6045998 100644 --- a/config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 +++ b/config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 @@ -53,7 +53,7 @@ local servers = { "phpactor", -- Install this one manually https://phpactor.readthedocs.io/en/master/usage/standalone.html#global-installation {% endif %} {% if 'sql' in dev_stuffs %} - "sqls", + "sqlls", {% endif %} } for _, lsp in ipairs(servers) do From 75d8c15def004b6e9f9a8c5873db3e34a4b5235b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 24 Jun 2023 13:35:37 +0200 Subject: [PATCH 05/20] smtpdummy: allow to do unorthodox things --- config/scripts/smtpdummy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/scripts/smtpdummy b/config/scripts/smtpdummy index 2b167a4..1de7751 100755 --- a/config/scripts/smtpdummy +++ b/config/scripts/smtpdummy @@ -170,7 +170,7 @@ Input arguments: send("QUIT") # TODO Can loop if QUIT fails sys.exit(1) - def send(command: str) -> None: + def _send(command: str) -> None: if not args.quiet: print(colorama.Fore.BLUE + f"> {command}" + colorama.Fore.RESET) @@ -182,6 +182,8 @@ Input arguments: p.stdin.write(cmd) p.stdin.flush() + def send(command: str) -> None: + _send(command) recv() # Transmission From 6c249a452f71c48418675fda26e5c1d65e84e11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 24 Jun 2023 13:36:27 +0200 Subject: [PATCH 06/20] Add missing / update Python requirements --- config/lemonbar/requirements.txt | 2 +- config/scripts/requirements.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/lemonbar/requirements.txt b/config/lemonbar/requirements.txt index a52d7a8..33e73b9 100644 --- a/config/lemonbar/requirements.txt +++ b/config/lemonbar/requirements.txt @@ -5,7 +5,7 @@ i3ipc==1.6.0 ifaddr==0.1.4 ipaddress==1.0.22 psutil==5.4.7 -pulsectl==18.8.0 +pulsectl>=23.5.2<24 pyinotify==0.9.6 python-mpd2>=3.0.0<4 python-uinput==0.11.2 diff --git a/config/scripts/requirements.txt b/config/scripts/requirements.txt index d364bdb..f806981 100644 --- a/config/scripts/requirements.txt +++ b/config/scripts/requirements.txt @@ -2,3 +2,6 @@ coloredlogs>=10.0<11 progressbar2>=3.47.0<4 yt-dlp>=2021.10.22 ConfigArgParse>=1.5<2 +asyncinotify +ffmpeg +r128gain From eba894d9f48be97e2b0665c28b2fd3b9d22210c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 24 Jun 2023 13:36:50 +0200 Subject: [PATCH 07/20] rssVideos: Ensure duration is an int --- config/scripts/rssVideos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/scripts/rssVideos b/config/scripts/rssVideos index 2219d55..a817f45 100755 --- a/config/scripts/rssVideos +++ b/config/scripts/rssVideos @@ -209,7 +209,7 @@ class RVElement: def duration(self) -> int: assert self.is_video assert self.ytdl_infos - return self.ytdl_infos["duration"] + return int(self.ytdl_infos["duration"]) @property def is_video(self) -> bool: From 6a2afb3280c1ea9051ed75adfc1f88203565e323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sun, 23 Jul 2023 13:23:28 +0200 Subject: [PATCH 08/20] Various smtpdummy fixes --- config/scripts/smtpdummy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/scripts/smtpdummy b/config/scripts/smtpdummy index 1de7751..8116e7a 100755 --- a/config/scripts/smtpdummy +++ b/config/scripts/smtpdummy @@ -9,7 +9,6 @@ import io import pprint import subprocess import sys -import uuid if __name__ == "__main__": @@ -34,6 +33,7 @@ if __name__ == "__main__": ) parser.add_argument("-l", "--helo", env_var="HELO") + parser.add_argument("-L", "--helo-verb", env_var="HELO_VERB", default="EHLO") parser.add_argument( "-s", "--sender", env_var="SENDER", default="geoffrey@frogeye.fr" ) @@ -79,11 +79,11 @@ if __name__ == "__main__": if args.to is None: args.to = args.receiver[0] if args.reply_to is None: - args.reply_to = args.to + args.reply_to = getattr(args, 'from') if args.password: password = args.password args.password = "********" - mid = f"{uuid.uuid1()}@{args.helo}" + mid = email.utils.make_msgid(domain=args.helo) # Transmission content @@ -190,7 +190,7 @@ Input arguments: if args.security != "starttls": recv() - send(f"EHLO {args.helo}") + send(f"{args.helo_verb} {args.helo}") if args.user: encoded = base64.b64encode( args.user.encode() @@ -200,9 +200,9 @@ Input arguments: + password.encode() ).decode() send(f"AUTH PLAIN {encoded}") - send(f"MAIL FROM: <{args.sender}>" + (" SMTPUTF8" if args.smtputf8 else "")) + send(f"MAIL FROM:<{args.sender}>" + (" SMTPUTF8" if args.smtputf8 else "")) for receiver in args.receiver: - send(f"RCPT TO: <{receiver}>") + send(f"RCPT TO:<{receiver}>") if not args.callout: send("DATA") send(text) From dc63263d85a04caf4f4b9e405af15418462cf72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sun, 23 Jul 2023 13:28:39 +0200 Subject: [PATCH 09/20] Add locate IP script --- config/scripts/lip | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 config/scripts/lip diff --git a/config/scripts/lip b/config/scripts/lip new file mode 100755 index 0000000..90ae72b --- /dev/null +++ b/config/scripts/lip @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +set -euo pipefail + +url="https://ip.frogeye.fr/json" +cachedir="$HOME/.cache/lip" + +ip="${1:-}" +if [ $# -gt 0 ] +then + shift + jq_sel="$@" +else + jq_sel="del(.user_agent)" +fi + +if [ -n "$ip" ] +then + cachefile="$cachedir/$ip" + if ! find "$cachefile" -mtime -7 &> /dev/null + then + mkdir -p "$cachedir" + curl --silent "$url/?ip=$ip" > "$cachefile" + fi + cat "$cachefile" | jq $jq_sel +else + curl --silent "$url" | jq $jq_sel +fi + From d1ae06e7ef286673ab9b195ec362ae00eaf15e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Tue, 25 Jul 2023 13:23:56 +0200 Subject: [PATCH 10/20] Misc fixes --- config/automatrop/roles/vim/templates/plugins/treesitter.j2 | 1 - config/scripts/lip | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/config/automatrop/roles/vim/templates/plugins/treesitter.j2 b/config/automatrop/roles/vim/templates/plugins/treesitter.j2 index c4ded51..0bfeba3 100644 --- a/config/automatrop/roles/vim/templates/plugins/treesitter.j2 +++ b/config/automatrop/roles/vim/templates/plugins/treesitter.j2 @@ -20,7 +20,6 @@ require'nvim-treesitter.configs'.setup { "gitattributes", "gitignore", "go", - "help", "html", "http", "java", diff --git a/config/scripts/lip b/config/scripts/lip index 90ae72b..a30eee4 100755 --- a/config/scripts/lip +++ b/config/scripts/lip @@ -20,7 +20,7 @@ then if ! find "$cachefile" -mtime -7 &> /dev/null then mkdir -p "$cachedir" - curl --silent "$url/?ip=$ip" > "$cachefile" + curl --silent "$url?ip=$ip" > "$cachefile" fi cat "$cachefile" | jq $jq_sel else From 910e7fae639555b04eb1e5303556a53cbf92cd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Tue, 25 Jul 2023 13:33:22 +0200 Subject: [PATCH 11/20] More fixes on lip --- config/scripts/lip | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/scripts/lip b/config/scripts/lip index a30eee4..66a0b1d 100755 --- a/config/scripts/lip +++ b/config/scripts/lip @@ -6,14 +6,15 @@ url="https://ip.frogeye.fr/json" cachedir="$HOME/.cache/lip" ip="${1:-}" -if [ $# -gt 0 ] +jq_sel="del(.user_agent)" + +if [ $# -gt 1 ] then shift jq_sel="$@" -else - jq_sel="del(.user_agent)" fi + if [ -n "$ip" ] then cachefile="$cachedir/$ip" From 7d011694d82de0d2572ae58793b59022d44c45b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 12 Aug 2023 22:02:59 +0200 Subject: [PATCH 12/20] Yet another feature for smtpdummy --- config/scripts/smtpdummy | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config/scripts/smtpdummy b/config/scripts/smtpdummy index 8116e7a..78f8a88 100755 --- a/config/scripts/smtpdummy +++ b/config/scripts/smtpdummy @@ -63,6 +63,9 @@ if __name__ == "__main__": parser.add_argument("-b", "--body", env_var="BODY", default="") parser.add_argument("-g", "--gtube", env_var="GTUBE", action="store_true") parser.add_argument("-m", "--me", env_var="ME", default="Geoffrey") + parser.add_argument( + "-H", "--headers", default=[], action="append", env_var="HEADER" + ) parser.add_argument("-y", "--dryrun", env_var="DRYRUN", action="store_true") parser.add_argument("-q", "--quiet", env_var="QUIET", action="store_true") @@ -79,7 +82,7 @@ if __name__ == "__main__": if args.to is None: args.to = args.receiver[0] if args.reply_to is None: - args.reply_to = getattr(args, 'from') + args.reply_to = getattr(args, "from") if args.password: password = args.password args.password = "********" @@ -87,6 +90,10 @@ if __name__ == "__main__": # Transmission content + headers = "" + if args.headers: + headers = "\n" + "\n".join(args.headers) + gtube = "" if args.gtube: gtube = """ @@ -102,7 +109,7 @@ From: {args.me} <{getattr(args, 'from')}> Subject: {args.subject} To: {args.to} Reply-To: {args.reply_to} -Message-ID: {mid} +Message-ID: {mid}{headers} Hello there, From 314ca93dbf532f059e5fd993933dadf8ad6f3bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 21 Oct 2023 21:56:38 +0200 Subject: [PATCH 13/20] Regular updates --- .../roles/software/templates/snippets/pm_dev_common.j2 | 5 ++--- .../roles/software/templates/snippets/pm_dev_perl.j2 | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/automatrop/roles/software/templates/snippets/pm_dev_common.j2 b/config/automatrop/roles/software/templates/snippets/pm_dev_common.j2 index 41d98d1..5c0c0ce 100644 --- a/config/automatrop/roles/software/templates/snippets/pm_dev_common.j2 +++ b/config/automatrop/roles/software/templates/snippets/pm_dev_common.j2 @@ -12,8 +12,7 @@ highlight {# For nvim's :Telescope live_grep #} ripgrep {# Offline documentation #} -{% if arch_based and ansible_architecture == 'x86_64' %} -{# Pain to compile if binaries for qt5-webkit do not exist #} +{# Relies on qt5-webkit which is a pain to compile zeal -{% endif %} +#} {# EOF #} diff --git a/config/automatrop/roles/software/templates/snippets/pm_dev_perl.j2 b/config/automatrop/roles/software/templates/snippets/pm_dev_perl.j2 index 7349969..693399c 100644 --- a/config/automatrop/roles/software/templates/snippets/pm_dev_perl.j2 +++ b/config/automatrop/roles/software/templates/snippets/pm_dev_perl.j2 @@ -1,3 +1,5 @@ {% if arch_based %} +{# TODO Disabled because it currently doesn't build perl-perl-languageserver +#} {% endif %} From a8133a9dba9ec7854f326f43ad51d292bde0565a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 21 Oct 2023 22:02:18 +0200 Subject: [PATCH 14/20] Add nix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C'est le début de la fin... --- config/automatrop/host_vars/curacao.geoffrey.frogeye.fr | 1 + .../automatrop/roles/software/templates/snippets/pm_dev_nix.j2 | 3 +++ .../automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 config/automatrop/roles/software/templates/snippets/pm_dev_nix.j2 diff --git a/config/automatrop/host_vars/curacao.geoffrey.frogeye.fr b/config/automatrop/host_vars/curacao.geoffrey.frogeye.fr index 7fa997f..bdb9175 100644 --- a/config/automatrop/host_vars/curacao.geoffrey.frogeye.fr +++ b/config/automatrop/host_vars/curacao.geoffrey.frogeye.fr @@ -4,6 +4,7 @@ dev_stuffs: - ansible - docker - network + - nix - perl - php - python diff --git a/config/automatrop/roles/software/templates/snippets/pm_dev_nix.j2 b/config/automatrop/roles/software/templates/snippets/pm_dev_nix.j2 new file mode 100644 index 0000000..71a9e74 --- /dev/null +++ b/config/automatrop/roles/software/templates/snippets/pm_dev_nix.j2 @@ -0,0 +1,3 @@ +nix +rnix-lsp + diff --git a/config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 b/config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 index 6045998..de7fb38 100644 --- a/config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 +++ b/config/automatrop/roles/vim/templates/plugins/nvim_lspconfig.j2 @@ -43,6 +43,9 @@ local servers = { {% if 'ansible' in dev_stuffs %} "ansiblels", {% endif %} +{% if 'nix' in dev_stuffs %} + "rnix", +{% endif %} {% if 'perl' in dev_stuffs %} "perlls", {% endif %} From 59ef201eab2372ed0601fcd17749cf405e8f3ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 28 Oct 2023 20:49:14 +0200 Subject: [PATCH 15/20] wpa_supplicant: compatibility with nix branch Well, partial. Let's see when I need EAP again... --- .../roles/system/templates/wpa_supplicant.conf.j2 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/config/automatrop/roles/system/templates/wpa_supplicant.conf.j2 b/config/automatrop/roles/system/templates/wpa_supplicant.conf.j2 index b380481..fde574b 100644 --- a/config/automatrop/roles/system/templates/wpa_supplicant.conf.j2 +++ b/config/automatrop/roles/system/templates/wpa_supplicant.conf.j2 @@ -17,14 +17,10 @@ country=NL community.general.passwordstore doesn't support path with spaces in it, so we're using a `ssid` attribute, which default to the names for SSIDs without space. #} +{% set pass = lookup('community.general.passwordstore', 'wifi/' + name) %} {% set suffixes = lookup('community.general.passwordstore', 'wifi/' + name + ' subkey=suffixes') or [''] %} {% set ssid = lookup('community.general.passwordstore', 'wifi/' + name + ' subkey=ssid') or name %} -{% set type = lookup('community.general.passwordstore', 'wifi/' + name + ' subkey=type') or 'wpa' %} -{% if type in ('wpa', 'wep', 'wpa-eap') %} -{% set pass = lookup('community.general.passwordstore', 'wifi/' + name) %} -{% else %} -{% set pass = 'Error, no pass for type ' + type %} -{% endif %} +{% set type = lookup('community.general.passwordstore', 'wifi/' + name + ' subkey=type') or ('wpa' if pass else 'open') %} # {{ name }} {% for suffix in suffixes %} network={ From 5cb4e9f3f6599a1733ff234ca77e99cf060f4f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 28 Oct 2023 20:50:34 +0200 Subject: [PATCH 16/20] vdirsyncer: Remove boilerplate code --- .../roles/vdirsyncer/handlers/main.yml | 14 --- .../roles/vdirsyncer/tasks/main.yml | 119 ------------------ .../automatrop/roles/vdirsyncer/vars/main.yml | 1 - 3 files changed, 134 deletions(-) delete mode 100644 config/automatrop/roles/vdirsyncer/handlers/main.yml delete mode 100644 config/automatrop/roles/vdirsyncer/tasks/main.yml delete mode 100644 config/automatrop/roles/vdirsyncer/vars/main.yml diff --git a/config/automatrop/roles/vdirsyncer/handlers/main.yml b/config/automatrop/roles/vdirsyncer/handlers/main.yml deleted file mode 100644 index 05d0e19..0000000 --- a/config/automatrop/roles/vdirsyncer/handlers/main.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: xrdb-reload - command: "xrdb -I{{ ansible_env.HOME }} {{ ansible_env.HOME }}/.config/Xresources/main" - -- name: i3-reload - command: i3-msg reload - -- name: shell-reload - command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" - -- name: fzf-reload - shell: "source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf" - -- name: qutebrowser-reload - shell: "! pgrep qutebrowser || qutebrowser :config-source" diff --git a/config/automatrop/roles/vdirsyncer/tasks/main.yml b/config/automatrop/roles/vdirsyncer/tasks/main.yml deleted file mode 100644 index f53f2a8..0000000 --- a/config/automatrop/roles/vdirsyncer/tasks/main.yml +++ /dev/null @@ -1,119 +0,0 @@ -# - name: Find Dav configuration folders in password store - -# - name: Ensure directories for theme are present -# file: -# state: directory -# path: "{{ ansible_env.HOME }}/{{ item }}" -# with_items: -# - ".config/Xresources" -# - ".config/rofi" -# - ".local/bin" -# - ".config/qutebrowser" -# - ".config/tridactyl/themes" -# -# # Build a single color scheme and template and assign it to a variable -# - base16_builder: -# scheme: "{{ base16_scheme }}" -# template: # This requires https://github.com/mnussbaum/base16-builder-ansible/pull/6 -# - i3 -# - xresources -# - rofi -# - termux -# - alacritty -# - shell -# - fzf -# - vim -# - qutebrowser -# - tridactyl -# - dunst -# register: base16_schemes -# -# - name: Configure Alacritty -# template: -# src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2" -# dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml" -# mode: "u+rw,g=r,o=r" -# # Alacritty has live config reload, so no command to execute -# # However, it doesn't work with yaml includes, hence the template -# -# - name: Set base16 theme for Xresources -# copy: -# content: "{{ base16_schemes['schemes'][base16_scheme]['xresources']['xresources']['base16-' + base16_scheme + '-256.Xresources'] }}" -# dest: "{{ ansible_env.HOME }}/.config/Xresources/theme" -# mode: "u+rw,g=r,o=r" -# notify: -# - xrdb-reload -# -# - name: Download base16 theme for qutebrowser -# copy: -# content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}" -# dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py" -# mode: "u+rw,g=r,o=r" -# notify: -# - qutebrowser-reload -# -# - name: Download base16 theme for Tridactyl -# copy: -# 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" -# dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css" -# mode: "u+rw,g=r,o=r" -# when: False # Not currently used -# -# - name: Configure i3 -# template: -# src: "{{ ansible_env.HOME }}/.config/i3/config.j2" -# dest: "{{ ansible_env.HOME }}/.config/i3/config" -# mode: "u+rw,g=r,o=r" -# notify: -# - i3-reload -# -# - name: Set base16 theme for rofi -# copy: -# content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}" -# dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}" -# mode: "u+rw,g=r,o=r" -# with_items: -# - rasi -# - config -# -# - name: Configure Dunst -# template: -# src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2" -# dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc" -# mode: "u+rw,g=r,o=r" -# -# - name: Download base16 theme for fzf -# copy: -# content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}" -# dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf" -# mode: "u+rw,g=r,o=r" -# notify: -# - fzf-reload -# -# - name: Download base16 theme for Termux -# copy: -# content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}" -# dest: "{{ ansible_env.HOME }}/.termux/colors.properties" -# mode: "u+rw,g=r,o=r" -# # TODO Only on Termux -# -# - name: Download base16 theme for shell -# copy: -# content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}" -# dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" -# mode: "u+rwx,g=rx,o=rx" -# notify: -# - shell-reload -# when: False # Not currently used -# -# - name: Set used base16 theme for vim -# copy: -# path: "{{ ansible_env.HOME }}/.config/vim/colorscheme.vim" -# mode: "u+rw,g=r,o=r" -# content: "colorscheme base16-{{ base16_scheme }}" -# when: False # Not currently used -# -# # 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 diff --git a/config/automatrop/roles/vdirsyncer/vars/main.yml b/config/automatrop/roles/vdirsyncer/vars/main.yml deleted file mode 100644 index aaaf42b..0000000 --- a/config/automatrop/roles/vdirsyncer/vars/main.yml +++ /dev/null @@ -1 +0,0 @@ -base16_scheme: solarized-dark From d60f5aaa9d9745ed856186793cb56ea1a854eae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Thu, 2 Nov 2023 19:50:00 +0100 Subject: [PATCH 17/20] automatrop: Fixes --- .../roles/desktop_environment/tasks/main.yml | 3 ++- config/automatrop/roles/dotfiles/tasks/main.yml | 1 + config/automatrop/roles/software/tasks/main.yml | 10 +++------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config/automatrop/roles/desktop_environment/tasks/main.yml b/config/automatrop/roles/desktop_environment/tasks/main.yml index ce68c8e..68e00a6 100644 --- a/config/automatrop/roles/desktop_environment/tasks/main.yml +++ b/config/automatrop/roles/desktop_environment/tasks/main.yml @@ -14,7 +14,7 @@ # Download fonts - name: Download Nerd fonts get_url: - url: "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{ item.filename | urlencode }}" + url: "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/704336735f576781b2a57b12a0c723e3316cbdec/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{ item.filename | urlencode }}" dest: "{{ ansible_user_dir }}/.local/share/fonts/{{ item.filename }}" mode: "u=rw,g=r,o=r" loop: @@ -37,6 +37,7 @@ - name: Install python dependencies for lemonbar pip: 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 - base16_builder: diff --git a/config/automatrop/roles/dotfiles/tasks/main.yml b/config/automatrop/roles/dotfiles/tasks/main.yml index 0498403..05342ab 100644 --- a/config/automatrop/roles/dotfiles/tasks/main.yml +++ b/config/automatrop/roles/dotfiles/tasks/main.yml @@ -28,4 +28,5 @@ - name: Install python dependencies for scripts pip: requirements: "{{ ansible_user_dir }}/.dotfiles/config/scripts/requirements.txt" + extra_args: --break-system-packages # It's fine, it's local anyways diff --git a/config/automatrop/roles/software/tasks/main.yml b/config/automatrop/roles/software/tasks/main.yml index 9ef01ef..c4fce29 100644 --- a/config/automatrop/roles/software/tasks/main.yml +++ b/config/automatrop/roles/software/tasks/main.yml @@ -162,15 +162,11 @@ # 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 pacman: - name: "{{ (base_devel_packages.stdout | split('\n') | reject('eq', 'sudo')) + ['fakeroot'] }}" + name: + - base-devel + - fakeroot become: yes when: arch_based # Do not install sudo because maybe sudo-fake is installed (otherwise it conflicts) From 9c3dcba2e59df66b6b1945caccb107208b8252b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Thu, 2 Nov 2023 19:51:54 +0100 Subject: [PATCH 18/20] automatrop: Run ansible-lint --fix --- config/automatrop/playbooks/default.yml | 1 + config/automatrop/roles/access/tasks/main.yml | 15 +- .../desktop_environment/handlers/main.yml | 25 +-- .../roles/desktop_environment/tasks/main.yml | 88 ++++---- .../roles/dotfiles/handlers/main.yml | 6 +- .../automatrop/roles/dotfiles/tasks/main.yml | 24 +- .../roles/ecryptfs_automount/tasks/main.yml | 19 +- .../roles/extensions/tasks/main.yml | 9 +- config/automatrop/roles/facts/tasks/main.yml | 5 +- config/automatrop/roles/gnupg/tasks/main.yml | 15 +- config/automatrop/roles/gnupg/vars/main.yml | 1 + .../roles/software/handlers/main.yml | 21 +- .../automatrop/roles/software/tasks/main.yml | 148 ++++++------ .../roles/system/handlers/main.yaml | 39 ++-- config/automatrop/roles/system/tasks/main.yml | 210 +++++++++--------- config/automatrop/roles/termux/tasks/main.yml | 13 +- config/automatrop/roles/vim/handlers/main.yml | 9 +- config/automatrop/roles/vim/tasks/main.yml | 27 +-- 18 files changed, 342 insertions(+), 333 deletions(-) diff --git a/config/automatrop/playbooks/default.yml b/config/automatrop/playbooks/default.yml index 227b4a4..c3ab088 100644 --- a/config/automatrop/playbooks/default.yml +++ b/config/automatrop/playbooks/default.yml @@ -1,3 +1,4 @@ +--- - name: Default hosts: all roles: diff --git a/config/automatrop/roles/access/tasks/main.yml b/config/automatrop/roles/access/tasks/main.yml index d6ab777..8eec9e3 100644 --- a/config/automatrop/roles/access/tasks/main.yml +++ b/config/automatrop/roles/access/tasks/main.yml @@ -1,22 +1,23 @@ +--- - name: Set variables - set_fact: + ansible.builtin.set_fact: manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}" - name: Enable passwordless sudo access to wheel group (Others) - lineinfile: + ansible.builtin.lineinfile: path: /etc/sudoers line: "%wheel ALL=(ALL) NOPASSWD: ALL" regexp: "^#? *%wheel ALL=\\(ALL\\) NOPASSWD: ALL$" - become: yes + become: true when: not manjaro - name: Enable passwordless sudo access to wheel group (Manjaro) - copy: - content: "%wheel ALL=(ALL) NOPASSWD: ALL" + ansible.builtin.copy: + content: "%wheel ALL=(ALL) NOPASSWD: ALL" dest: /etc/sudoers.d/11-wheel-nopasswd - mode: "u=rwx,g=rx,o=" + mode: u=rwx,g=rx,o= when: manjaro - become: yes + become: true # /etc/sudoers.d/10-installer is the same thing, # but **with** a password, and it's overwritten # with each upgrade of manjaro-system, hence this. diff --git a/config/automatrop/roles/desktop_environment/handlers/main.yml b/config/automatrop/roles/desktop_environment/handlers/main.yml index 05d0e19..5eaac96 100644 --- a/config/automatrop/roles/desktop_environment/handlers/main.yml +++ b/config/automatrop/roles/desktop_environment/handlers/main.yml @@ -1,14 +1,11 @@ -- name: xrdb-reload - command: "xrdb -I{{ ansible_env.HOME }} {{ ansible_env.HOME }}/.config/Xresources/main" - -- name: i3-reload - command: i3-msg reload - -- name: shell-reload - command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" - -- name: fzf-reload - shell: "source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf" - -- name: qutebrowser-reload - shell: "! pgrep qutebrowser || qutebrowser :config-source" +--- +- name: Xrdb-reload + ansible.builtin.command: xrdb -I{{ ansible_env.HOME }} {{ ansible_env.HOME }}/.config/Xresources/main +- name: I3-reload + ansible.builtin.command: i3-msg reload +- name: Shell-reload + ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" +- name: Fzf-reload + ansible.builtin.command: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf +- name: Qutebrowser-reload + ansible.builtin.shell: "! pgrep qutebrowser || qutebrowser :config-source" diff --git a/config/automatrop/roles/desktop_environment/tasks/main.yml b/config/automatrop/roles/desktop_environment/tasks/main.yml index 68e00a6..7bf5de8 100644 --- a/config/automatrop/roles/desktop_environment/tasks/main.yml +++ b/config/automatrop/roles/desktop_environment/tasks/main.yml @@ -1,22 +1,24 @@ +--- - name: Ensure directories for desktop applications are present - file: + ansible.builtin.file: state: directory path: "{{ ansible_user_dir }}/{{ item }}" - mode: "u=rwx,g=rx,o=rx" + mode: u=rwx,g=rx,o=rx with_items: - - ".config/Xresources" - - ".config/rofi" - - ".local/bin" - - ".local/share/fonts" - - ".config/qutebrowser" - - ".config/tridactyl/themes" + - .config/Xresources + - .config/rofi + - .local/bin + - .local/share/fonts + - .config/qutebrowser + - .config/tridactyl/themes # Download fonts - name: Download Nerd fonts - get_url: - url: "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/704336735f576781b2a57b12a0c723e3316cbdec/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{ item.filename | urlencode }}" + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/ryanoasis/nerd-fonts/704336735f576781b2a57b12a0c723e3316cbdec/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{ + item.filename | urlencode }} dest: "{{ ansible_user_dir }}/.local/share/fonts/{{ item.filename }}" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r loop: - filename: DejaVu Sans Mono Bold Nerd Font Complete Mono.ttf folder: Bold @@ -28,14 +30,14 @@ folder: Italic - name: Download icon fonts - get_url: - url: "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/fonts/fontawesome-webfont.ttf" + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/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 - name: Install python dependencies for lemonbar - pip: + ansible.builtin.pip: requirements: "{{ ansible_user_dir }}/.dotfiles/config/lemonbar/requirements.txt" extra_args: --break-system-packages # It's fine, it's local anyways @@ -59,20 +61,20 @@ - i3 - name: Configure Alacritty - template: + ansible.builtin.template: src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2" dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml" - mode: "u=rw,g=r,o=r" -# Alacritty has live config reload, so no command to execute -# However, it doesn't work with yaml includes, hence the template + mode: u=rw,g=r,o=r + # Alacritty has live config reload, so no command to execute + # However, it doesn't work with yaml includes, hence the template tags: - color - name: Set base16 theme for Xresources - copy: + ansible.builtin.copy: content: "{{ base16_schemes['schemes'][base16_scheme]['xresources']['xresources']['base16-' + base16_scheme + '-256.Xresources'] }}" dest: "{{ ansible_env.HOME }}/.config/Xresources/theme" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r notify: - xrdb-reload tags: @@ -80,30 +82,30 @@ when: display_server == 'x11' - name: Download base16 theme for qutebrowser - copy: + ansible.builtin.copy: content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}" dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r notify: - qutebrowser-reload tags: - color - name: Download base16 theme for Tridactyl - copy: + ansible.builtin.copy: 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" dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css" - mode: "u=rw,g=r,o=r" - when: False # Not currently used + mode: u=rw,g=r,o=r + when: false # Not currently used tags: - color - name: Configure i3 - template: + ansible.builtin.template: src: "{{ ansible_env.HOME }}/.config/i3/config.j2" dest: "{{ ansible_env.HOME }}/.config/i3/config" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r notify: - i3-reload tags: @@ -112,10 +114,10 @@ when: display_server == 'x11' - name: Set base16 theme for rofi - copy: + ansible.builtin.copy: content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}" dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r tags: - color loop: @@ -123,49 +125,49 @@ - rasi - name: Configure Dunst - template: + ansible.builtin.template: src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2" dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r tags: - color when: display_server == 'x11' - name: Download base16 theme for fzf - copy: + ansible.builtin.copy: content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}" dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r notify: - fzf-reload tags: - color - name: Download base16 theme for shell - copy: + ansible.builtin.copy: content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}" dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" - mode: "u=rwx,g=rx,o=rx" + mode: u=rwx,g=rx,o=rx notify: - shell-reload - when: False # Not currently used + when: false # Not currently used tags: - color - name: Set used base16 theme for vim - copy: + ansible.builtin.copy: path: "{{ ansible_env.HOME }}/.config/vim/colorscheme.vim" - mode: "u=rw,g=r,o=r" - content: "colorscheme base16-{{ base16_scheme }}" - when: False # Not currently used + mode: u=rw,g=r,o=r + content: colorscheme base16-{{ base16_scheme }} + when: false # Not currently used tags: - color - name: Enable user services - systemd: + ansible.builtin.systemd: name: "{{ item }}" state: started - enabled: yes + enabled: true scope: user loop: - pulseaudio diff --git a/config/automatrop/roles/dotfiles/handlers/main.yml b/config/automatrop/roles/dotfiles/handlers/main.yml index e04e684..871fdcc 100644 --- a/config/automatrop/roles/dotfiles/handlers/main.yml +++ b/config/automatrop/roles/dotfiles/handlers/main.yml @@ -1,3 +1,3 @@ -- name: install dotfiles - command: "{{ ansible_user_dir }}/.dotfiles/config/scripts/dotfiles install" -# TODO A python module to do that, so without an handler +--- +- name: Install dotfiles + ansible.builtin.command: "{{ ansible_user_dir }}/.dotfiles/config/scripts/dotfiles install" diff --git a/config/automatrop/roles/dotfiles/tasks/main.yml b/config/automatrop/roles/dotfiles/tasks/main.yml index 05342ab..48af280 100644 --- a/config/automatrop/roles/dotfiles/tasks/main.yml +++ b/config/automatrop/roles/dotfiles/tasks/main.yml @@ -1,32 +1,32 @@ +--- - name: Ensure directories for applications are present - file: + ansible.builtin.file: state: directory path: "{{ ansible_user_dir }}/{{ item }}" - mode: "u=rwx,g=rx,o=rx" + mode: u=rwx,g=rx,o=rx with_items: - - ".cache/zsh" - - ".cache/mpd" - - ".ssh" - - ".local/bin" - - ".ansible/collections/ansible_collections/geoffreyfrogeye" + - .cache/zsh + - .cache/mpd + - .ssh + - .local/bin + - .ansible/collections/ansible_collections/geoffreyfrogeye - name: Install dotfiles repository - git: + ansible.builtin.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: yes + update: true notify: install dotfiles tags: dotfiles_repo # 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 - file: + ansible.builtin.file: state: link src: "{{ ansible_user_dir }}/.dotfiles/config/automatrop" path: "{{ ansible_user_dir }}/.ansible/collections/ansible_collections/geoffreyfrogeye/automatrop" - name: Install python dependencies for scripts - pip: + ansible.builtin.pip: requirements: "{{ ansible_user_dir }}/.dotfiles/config/scripts/requirements.txt" extra_args: --break-system-packages # It's fine, it's local anyways - diff --git a/config/automatrop/roles/ecryptfs_automount/tasks/main.yml b/config/automatrop/roles/ecryptfs_automount/tasks/main.yml index 9cc3a2c..5500200 100644 --- a/config/automatrop/roles/ecryptfs_automount/tasks/main.yml +++ b/config/automatrop/roles/ecryptfs_automount/tasks/main.yml @@ -1,34 +1,35 @@ +--- - name: Setup pam_encryptfs auth - blockinfile: + ansible.builtin.blockinfile: path: /etc/pam.d/system-auth block: | auth [success=1 default=ignore] pam_succeed_if.so service = systemd-user quiet 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" - become: yes + become: true notify: - etc changed - name: Setup pam_encryptfs password - blockinfile: + ansible.builtin.blockinfile: path: /etc/pam.d/system-auth block: | 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" - become: yes + become: true notify: - etc changed - name: Setup pam_encryptfs session - blockinfile: + ansible.builtin.blockinfile: path: /etc/pam.d/system-auth block: | session [success=1 default=ignore] pam_succeed_if.so service = systemd-user quiet 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" - become: yes + become: true notify: - etc changed diff --git a/config/automatrop/roles/extensions/tasks/main.yml b/config/automatrop/roles/extensions/tasks/main.yml index 13024e0..d14feb9 100644 --- a/config/automatrop/roles/extensions/tasks/main.yml +++ b/config/automatrop/roles/extensions/tasks/main.yml @@ -1,13 +1,14 @@ +--- - name: Load extensions - include_role: - name: "geoffreyfrogeye.{{ extension }}automatrop.entry" + ansible.builtin.include_role: + name: geoffreyfrogeye.{{ extension }}automatrop.entry loop: "{{ extensions }}" loop_control: loop_var: extension tags: always - name: Configure extensions rc sourcing - template: + ansible.builtin.template: src: extrc.sh.j2 dest: "{{ ansible_user_dir }}/.config/shell/extrc" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r diff --git a/config/automatrop/roles/facts/tasks/main.yml b/config/automatrop/roles/facts/tasks/main.yml index fd07ad9..238366b 100644 --- a/config/automatrop/roles/facts/tasks/main.yml +++ b/config/automatrop/roles/facts/tasks/main.yml @@ -1,5 +1,6 @@ +--- - name: Set facts - set_fact: + ansible.builtin.set_fact: arch_based: "{{ ansible_distribution == 'Archlinux' }}" arch: "{{ ansible_lsb.id == 'Arch' }}" manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}" @@ -11,7 +12,7 @@ - always - name: Set composed facts - set_fact: + ansible.builtin.set_fact: debian_based: "{{ debian or ubuntu }}" can_chown: "{{ not junest }}" has_systemd: "{{ not junest }}" diff --git a/config/automatrop/roles/gnupg/tasks/main.yml b/config/automatrop/roles/gnupg/tasks/main.yml index 619119b..eb5c3b8 100644 --- a/config/automatrop/roles/gnupg/tasks/main.yml +++ b/config/automatrop/roles/gnupg/tasks/main.yml @@ -1,22 +1,23 @@ +--- - name: Create GnuPG directory - file: + ansible.builtin.file: path: "{{ gnupghome }}" state: directory - mode: "u=rwx" + mode: u=rwx - name: Create GnuPG configuration files - file: + ansible.builtin.file: path: "{{ gnupghome }}/{{ item }}" state: file - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r loop: - gpg-agent.conf - gpg.conf - name: Configure GnuPG - lineinfile: + ansible.builtin.lineinfile: 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 %}" loop: # Remove fluff @@ -25,7 +26,7 @@ - key: no-comments # Output format that I prefer - key: keyid-format - value: 0xlong + value: "0xlong" # Show fingerprints - key: with-fingerprint # Make sure to show if key is invalid diff --git a/config/automatrop/roles/gnupg/vars/main.yml b/config/automatrop/roles/gnupg/vars/main.yml index fb95fd1..99f562b 100644 --- a/config/automatrop/roles/gnupg/vars/main.yml +++ b/config/automatrop/roles/gnupg/vars/main.yml @@ -1 +1,2 @@ +--- gnupghome: "{{ ansible_user_dir }}/.config/gnupg" diff --git a/config/automatrop/roles/software/handlers/main.yml b/config/automatrop/roles/software/handlers/main.yml index 2f759f8..54bb26a 100644 --- a/config/automatrop/roles/software/handlers/main.yml +++ b/config/automatrop/roles/software/handlers/main.yml @@ -1,23 +1,24 @@ +--- - name: Create and install meta package for Arch Linux + when: arch_based + block: - name: Generate meta package PKGBUILD - template: + ansible.builtin.template: src: PKGBUILD.j2 dest: "{{ ansible_user_dir }}/.cache/automatrop/PKGBUILD" - listen: "software changed" + listen: software changed - name: Install meta package aur: - name: "automatrop-packages-{{ inventory_hostname_short }}" + name: automatrop-packages-{{ inventory_hostname_short }} local_pkgbuild: "{{ ansible_user_dir }}/.cache/automatrop" use: makepkg state: latest - listen: "software changed" + listen: software changed when: root_access - when: arch_based - -- name: update pacman cache - pacman: - update_cache: yes - become: yes +- name: Update pacman cache + community.general.pacman: + update_cache: true + become: true when: arch_based diff --git a/config/automatrop/roles/software/tasks/main.yml b/config/automatrop/roles/software/tasks/main.yml index c4fce29..7686056 100644 --- a/config/automatrop/roles/software/tasks/main.yml +++ b/config/automatrop/roles/software/tasks/main.yml @@ -1,43 +1,43 @@ - +--- # TODO Install python if not done # Or maybe not, it requires a lot of automation for something that can be done # very quickly manually and is usually already installed - name: Install python-apt dependency for Termux + when: termux + vars: + version: 2.39 + block: # TODO Check if the correct version - name: Check for DistUtilsExtra (Termux) - command: python -c 'import DistUtilsExtra' - changed_when: False + ansible.builtin.command: python -c 'import DistUtilsExtra' + changed_when: false rescue: - name: Create temporarty folder for DistUtilsExtra (Termux) - tempfile: + ansible.builtin.tempfile: state: directory suffix: python-distutils-extra # path: /data/data/com.termux/files/usr/tmp/ register: pde_tempdir - name: Download DistUtilsExtra (Termux) - get_url: - url: "https://launchpad.net/python-distutils-extra/trunk/{{ version }}/+download/python-distutils-extra-{{ version }}.tar.gz" + ansible.builtin.get_url: + 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" - name: Extract DistUtilsExtra (Termux) - unarchive: + ansible.builtin.unarchive: src: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz" - remote_src: yes + remote_src: true dest: "{{ pde_tempdir.path }}" - name: Install DistUtilsExtra (Termux) - command: + ansible.builtin.command: cmd: python3 setup.py install chdir: "{{ pde_tempdir.path }}/python-distutils-extra-{{ version }}" - when: termux - vars: - version: 2.39 - - name: Install python-apt (Termux) - pip: + ansible.builtin.pip: name: python-apt when: termux @@ -62,112 +62,110 @@ # TODO Patch sudo-fake so it allows using -u so `become` works - name: Enable multilib repo - lineinfile: + ansible.builtin.lineinfile: path: /etc/pacman.conf - regexp: '^#?\s*\[multilib\]$' - line: '[multilib]' - become: yes + regexp: ^#?\s*\[multilib\]$ + line: "[multilib]" + become: true when: arch_based and ansible_architecture == "x86_64" notify: udpate pacman cache - name: Configure multilib repo - lineinfile: + ansible.builtin.lineinfile: path: /etc/pacman.conf - regexp: '^#?\s*Include\s*=\s*/etc/pacman.d/mirrorlist' - line: 'Include = /etc/pacman.d/mirrorlist' - insertafter: '^\[multilib\]$' - become: yes + regexp: ^#?\s*Include\s*=\s*/etc/pacman.d/mirrorlist + line: Include = /etc/pacman.d/mirrorlist + insertafter: ^\[multilib\]$ + become: true when: arch_based and ansible_architecture == "x86_64" notify: udpate pacman cache - name: Update cache if needed - meta: flush_handlers - + ansible.builtin.meta: flush_handlers - name: Install ccache - pacman: + community.general.pacman: name: ccache state: present - extra_args: "--asdeps" - become: yes + extra_args: --asdeps + become: true when: arch_based - name: Enable makepkg color - replace: + ansible.builtin.replace: path: /etc/makepkg.conf - regexp: '^BUILDENV=(.+)!color(.+)$' - replace: 'BUILDENV=\1color\2' - become: yes + regexp: ^BUILDENV=(.+)!color(.+)$ + replace: BUILDENV=\1color\2 + become: true when: arch_based - name: Enable makepkg ccache - replace: + ansible.builtin.replace: path: /etc/makepkg.conf - regexp: '^BUILDENV=(.+)!ccache(.+)$' - replace: 'BUILDENV=\1ccache\2' - become: yes + regexp: ^BUILDENV=(.+)!ccache(.+)$ + replace: BUILDENV=\1ccache\2 + become: true when: arch_based - name: Remove -mtune from makepkg CFLAGS - replace: + ansible.builtin.replace: path: /etc/makepkg.conf - regexp: '^#? *CFLAGS=(.+)-mtune=\S+\s(.*)$' - replace: "CFLAGS=\\1\\2" - become: yes + regexp: ^#? *CFLAGS=(.+)-mtune=\S+\s(.*)$ + replace: CFLAGS=\1\2 + become: true when: arch_based - name: Change -march to native from makepkg CFLAGS - replace: + ansible.builtin.replace: path: /etc/makepkg.conf - regexp: '^#? *CFLAGS=(.+)-march=\S+(\s)(.*)$' - replace: "CFLAGS=\\1-march=native\\2\\3" - become: yes + regexp: ^#? *CFLAGS=(.+)-march=\S+(\s)(.*)$ + replace: CFLAGS=\1-march=native\2\3 + become: true when: arch_based - name: Set makepkg MAKEFLAGS - replace: + ansible.builtin.replace: path: /etc/makepkg.conf - regexp: '^#? *MAKEFLAGS=(.+)-j[0-9]+(.+)$' - replace: "MAKEFLAGS=\\1-j{{ j }}\\2" - become: yes + regexp: ^#? *MAKEFLAGS=(.+)-j[0-9]+(.+)$ + replace: MAKEFLAGS=\1-j{{ j }}\2 + become: true vars: j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}" when: arch_based - name: Enable pacman ParallelDownloads - lineinfile: + ansible.builtin.lineinfile: path: /etc/pacman.conf - regexp: '^#?ParallelDownloads' - line: 'ParallelDownloads = 5' - insertafter: '^\[options\]$' - become: yes + regexp: ^#?ParallelDownloads + line: ParallelDownloads = 5 + insertafter: ^\[options\]$ + become: true when: arch_based - name: Enable pacman colors - lineinfile: + ansible.builtin.lineinfile: path: /etc/pacman.conf - regexp: '^#?Color' - line: 'Color' - insertafter: '^\[options\]$' - become: yes + regexp: ^#?Color + line: Color + insertafter: ^\[options\]$ + become: true when: arch_based - name: Enable pacman pac-man - lineinfile: + ansible.builtin.lineinfile: path: /etc/pacman.conf - regexp: '^#?ILoveCandy' - line: 'ILoveCandy' - insertafter: '^#?Color' - become: yes + regexp: ^#?ILoveCandy + line: ILoveCandy + insertafter: ^#?Color + become: true when: arch_based - # Install alternative package managers - name: Install dependencies for AUR helpers - pacman: + community.general.pacman: name: - base-devel - fakeroot - become: yes + become: true when: arch_based # Do not install sudo because maybe sudo-fake is installed (otherwise it conflicts) # It should already be installed already anyway @@ -178,41 +176,41 @@ when: arch - name: Install AUR package manager (Manjaro) - pacman: + community.general.pacman: name: yay - become: yes + become: true when: manjaro # Not sure if regular Manjaro has yay in its community packages, # but Manjaro-ARM sure does - name: Create cache folder - file: + ansible.builtin.file: state: directory - mode: "u=rwx,g=rx,o=rx" + mode: u=rwx,g=rx,o=rx path: "{{ ansible_user_dir }}/.cache/automatrop" - name: Generate list of packages for package manager - set_fact: + ansible.builtin.set_fact: packages: "{{ query('template', 'package_manager.j2')[0].split('\n')[:-1]|sort|unique }}" tags: softwarelist - name: Install packages (Arch-based) aur: name: "{{ packages }}" - extra_args: "--asdeps --needed" + extra_args: --asdeps --needed # Nothing is set as installed manually so it can # be removed by dependency check. # Current packages will be kept by the meta package use: yay - notify: "software changed" + notify: software changed tags: softwarelist when: arch_based - name: Check if list of packages changed - copy: + ansible.builtin.copy: content: "{% for package in packages %}{{ package }}\n{% endfor %}" dest: "{{ ansible_user_dir }}/.cache/automatrop/package_manager" - notify: "software changed" + notify: software changed tags: softwarelist # translate-shell diff --git a/config/automatrop/roles/system/handlers/main.yaml b/config/automatrop/roles/system/handlers/main.yaml index 595a97f..45df77b 100644 --- a/config/automatrop/roles/system/handlers/main.yaml +++ b/config/automatrop/roles/system/handlers/main.yaml @@ -1,46 +1,47 @@ +--- - name: Create a etckeeper commit - command: "etckeeper commit 'automatrop {{ ansible_date_time.iso8601 }}'" - listen: "etc changed" - become: yes + ansible.builtin.command: etckeeper commit 'automatrop {{ ansible_date_time.iso8601 }}' + listen: etc changed + become: true 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" - name: Restart chrony - systemd: + ansible.builtin.systemd: name: chronyd state: restarted listen: chrony reconfigured - become: yes + become: true - name: Reload systemd daemon - systemd: - daemon_reload: yes + ansible.builtin.systemd: + daemon_reload: true listen: systemd changed - become: yes + become: true - name: Restart wpa_supplicant - systemd: - name: "wpa_supplicant@{{ item }}" + ansible.builtin.systemd: + name: wpa_supplicant@{{ item }} state: restarted - become: yes + become: true loop: "{{ ansible_interfaces }}" - when: "item.startswith('wl')" + when: item.startswith('wl') listen: wpa_supplicant changed # Could probably use something better like # listing /sys/class/ieee80211/*/device/net/ - name: Warn about changed Wi-Fi setup - debug: - msg: "The Wi-Fi configuration was changed, but not applied to let this playbook finish. A reboot is required." + ansible.builtin.debug: + msg: The Wi-Fi configuration was changed, but not applied to let this playbook finish. A reboot is required. listen: wifi setup changed - name: Warn about changed Panfrost config - debug: - msg: "The Panfrost display driver configuration was changed, but needs a reboot to be applied." + ansible.builtin.debug: + msg: The Panfrost display driver configuration was changed, but needs a reboot to be applied. listen: panfrost config changed - name: Reload systemd-logind - command: systemctl kill -s HUP systemd-logind - become: yes + ansible.builtin.command: systemctl kill -s HUP systemd-logind + become: true listen: systemd-logind config changed diff --git a/config/automatrop/roles/system/tasks/main.yml b/config/automatrop/roles/system/tasks/main.yml index aade07b..01d8630 100644 --- a/config/automatrop/roles/system/tasks/main.yml +++ b/config/automatrop/roles/system/tasks/main.yml @@ -1,3 +1,4 @@ +--- # TODO For other distributions # Package are installed with --asdeps because they are needed @@ -5,97 +6,96 @@ # Etckeeper - name: Check if etckeeper is initialized - stat: + ansible.builtin.stat: path: /etc/.git register: etckeeper - become: yes + become: true - name: Initialize etckeeper - command: "etckeeper init" - become: yes + ansible.builtin.command: etckeeper init + become: true when: not etckeeper.stat.exists - changed_when: yes + changed_when: true - name: Configure git user.name for etckeeper - git_config: + community.general.git_config: scope: local repo: /etc name: "{{ item.name }}" value: "{{ item.value }}" loop: - - name: "user.name" - value: "etckeeper on {{ inventory_hostname_short }}" - - name: "user.email" - value: "etckeeper@{{ inventory_hostname }}" - become: yes + - name: user.name + value: etckeeper on {{ inventory_hostname_short }} + - name: user.email + value: etckeeper@{{ inventory_hostname }} + become: true # Manjaro configuration - name: Remove Manjaro's pamac - pacman: + community.general.pacman: name: pamac state: absent - become: yes + become: true when: arch_based and False # I'm trying to remember why I usually delete this thing # Verbose logging during boot - name: Check if using Uboot - stat: + ansible.builtin.stat: path: /boot/extlinux/extlinux.conf register: extlinux # This (and the following) was made with the Pinebook in mind, # not sure about compatibility - name: Remove non-tty1 console (Uboot) - replace: + ansible.builtin.replace: path: /boot/extlinux/extlinux.conf - regexp: '^APPEND(.*) console=(?!tty1)\S+(.*)$' - replace: 'APPEND\1\2' - become: yes + regexp: ^APPEND(.*) console=(?!tty1)\S+(.*)$ + replace: APPEND\1\2 + become: true when: extlinux.stat.exists # Only one console= will be removed because regular expression are either hard # or somewhat limited. It's just what I need anyway - name: Remove bootsplash.bootfile (Uboot) - replace: + ansible.builtin.replace: path: /boot/extlinux/extlinux.conf - regexp: '^APPEND(.*) bootsplash.bootfile=\S+(.*)$' - replace: 'APPEND\1\2' - become: yes + regexp: ^APPEND(.*) bootsplash.bootfile=\S+(.*)$ + replace: APPEND\1\2 + become: true when: extlinux.stat.exists - name: Remove bootsplash packages (Arch based) - pacman: + community.general.pacman: name: - bootsplash-systemd - bootsplash-theme-manjaro state: absent - become: yes + become: true when: arch_based - # Display Manager - name: Remove display manager packages (Arch based) - pacman: + community.general.pacman: name: - sddm - sddm-breath2-theme state: absent - become: yes + become: true when: arch_based # Xorg configuration - name: Check if there is nvidia-xrun is installed - stat: + ansible.builtin.stat: path: /etc/X11/nvidia-xorg.conf register: nvidia_xrun when: display_server == 'x11' - name: Add nvidia-xrun xorg config directory - set_fact: + ansible.builtin.set_fact: xorg_common_config_dirs: "{{ xorg_default_config_dirs + xorg_nvidia_config_dirs }}" vars: xorg_default_config_dirs: @@ -104,78 +104,78 @@ when: display_server == 'x11' - name: Configure Xorg keyboard layout - copy: + ansible.builtin.copy: src: xorg/keyboard.conf dest: "{{ item }}/00-keyboard.conf" - become: yes + become: true when: display_server == 'x11' notify: etc changed loop: "{{ xorg_common_config_dirs }}" - name: Use Alt keys for numpad - patch: + ansible.posix.patch: src: us_qwert_alt_numpad.patch dest: /usr/share/X11/xkb/symbols/us_qwerty-fr - become: yes + become: true 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: + ansible.builtin.stat: path: /sys/class/backlight/intel_backlight register: intel_backlight when: display_server == 'x11' - name: Install Intel video drivers (Arch based) - pacman: + community.general.pacman: name: xf86-video-intel # state: "{{ intel_backlight.stat.exists }}" state: present - become: yes + become: true 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: + ansible.builtin.copy: src: xorg/intel_backlight.conf dest: "{{ item }}/20-intel_backlight.conf" - become: yes + become: true when: display_server == 'x11' and intel_backlight.stat.exists notify: etc changed loop: "{{ xorg_common_config_dirs }}" - name: Configure Xorg touchpad behaviour - copy: + ansible.builtin.copy: src: xorg/touchpad.conf dest: "{{ item }}/30-touchpad.conf" - become: yes + become: true when: display_server == 'x11' notify: etc changed loop: "{{ xorg_common_config_dirs }}" - name: Configure Xorg joystick behaviour - copy: + ansible.builtin.copy: src: xorg/joystick.conf dest: "{{ item }}/50-joystick.conf" - become: yes + become: true when: display_server == 'x11' notify: etc changed loop: "{{ xorg_common_config_dirs }}" - name: List modules we're using - slurp: + ansible.builtin.slurp: src: /proc/modules - register: modules + register: modules when: display_server # Not sure the module will be loaded in early setup stages though - name: Make panfrost use OpenGL 3.3 - lineinfile: + ansible.builtin.lineinfile: path: /etc/environment - line: 'PAN_MESA_DEBUG="gl3"' - regexp: '^#? ?PAN_MESA_DEBUG=' - become: yes + line: PAN_MESA_DEBUG="gl3" + regexp: ^#? ?PAN_MESA_DEBUG= + become: true when: display_server and using_panfrost vars: using_panfrost: "{{ 'panfrost' in (modules.content | b64decode) }}" @@ -183,21 +183,21 @@ # Numlock on boot -- name: set numlock on boot - copy: +- name: Set numlock on boot + ansible.builtin.copy: src: getty.service dest: /etc/systemd/system/getty@.service.d/override.conf - become: yes + become: true notify: - etc changed - systemd changed when: auto_numlock - name: Unset numlock on boot - file: + ansible.builtin.file: path: /etc/systemd/system/getty@.service.d/override.conf state: absent - become: yes + become: true notify: - etc changed - systemd changed @@ -206,163 +206,163 @@ # TLP configuration - name: Start/enable TLP - systemd: + ansible.builtin.systemd: name: tlp state: started - enabled: yes - become: yes + enabled: true + become: true notify: etc changed # Network configuration - name: Start/enable dhcpcd - systemd: + ansible.builtin.systemd: name: dhcpcd state: started - enabled: yes - become: yes + enabled: true + become: true notify: etc changed - name: Configure wpa_supplicant - template: + ansible.builtin.template: src: wpa_supplicant.conf.j2 dest: /etc/wpa_supplicant/wpa_supplicant.conf notify: - etc changed - wpa_supplicant changed - become: yes + become: true tags: - wificonf - name: Prepare directory for wpa_supplicant service override - file: + ansible.builtin.file: path: /etc/systemd/system/wpa_supplicant@.service.d state: directory - mode: "u=rwx,g=rx,o=rx" - become: yes + mode: u=rwx,g=rx,o=rx + become: true - name: Make wpa_supplicant use a common configuration file - copy: + ansible.builtin.copy: src: wpa_supplicant.service dest: /etc/systemd/system/wpa_supplicant@.service.d/override.conf - become: yes + become: true notify: - etc changed - systemd changed - wifi setup changed - name: Disable wpa_supplicant for networkmanager - systemd: + ansible.builtin.systemd: name: wpa_supplicant - enabled: no - become: yes + enabled: false + become: true notify: - etc changed - wifi setup changed - name: Start/enable wpa_supplicant for interface - systemd: - name: "wpa_supplicant@{{ item }}" - enabled: yes - become: yes + ansible.builtin.systemd: + name: wpa_supplicant@{{ item }} + enabled: true + become: true notify: - etc changed - wifi setup changed loop: "{{ ansible_interfaces }}" - when: "item.startswith('wl')" + when: item.startswith('wl') # Could probably use something better like # listing /sys/class/ieee80211/*/device/net/ - name: Uninstall networkmanager - pacman: + community.general.pacman: name: networkmanager state: absent - extra_args: "--cascade --recursive" + extra_args: --cascade --recursive when: arch_based - become: yes + become: true notify: - wifi setup changed - name: Mask systemd-networkd - systemd: + ansible.builtin.systemd: name: systemd-networkd state: stopped - enabled: no - masked: yes - become: yes + enabled: false + masked: true + become: true notify: etc changed # Time synchronisation - name: Mask systemd-timesyncd - systemd: + ansible.builtin.systemd: name: systemd-timesyncd state: stopped - enabled: no - masked: yes - become: yes + enabled: false + masked: true + become: true notify: etc changed - name: Configure chrony - copy: + ansible.builtin.copy: src: chrony.conf dest: /etc/chrony.conf - become: yes + become: true notify: - etc changed - chrony reconfigured # TODO More configuration, RTC configuration - name: Enable chronyd - systemd: + ansible.builtin.systemd: name: chronyd - enabled: yes - become: yes + enabled: true + become: true notify: - etc changed - chrony reconfigured - name: Configure dhcpcd chrony hook - copy: + ansible.builtin.copy: src: dhcpcd.exit-hook dest: /etc/dhcpcd.exit-hook - become: yes + become: true notify: etc changed - name: Empty motd - copy: + ansible.builtin.copy: content: "" dest: /etc/motd - mode: "u=rw,g=r,o=r" - become: yes + mode: u=rw,g=r,o=r + become: true notify: - etc changed # VPN configuration - name: Prepare directory for openvpn-client service override - file: + ansible.builtin.file: path: /etc/systemd/system/openvpn-client@.service.d state: directory - mode: "u=rwx,g=rx,o=rx" - become: yes + mode: u=rwx,g=rx,o=rx + become: true - name: Make openvpn use hooks for resolvconf - copy: + ansible.builtin.copy: src: openvpn-client.service dest: /etc/systemd/system/openvpn-client@.service.d/override.conf - become: yes + become: true notify: - etc changed - systemd changed - name: Disable power button - lineinfile: + ansible.builtin.lineinfile: path: /etc/systemd/logind.conf - line: 'HandlePowerKey=ignore' - regexp: '^#? *HandlePowerKey=' - insertafter: '^\[Login\]$' - become: yes + line: HandlePowerKey=ignore + regexp: ^#? *HandlePowerKey= + insertafter: ^\[Login\]$ + become: true notify: systemd-logind config changed # Reason: I sometimes press it accidentally # (hoping to start it when it's already started, diff --git a/config/automatrop/roles/termux/tasks/main.yml b/config/automatrop/roles/termux/tasks/main.yml index 88ca25d..8656d6d 100644 --- a/config/automatrop/roles/termux/tasks/main.yml +++ b/config/automatrop/roles/termux/tasks/main.yml @@ -1,16 +1,17 @@ +--- - name: Create Termux directory - file: + ansible.builtin.file: state: directory 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. # Make it not install unless it's Termux - name: Silence Termux login message - file: + ansible.builtin.file: state: file 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 - base16_builder: @@ -22,10 +23,10 @@ - color - name: Download base16 theme for Termux - copy: + ansible.builtin.copy: content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}" dest: "{{ ansible_env.HOME }}/.termux/colors.properties" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r tags: - color diff --git a/config/automatrop/roles/vim/handlers/main.yml b/config/automatrop/roles/vim/handlers/main.yml index e11ae85..de6b6f4 100644 --- a/config/automatrop/roles/vim/handlers/main.yml +++ b/config/automatrop/roles/vim/handlers/main.yml @@ -1,11 +1,12 @@ +--- - name: Upgrade Neovim plugins - command: "nvim +PlugUpgrade +PlugUpdate +PlugInstall +qall!" + ansible.builtin.command: nvim +PlugUpgrade +PlugUpdate +PlugInstall +qall! listen: nvim plugins changed environment: - VIMINIT: "source {{ ansible_user_dir }}/.config/nvim/plugininstall.vim" + VIMINIT: source {{ ansible_user_dir }}/.config/nvim/plugininstall.vim - name: Upgrade Vim plugins - command: "vim +PlugUpgrade +PlugUpdate +PlugInstall +qall!" + ansible.builtin.command: vim +PlugUpgrade +PlugUpdate +PlugInstall +qall! listen: vim plugins changed environment: - VIMINIT: "source {{ ansible_user_dir }}/.config/vim/plugininstall.vim" + VIMINIT: source {{ ansible_user_dir }}/.config/vim/plugininstall.vim diff --git a/config/automatrop/roles/vim/tasks/main.yml b/config/automatrop/roles/vim/tasks/main.yml index fb63c5f..5932cd0 100644 --- a/config/automatrop/roles/vim/tasks/main.yml +++ b/config/automatrop/roles/vim/tasks/main.yml @@ -1,5 +1,6 @@ +--- - name: Set vim variants to use - set_fact: + ansible.builtin.set_fact: vim_variants: - vim - nvim @@ -7,37 +8,37 @@ # TODO Select those in a clever way - name: Create vim configuration directory - file: + ansible.builtin.file: state: directory path: "{{ ansible_user_dir }}/.config/{{ item }}" - mode: "u=rwx,g=rx,o=rx" + mode: u=rwx,g=rx,o=rx loop: "{{ vim_variants }}" - name: Install vim-plug - get_url: + ansible.builtin.get_url: url: https://raw.githubusercontent.com/junegunn/vim-plug/master/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 - template: + ansible.builtin.template: src: loader.j2 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 - template: + ansible.builtin.template: src: theme.j2 dest: "{{ ansible_user_dir }}/.config/vim/theme.vim" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r tags: - color - name: Configure vim plugin list - template: + ansible.builtin.template: src: plugininstall.j2 dest: "{{ ansible_user_dir }}/.config/{{ variant }}/plugininstall.vim" - mode: "u=rw,g=r,o=r" + mode: u=rw,g=r,o=r notify: - "{{ variant }} plugins changed" loop: "{{ vim_variants }}" @@ -45,10 +46,10 @@ loop_var: variant - name: Configure vim - template: + ansible.builtin.template: src: init.vim.j2 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_control: loop_var: variant From a33238c45448eabb4dacbf5e86ba869d471db28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Fri, 3 Nov 2023 00:37:39 +0100 Subject: [PATCH 19/20] Fix ansible-lint --fix mistakes --- .../automatrop/roles/desktop_environment/handlers/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/automatrop/roles/desktop_environment/handlers/main.yml b/config/automatrop/roles/desktop_environment/handlers/main.yml index 5eaac96..9234eda 100644 --- a/config/automatrop/roles/desktop_environment/handlers/main.yml +++ b/config/automatrop/roles/desktop_environment/handlers/main.yml @@ -1,11 +1,16 @@ --- - name: Xrdb-reload ansible.builtin.command: xrdb -I{{ ansible_env.HOME }} {{ ansible_env.HOME }}/.config/Xresources/main + listen: xrdb-reload - name: I3-reload ansible.builtin.command: i3-msg reload + listen: i3-reload - name: Shell-reload ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" + listen: shell-reload - name: Fzf-reload - ansible.builtin.command: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf + ansible.builtin.shell: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf + listen: fzf-reload - name: Qutebrowser-reload ansible.builtin.shell: "! pgrep qutebrowser || qutebrowser :config-source" + listen: qutebrowser-reload From 626f274d4690d6458fe2001d443b8ee31def52f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Fri, 3 Nov 2023 20:47:43 +0100 Subject: [PATCH 20/20] i3: Remove unused stuff --- config/i3/ashuffle | 7 ----- config/i3/aw_start | 16 ---------- config/i3/config.j2 | 2 -- config/i3/dmenu_cmd | 2 -- config/i3/dmenu_run | 15 --------- config/i3/multimediaKey | 26 ---------------- config/i3/pitch.png | Bin 67 -> 0 bytes config/i3/screentime | 67 ---------------------------------------- 8 files changed, 135 deletions(-) delete mode 100755 config/i3/ashuffle delete mode 100755 config/i3/aw_start delete mode 100755 config/i3/dmenu_cmd delete mode 100755 config/i3/dmenu_run delete mode 100755 config/i3/multimediaKey delete mode 100644 config/i3/pitch.png delete mode 100755 config/i3/screentime diff --git a/config/i3/ashuffle b/config/i3/ashuffle deleted file mode 100755 index 77168ef..0000000 --- a/config/i3/ashuffle +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -while true -do - ashuffle - sleep 1 -done diff --git a/config/i3/aw_start b/config/i3/aw_start deleted file mode 100755 index 2cfb9ca..0000000 --- a/config/i3/aw_start +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# TODO Make a good service out of this - -cd /opt/activitywatch # Put your ActivityWatch install folder here - -killall aw-server -killall aw-watcher-afk -killall aw-watcher-window - -./aw-server/aw-server & -./aw-watcher-afk/aw-watcher-afk & -./aw-watcher-window/aw-watcher-window & # you can add --exclude-title here to exclude window title tracking for this session only - -notify-send "ActivityWatch started" # Optional, sends a notification when ActivityWatch is started - diff --git a/config/i3/config.j2 b/config/i3/config.j2 index 95f4963..f122460 100644 --- a/config/i3/config.j2 +++ b/config/i3/config.j2 @@ -374,12 +374,10 @@ exec --no-startup-id unclutter -root # Hide mouse cursor after some time #exec --no-startup-id dunst # Notifications (handled by systemd) exec --no-startup-id keynav # Keyboard cursor controller #exec --no-startup-id mpd # Music Player Daemon (handled by systemd) -# exec --no-startup-id ~/.config/i3/ashuffle # MPD Auto-refill exec --no-startup-id autorandr --change --force # Screen configuration and everything that depends on it {% if has_battery %} exec --no-startup-id ~/.config/i3/batteryNotify -d # Battery state notification {% endif %} -# exec --no-startup-id ~/.config/i3/aw_start # Activity tracker {{ base16_schemes['schemes'][base16_scheme]['i3']['colors']['base16-' + base16_scheme + '.config'] }} diff --git a/config/i3/dmenu_cmd b/config/i3/dmenu_cmd deleted file mode 100755 index 2806540..0000000 --- a/config/i3/dmenu_cmd +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -dmenu -fn 'DejaVu Sans Mono-10' -nb '#48483e' -nf '#f1ebeb' -sb '#8fc029' -sf '#272822' -i -l 8 -f "$@" diff --git a/config/i3/dmenu_run b/config/i3/dmenu_run deleted file mode 100755 index 9892aab..0000000 --- a/config/i3/dmenu_run +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} -if [ -d "$cachedir" ]; then - cache=$cachedir/dmenu_run -else - cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~ -fi -( - IFS=: - if stest -dqr -n "$cache" $PATH; then - stest -flx $PATH | sort -u | tee "$cache" | $HOME/.config/i3/dmenu_cmd -p 'Run' "$@" - else - $HOME/.config/i3/dmenu_cmd -p 'Run' "$@" < "$cache" - fi -) | ${SHELL:-"/bin/sh"} & diff --git a/config/i3/multimediaKey b/config/i3/multimediaKey deleted file mode 100755 index 3a4a808..0000000 --- a/config/i3/multimediaKey +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# Send a key event to the current multimedia application or to MPD - -# Currently since I did not found a way to test if a keystroke -# is grabbed by a windows or not, we test if MPD is playing - -echo 8 "$1" "$2" "$(xdotool getactivewindow)" >> /tmp/dbg - -if [ $# != 2 ]; then - echo "Usage: $0 KEY MPC_COMMAND" - exit 1 -fi - -if [ $(mpc status | wc -l) -ne 1 ]; then - # If mpd is running - mpc $2 -else - # If mpd is not running - # echo "$1" "$2" "$(xdotool getactivewindow)" >> /tmp/dbg - xdotool key --window $(xdotool getactivewindow) $1 - echo xdotool key --window $(xdotool getactivewindow) $1 >> /tmp/dbg -fi -exit 0 - - diff --git a/config/i3/pitch.png b/config/i3/pitch.png deleted file mode 100644 index aac403dbb1251e8b8d3552445ad6bf0ee1f5607c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 67 zcmeAS@N?(olHy`uVBq!ia0vp^j3CSbBp9sfW`_bPE>9Q75DwYo1R$G None: - now = datetime.datetime.now() - line["date"] = now.timestamp() - - print("WROTE", line) - with open(self.csv_path, "a") as typedfd: - writer = csv.DictWriter(typedfd, fieldnames=self.FIELDS) - writer.writerow(line) - - def on_window_event( - self, _: i3ipc.connection.Connection, e: i3ipc.events.WindowEvent - ) -> None: - focused = self.i3.get_tree().find_focused() - self.write( - { - "type": "window_" + e.change, - "class": focused.window_class, - "role": focused.window_role, - "title": focused.window_title, - "instance": focused.window_instance, - } - ) - - def on_mode_event( - self, _: i3ipc.connection.Connection, e: i3ipc.events.ModeEvent - ) -> None: - self.write({"type": "mode", "title": e.change}) - - def __init__(self) -> None: - self.i3 = i3ipc.Connection() - self.i3.on(i3ipc.Event.WINDOW, self.on_window_event) - self.i3.on(i3ipc.Event.MODE, self.on_mode_event) - - self.csv_path = os.path.join( - os.path.expanduser(os.getenv("XDG_CACHE_PATH", "~/.cache/")), - "screentime.csv", - ) - if not os.path.isfile(self.csv_path): - with open(self.csv_path, "w") as typedfd: - writer = csv.DictWriter(typedfd, fieldnames=self.FIELDS) - writer.writeheader() - self.write({"type": "start"}) - - def main(self) -> None: - self.i3.main() - - -if __name__ == "__main__": - ST = ScreenTime() - ST.main()