diff --git a/ansible/.gitignore b/ansible/.gitignore index e1b065a..d3f7d7e 100644 --- a/ansible/.gitignore +++ b/ansible/.gitignore @@ -1,2 +1,3 @@ arch_packages.json pip_packages.json +vm_files diff --git a/ansible/arch_packages.yaml b/ansible/arch_packages.yaml index 41c4ba3..bcfcd1d 100644 --- a/ansible/arch_packages.yaml +++ b/ansible/arch_packages.yaml @@ -198,7 +198,7 @@ categories: - gopls - rust-analyzer - typst-lsp - - vscode-css-language + - vscode-css-languageserver - pyright - typescript-language-server - svelte-language-server @@ -299,6 +299,7 @@ categories: audio: - tenacity - songrec + - aur/clementine video: - cheese - celluloid diff --git a/ansible/run_ansible_playbook.sh b/ansible/run_ansible_playbook.sh index 75adca4..eab9767 100755 --- a/ansible/run_ansible_playbook.sh +++ b/ansible/run_ansible_playbook.sh @@ -22,9 +22,8 @@ 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" \ - --start-at-task "Install pip packages" + $@ diff --git a/ansible/templates/ssh_config b/ansible/templates/ssh_config index 1597da4..3a16ec7 100644 --- a/ansible/templates/ssh_config +++ b/ansible/templates/ssh_config @@ -1,4 +1,6 @@ +IdentityFile "~/.ssh/{{ device_name }}_perso_generic_ed25519" + Host forge.lefuturiste.fr user git IdentitiesOnly yes - IdentityFile ~/.ssh/{{ device_name }}_perso_generic_ed25519 + IdentityFile "~/.ssh/{{ device_name }}_perso_generic_ed25519" diff --git a/ansible/templates/systemd/user/mount_sshfs.service b/ansible/templates/systemd/user/mount_sshfs.service new file mode 100644 index 0000000..74a8c46 --- /dev/null +++ b/ansible/templates/systemd/user/mount_sshfs.service @@ -0,0 +1,14 @@ +[Unit] +Description=SSHFS Daemon to mount a remote directory +StartLimitInterval=200 +StartLimitBurst=8 + +[Service] +Type=simple +ExecStart=/usr/bin/sshfs -f {{ service_params.ssh_uri }} {{ service_params.mount_path }} -o reconnect,ServerAliveInterval=30,ServerAliveCountMax=5 +Restart=always +StandardOutput=journal +RestartSec=20 + +[Install] +WantedBy=default.target diff --git a/ansible/templates/systemd/user/sshfs_srv06_warmd.service b/ansible/templates/systemd/user/sshfs_srv06_warmd.service deleted file mode 100644 index 8d8a7c3..0000000 --- a/ansible/templates/systemd/user/sshfs_srv06_warmd.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=SSHFS Daemon to mount srv06 warmd as a volume -StartLimitInterval=200 -StartLimitBurst=8 - -[Service] -Type=simple -ExecStart=/usr/bin/sshfs -f {{ user }}@srv06.rem:/warmd/mbess {{ home }}/.mnt/srv06/warmd/mbess -o reconnect,ServerAliveInterval=30,ServerAliveCountMax=5 -Restart=always -StandardOutput=journal -RestartSec=20 - -[Install] -WantedBy=default.target - diff --git a/ansible/templates/systemd/user/swaybg.service b/ansible/templates/systemd/user/swaybg.service new file mode 100644 index 0000000..cadbfa0 --- /dev/null +++ b/ansible/templates/systemd/user/swaybg.service @@ -0,0 +1,11 @@ +[Unit] +Description=SwayBg +PartOf=graphical-session.target + +[Service] +Type=simple +ExecStart=swaybg -i {{ home }}/.dots/wallpapers/jupiter.jpg -m fill + +[Install] +WantedBy=sway-session.target + diff --git a/ansible/workstation.yaml b/ansible/workstation.yaml index efea916..88d2ada 100644 --- a/ansible/workstation.yaml +++ b/ansible/workstation.yaml @@ -5,8 +5,18 @@ systemd_services: system: [] user: - - name: "sshfs_srv06_warmd" + - from: "mount_sshfs" + name: "mount_sshfs_srv06_warmd_mbess" enabled: true + params: + ssh_uri: "mbess@srv06.mbess.net:/warmd/mbess" + mount_path: "{{ home }}/.mnt/srv06/warmd/mbess" + - from: "mount_sshfs" + name: "mount_sshfs_srv06_warmd_etb" + enabled: true + params: + ssh_uri: "mbess@srv06.mbess.net:/warmd/etoiledebethleem" + mount_path: "{{ home }}/.mnt/srv06/warmd/etb" - name: "popequer_gitwatch@" - name: "hourly_remainder" enabled: true @@ -15,6 +25,8 @@ enabled: true - name: "gammastep" enabled: true + - name: "swaybg" + enabled: true config_files: - dir: fish name: config.fish @@ -194,7 +206,7 @@ vars: packages: "{{ (lookup('file', 'arch_packages.json') | from_json)['aur'] }}" - # SYSTEMD + # SYSTEMD user services - name: Setup systemd user services folder file: path: "{{ home }}/.config/systemd/user" @@ -202,14 +214,26 @@ recurse: true - name: Setup user units + loop: "{{ systemd_services.user }}" + when: "item.from is not defined" template: src: "systemd/user/{{ item.name }}.service" dest: "{{ home }}/.config/systemd/user/{{ item.name }}.service" + vars: + service_params: "{{ item.params }}" + + - name: Setup user unit with from loop: "{{ systemd_services.user }}" + when: "item.from is defined" + template: + src: "systemd/user/{{ item.from }}.service" + dest: "{{ home }}/.config/systemd/user/{{ item.name }}.service" + vars: + service_params: "{{ item.params }}" - name: Setup user timers - when: "item.timer is defined and item.timer" loop: "{{ systemd_services.user }}" + when: "item.timer is defined and item.timer" template: src: "systemd/user/{{ item.name }}.timer" dest: "{{ home }}/.config/systemd/user/{{ item.name }}.timer" @@ -234,21 +258,15 @@ enabled: true # OTHERS - - name: Setup mount point folder + - name: Setup mount point folders file: - path: "{{ home }}/.mnt" - state: directory - recurse: true - - name: Setup mount point folder for srv06 - file: - path: "{{ home }}/.mnt/srv06/warmd/mbess" - state: directory - recurse: true - - name: Setup mount point folder - file: - path: "{{ home }}/.mnt/etb" + path: "{{ home }}/.mnt/{{ item }}" state: directory recurse: true + loop: + - srv06/warmd/mbess + - srv06/coldd/mbess + - srv06/warmd/etb - name: Setup triage folder file: path: "{{ home }}/triage" @@ -297,14 +315,16 @@ repo: "git@forge.lefuturiste.fr:mbess/books-sources.git" dest: /home/mbess/workspace/books_sources - - name: Clone monakhos - ansible.builtin.git: - repo: "git@forge.lefuturiste.fr:mbess/monakhos.git" - dest: /home/mbess/workspace/monakhos - - name: Setup wofi link become: true file: src: "/usr/bin/wofi" dest: "/usr/bin/rofi" state: link + + # Final workspaces + - name: Clone monakhos + ansible.builtin.git: + repo: "git@forge.lefuturiste.fr:mbess/monakhos.git" + dest: /home/mbess/workspace/monakhos + diff --git a/target/.gitignore b/target/.gitignore index bf27f31..d84554a 100644 --- a/target/.gitignore +++ b/target/.gitignore @@ -1,3 +1,5 @@ * !.gitignore !.gitkeep +!example_host/ +!example_host/* diff --git a/target/example_host/inventory.yaml b/target/example_host/inventory.yaml new file mode 100644 index 0000000..a9fcf1a --- /dev/null +++ b/target/example_host/inventory.yaml @@ -0,0 +1,3 @@ +workstation: + hosts: + localhost: {} diff --git a/target/example_host/master_sshkey b/target/example_host/master_sshkey new file mode 100644 index 0000000..3fc96fb --- /dev/null +++ b/target/example_host/master_sshkey @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACCzLJSUEp7ZgIhKgBe3KS9VxD1kVoL+1rteNDUTwrF+DwAAAJBi/5tQYv+b +UAAAAAtzc2gtZWQyNTUxOQAAACCzLJSUEp7ZgIhKgBe3KS9VxD1kVoL+1rteNDUTwrF+Dw +AAAED4FA6R3uUYxh3xbBzpejFO71FKa/COcMq6tdiwdyDn/rMslJQSntmAiEqAF7cpL1XE +PWRWgv7Wu140NRPCsX4PAAAADW1hc3Rlcl9zc2hrZXk= +-----END OPENSSH PRIVATE KEY----- diff --git a/target/example_host/master_sshkey.pub b/target/example_host/master_sshkey.pub new file mode 100644 index 0000000..dc705c2 --- /dev/null +++ b/target/example_host/master_sshkey.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILMslJQSntmAiEqAF7cpL1XEPWRWgv7Wu140NRPCsX4P master_sshkey diff --git a/target/example_host/run.sh b/target/example_host/run.sh new file mode 100755 index 0000000..a55745a --- /dev/null +++ b/target/example_host/run.sh @@ -0,0 +1,2 @@ +#!/usr/bin/sh +../../ansible/run_ansible_playbook.sh -u mbess diff --git a/target/example_host/vars.yaml b/target/example_host/vars.yaml new file mode 100644 index 0000000..2919df8 --- /dev/null +++ b/target/example_host/vars.yaml @@ -0,0 +1,4 @@ +device_name: example_host +user: mbess +target_is_real: true +