From d9cfb729ec81563666e6dcebf9e0e13e1a6f9fab Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Mon, 10 Jun 2024 23:30:00 +0200 Subject: [PATCH] feat: add pipx packages via file and add docker group --- TODO.md | 3 +++ ansible/.gitignore | 1 + ansible/arch_packages.yaml | 5 ++++- ansible/parse_arch_packages.py | 6 ++++-- ansible/pip_packages.yaml | 8 ++++++++ ansible/pipx_packages.yaml | 1 - ansible/run_ansible_playbook.sh | 10 +++++++--- ansible/workstation.yaml | 15 ++++++++------- 8 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 ansible/pip_packages.yaml delete mode 100644 ansible/pipx_packages.yaml diff --git a/TODO.md b/TODO.md index eee216c..09a72dc 100644 --- a/TODO.md +++ b/TODO.md @@ -7,3 +7,6 @@ - add cargo global packages, like `pads` +- packages + - add kanshi, dynamic wayland output manager + - add smbutils diff --git a/ansible/.gitignore b/ansible/.gitignore index 7f8e1ea..e1b065a 100644 --- a/ansible/.gitignore +++ b/ansible/.gitignore @@ -1 +1,2 @@ arch_packages.json +pip_packages.json diff --git a/ansible/arch_packages.yaml b/ansible/arch_packages.yaml index e7b81fb..f5c42f0 100644 --- a/ansible/arch_packages.yaml +++ b/ansible/arch_packages.yaml @@ -153,7 +153,7 @@ categories: - scrcpy - kdeconnect geo: [] - # - aur/osmium-tool + #- aur/osmium-tool random_gen: - python-faker - aur/uuid @@ -166,6 +166,7 @@ categories: - zbar - zint - qrencode + - newsboat security: - gopass @@ -209,6 +210,8 @@ categories: - ruff lua: - lua + web: + - caddy static: - hugo diff --git a/ansible/parse_arch_packages.py b/ansible/parse_arch_packages.py index 7d5d86b..310e876 100644 --- a/ansible/parse_arch_packages.py +++ b/ansible/parse_arch_packages.py @@ -1,9 +1,11 @@ import json +import sys import yaml +import fileinput packages_tree = None -with open("arch_packages.yaml", 'r') as config_f: - packages_tree = yaml.safe_load(config_f) +yaml_config = ''.join(sys.stdin.readlines()) +packages_tree = yaml.safe_load(yaml_config) assert packages_tree is not None, "Must have load valid package tree" diff --git a/ansible/pip_packages.yaml b/ansible/pip_packages.yaml new file mode 100644 index 0000000..c6f270e --- /dev/null +++ b/ansible/pip_packages.yaml @@ -0,0 +1,8 @@ +base: + - desc: JSON adapter + name: jc + - copyparty + - lesspass + - xkcd-pass + - azlyrics2 + - yewtube diff --git a/ansible/pipx_packages.yaml b/ansible/pipx_packages.yaml deleted file mode 100644 index 277cc02..0000000 --- a/ansible/pipx_packages.yaml +++ /dev/null @@ -1 +0,0 @@ -- diff --git a/ansible/run_ansible_playbook.sh b/ansible/run_ansible_playbook.sh index a53e90a..75adca4 100755 --- a/ansible/run_ansible_playbook.sh +++ b/ansible/run_ansible_playbook.sh @@ -9,7 +9,11 @@ export ANSIBLE_CONFIG=$base/ansible.cfg export ANSIBLE_LOG_PATH=ansible_run.log cd $base -python3 parse_arch_packages.py > arch_packages.json +cat arch_packages.yaml | python3 parse_arch_packages.py > arch_packages.json +cd $workdir + +cd $base +cat pip_packages.yaml | python3 parse_arch_packages.py > pip_packages.json cd $workdir rm $base/vm_files @@ -17,10 +21,10 @@ ln -s $workdir $base/vm_files ansible-playbook $base/workstation.yaml \ -v \ + --ask-become-pass \ -u "mbess" \ -i "inventory.yaml" \ --ssh-extra-args "-o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22 -i ./master_sshkey" \ --extra-vars "@$workdir/vars.yaml" \ - --extra-vars "ansible_sudo_pass=pidell43" - #--start-at-task "Create the aur_builder user" + --start-at-task "Install pip packages" diff --git a/ansible/workstation.yaml b/ansible/workstation.yaml index 1fdcda1..efea916 100644 --- a/ansible/workstation.yaml +++ b/ansible/workstation.yaml @@ -148,6 +148,12 @@ name: "{{ user }}" shell: /usr/bin/fish + - name: Add user to useful group (docker) + become: true + user: + name: "{{ user }}" + groups: ["docker"] + - name: Create machine.fish template: src: fish/machine.fish @@ -273,15 +279,10 @@ include_role: name: popequer_notebook - - name: Install others packages + - name: Install pip packages community.general.pipx: name: "{{ item }}" - loop: - - azlyrics2 - - lesspass - - jc - - xkcd-pass - - yewtube + loop: "{{ (lookup('file', 'pip_packages.json') | from_json)['native'] }}" - name: Enable bluetooth service become: true