From 9942fd94f815aa45a00a16c04645e1cbd4cdcdb7 Mon Sep 17 00:00:00 2001 From: Alex Tavarez Date: Wed, 10 Jun 2026 14:06:12 -0400 Subject: [PATCH] created new package tasks for handler-based inclusions, otehrwise got username and home directory of SSH login for path purposes --- .../tasks/contingent/pkg/difftastic.yml | 26 ++++ .../init-server/tasks/contingent/pkg/git.yml | 118 ++++++++++++++++++ .../tasks/contingent/pkg/julia.yml | 32 +++++ .../tasks/contingent/pkg/neovim.yml | 36 ++++++ .../init-server/tasks/contingent/pkg/nvm.yml | 95 ++++++++++++++ .../tasks/contingent/pkg/quartz.yml | 18 +-- .../tasks/contingent/pkg/radicle.yml | 51 ++++++++ .../tasks/contingent/pkg/rustup.yml | 28 +++++ .../tasks/contingent/pkg/surge.yml | 26 ++++ roles/init-server/tasks/contingent/pkg/uv.yml | 29 +++++ .../init-server/tasks/contingent/pkg/vim.yml | 71 +++++++++++ 11 files changed, 521 insertions(+), 9 deletions(-) create mode 100644 roles/init-server/tasks/contingent/pkg/difftastic.yml create mode 100644 roles/init-server/tasks/contingent/pkg/git.yml create mode 100644 roles/init-server/tasks/contingent/pkg/julia.yml create mode 100644 roles/init-server/tasks/contingent/pkg/neovim.yml create mode 100644 roles/init-server/tasks/contingent/pkg/nvm.yml create mode 100644 roles/init-server/tasks/contingent/pkg/radicle.yml create mode 100644 roles/init-server/tasks/contingent/pkg/rustup.yml create mode 100644 roles/init-server/tasks/contingent/pkg/surge.yml create mode 100644 roles/init-server/tasks/contingent/pkg/uv.yml create mode 100644 roles/init-server/tasks/contingent/pkg/vim.yml diff --git a/roles/init-server/tasks/contingent/pkg/difftastic.yml b/roles/init-server/tasks/contingent/pkg/difftastic.yml new file mode 100644 index 0000000..84bc620 --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/difftastic.yml @@ -0,0 +1,26 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Linking binaries to directories already in PATH environment variable + ansible.builtin.file: + src: "{{ ansible_user_home.stdout }}/downloads/archives/released/difftastic/{{ item }}" + dest: "{{ ansible_user_home.stdout }}/.local/bin/{{ item }}" + state: hard + loop: + - difft +- name: Linking binaries to directories already in PATH environment variable + become: true + ansible.builtin.file: + src: "{{ ansible_user_home.stdout }}/downloads/archives/released/difftastic/{{ item }}" + dest: "/usr/local/bin/{{ item }}" + state: link + loop: + - difft +- name: Configuring usage of Difftastic as default git difference tool for user + community.general.git_config: + name: diff.tool + scope: global + value: difftastic \ No newline at end of file diff --git a/roles/init-server/tasks/contingent/pkg/git.yml b/roles/init-server/tasks/contingent/pkg/git.yml new file mode 100644 index 0000000..3a0b87f --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/git.yml @@ -0,0 +1,118 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Acquiring current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo {{ ansible_user }}" +- name: Configuring system-level git settings + become: true + block: + - name: Making commit feedback more verbose + community.general.git_config: + name: commit.verbose + scope: system + value: "true" + state: present + - name: Setting default merge conflict approach algorithm + community.general.git_config: + name: merge.conflictstyle + scope: system + value: zdiff3 + state: present + - name: Setting default merging tool for conflicts + community.general.git_config: + name: merge.tool + scope: system + value: nvimdiff + state: present + - name: Ensuring backups prior to merge solution implementation + community.general.git_config: + name: merge.keebbackup + scope: system + value: "true" + state: present + - name: Configuring rebase to autosquash + community.general.git_config: + name: rebase.autosquash + scope: system + value: "true" + state: present + - name: Enforcng error message for missing entries in local commit history + community.general.git_config: + name: rebase.missingCommitsCheck + scope: system + value: error + state: present + - name: Setting the default branch's default name on repository initialization + community.general.git_config: + name: init.defaultBranch + scope: system + value: main + state: present + - name: Setting default pager for, or called by, git + community.general.git_config: + name: core.pager + scope: system + value: delta + state: present + - name: Ensuring git push/pull space handling compatibility with non-Linux operating systems + community.general.git_config: + name: core.autocrlf + scope: system + value: "false" + state: present + - name: Setting default text editor for, or called by, git + community.general.git_config: + name: core.editor + scope: system + value: nvim + state: present + - name: Setting difference filtering tool to delta + community.general.git_config: + name: interactive.diffFilter + scope: system + value: delta + state: present + - name: Setting default difference- finding or presenting approach algorithm + community.general.git_config: + name: diff.algorithm + scope: system + value: histogram + state: present + - name: Setting difference tool for, or called by, git + community.general.git_config: + name: diff.tool + scope: system + value: nvimdiffs + state: present + - name: Setting the default amount of context for git to show around a difference + community.general.git_config: + name: diff.context + scope: system + value: "10" + state: present + - name: Ensuring data integrity and validity is checked prior to fetch or transfer actions + community.general.git_config: + name: "{{ item }}.fsckobjects" + scope: system + value: "true" + state: present + loop: + - transfer + - fetch + - name: Ensuring data integrity and validity is checked prior to reception of data + community.general.git_config: + name: receive.fsckObjects + scope: system + value: "true" + state: present + - name: Setting git TUI to have color + community.general.git_config: + name: color.ui + scope: system + value: "true" + state: present diff --git a/roles/init-server/tasks/contingent/pkg/julia.yml b/roles/init-server/tasks/contingent/pkg/julia.yml new file mode 100644 index 0000000..bebb4aa --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/julia.yml @@ -0,0 +1,32 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Acquiring current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo {{ ansible_user }}" + register: current_user +- name: Executing shell-scripted installation process for Julia + become: true + become_user: "{{ current_user.stdout }}" + ansible.builtin.shell: + cmd: "{{ ansible_user_home.stdout }}/.local/bin/julia-install.sh --yes" + creates: "{{ ansible_user_home.stdout }}/.juliaup/bin" +- name: Linking binaries to directories already in PATH environment variable + become: true + ansible.builtin.file: + src: "{{ ansible_user_home.stdout }}/.juliaup/bin/{{ item }}" + dest: "/usr/local/bin/{{ item }}" + owner: root + group: root + state: link + loop: + - julia + - julialauncher + - juliaup +- name: Reboot machine for shell environment change + ansible.builtin.reboot: + msg: Rebooting machine \ No newline at end of file diff --git a/roles/init-server/tasks/contingent/pkg/neovim.yml b/roles/init-server/tasks/contingent/pkg/neovim.yml new file mode 100644 index 0000000..773ad4f --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/neovim.yml @@ -0,0 +1,36 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Acquiring current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo {{ ansible_user }}" +- name: Copy system ViM configuration to home directory + become: true + ansible.builtin.copy: + remote_src: /root/.vimrc + dest: "{{ ansible_user_home.stdout }}/.vimrc" + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + mode: "644" + state: present +- name: Creating directory tree for NeoViM configuration files + ansible.builtin.file: + path: "{{ ansible_user_home.stdout }}/.config/nvim" + recurse: true + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + state: directory +- name: Configuring NeoViM + become: true + become_user: "{{ current_user.stdout }}" + ansible.builtin.copy: + src: user/config/nvim/init.vim + dest: "{{ ansible_user_home.stdout }}/.config/nvim/init.vim" + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + mode: "644" + state: present diff --git a/roles/init-server/tasks/contingent/pkg/nvm.yml b/roles/init-server/tasks/contingent/pkg/nvm.yml new file mode 100644 index 0000000..ad8d869 --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/nvm.yml @@ -0,0 +1,95 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Find all NVM pre-built binary (sub)directories + ansible.builtin.find: + paths: "{{ ansible_user_home.stdout }}/downloads/archives/released/nvm" + patterns: "^node-v[0-9]*\\." + file_type: directory + use_regex: true + register: prebuilt_nodes +- name: Bootstrapping NVM + become: true + block: + - name: Grabbing only path information for pre-built binary (sub)directories + ansible.builtin.set_fact: + prebuilt_nodepaths: "{{ prebuilt_nodes.files | map(attribute='path') }}" + - name: Linking binaries to directories already in PATH environment variable + ansible.builtin.file: + src: "{{ item[0] }}/bin/{{ item[1] }}" + dest: "/usr/local/bin/{{ item[1] }}" + owner: root + group: root + state: link + loop: "{{ prebuilt_nodepaths | product(['node']) }}" + - name: Linking binaries to directories already in PATH environment variable + ansible.builtin.file: + src: "{{ item[0] }}/lib/node_modules/corepack/dist/{{ item[1] }}.js" + dest: "/usr/local/bin/{{ item[1] }}" + owner: root + group: root + state: link + loop: "{{ prebuilt_nodepaths | product(['corepack']) }}" + - name: Linking binaries to directories already in PATH environment variable + ansible.builtin.file: + src: "{{ item[0] }}/lib/node_modules/npm/bin/{{ item[1] }}-cli.js" + dest: "/usr/local/bin/{{ item[1] }}" + owner: root + group: root + state: link + loop: "{{ prebuilt_nodepaths | product(['npm','npx']) }}" + - name: Link includes to directories already recognized by system + ansible.builtin.file: + src: "{{ item[0] }}/include/{{ item[1] }}" + dest: "/usr/local/include/{{ item[1] }}" + owner: root + group: root + state: link + loop: "{{ prebuilt_nodepaths | product(['node']) }}" + - name: Link requisite libraries to directories already recognized by system + ansible.builtin.file: + src: "{{ item[0] }}/lib/{{ item[1] }}" + dest: "/usr/local/lib/{{ item[1] }}" + owner: root + group: root + state: link + loop: "{{ prebuilt_nodepaths | product(['node_modules']) }}" + - name: Create man1 subdirectory for man pages + ansible.builtin.file: + path: /usr/local/share/man/man1 + recurse: true + owner: root + group: root + mode: "644" + state: directory + - name: Link shared resources to directories already recognized by system + ansible.builtin.file: + src: "{{ item[0] }}/share/man/man1/{{ item[1] }}.1" + dest: "/usr/local/share/man/man1/{{ item[1] }}.1" + owner: root + group: root + state: link + loop: "{{ prebuilt_nodepaths | product(['node']) }}" + - name: Create man1 subdirectory for man pages + ansible.builtin.file: + path: /usr/local/share/doc + recurse: true + owner: root + group: root + mode: "644" + state: directory + - name: Link shared resources to directories already recognized by system + ansible.builtin.file: + src: "{{ item[0] }}/share/doc/{{ item[1] }}" + dest: "/usr/local/share/doc/{{ item[1] }}" + owner: root + group: root + state: link + loop: "{{ prebuilt_nodepaths | product(['node']) }}" +- name: Reboot machine for shell environment change + ansible.builtin.reboot: + msg: Rebooting machine + diff --git a/roles/init-server/tasks/contingent/pkg/quartz.yml b/roles/init-server/tasks/contingent/pkg/quartz.yml index 60caf84..1fe7803 100644 --- a/roles/init-server/tasks/contingent/pkg/quartz.yml +++ b/roles/init-server/tasks/contingent/pkg/quartz.yml @@ -1,26 +1,26 @@ --- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home - name: Installing NodeJS dependencies of quartz software community.general.npm: - executable: "{{ ansible_facts['user_dir'] }}/.nvm/versions/node/v24.11.1/lib/node_modules/npm" - path: "{{ ansible_facts['user_dir'] }}/repos/.foreign/quartz" + path: "{{ ansible_user_home.stdout }}/repos/.foreign/quartz" state: latest - name: Configuring quartz software block: - name: Initializing quartz website ansible.builtin.command: - chdir: "{{ ansible_facts['user_dir'] }}/repos/.foreign/quartz" + chdir: "{{ ansible_user_home.stdout }}/repos/.foreign/quartz" cmd: npx quartz create - register: stdout - changed_when: stdout.rc == 0 - name: Installing quartz plugins referenced in website template ansible.builtin.command: - chdir: "{{ ansible_facts['user_dir'] }}/repos/.foreign/quartz" + chdir: "{{ ansible_user_home.stdout }}/repos/.foreign/quartz" cmd: npx quartz plugin install --from-config - register: stdout - changed_when: stdout.rc == 0 # - name: Starting quartz site web server # ansible.builtin.command: -# chdir: "{{ ansible_facts['user_dir'] }}/repos/.foreign/quartz" +# chdir: "{{ ansible_user_home.stdout }}/repos/.foreign/quartz" # cmd: npx quartz build --serve # register: stdout # changed_when: stdout \ No newline at end of file diff --git a/roles/init-server/tasks/contingent/pkg/radicle.yml b/roles/init-server/tasks/contingent/pkg/radicle.yml new file mode 100644 index 0000000..cb6bf9b --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/radicle.yml @@ -0,0 +1,51 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Acquiring current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo {{ ansible_user }}" + register: current_user +- name: Executing shell-scripted installation process for Radicle + become: true + become_user: "{{ current_user.stdout }}" + ansible.builtin.shell: + cmd: "{{ ansible_user_home.stdout }}/.local/bin/radicle-install.sh" + creates: "{{ ansible_user_home.stdout }}/.radicle" +- name: Bootstrapping Radicle + become: true + block: + - name: Linking binaries to directories already in PATH environment variable + ansible.builtin.file: + src: "{{ ansible_user_home.stdout }}/.radicle/bin/{{ item }}" + dest: "/usr/local/bin/{{ item }}" + state: link + loop: + - rad + - radicle-node + - git-remote-rad + - name: Create man1 subdirectory for man pages + ansible.builtin.file: + path: /usr/local/share/man/man1 + recurse: true + owner: root + group: root + mode: "644" + state: directory + - name: Link manpages to Linux manpage directories + ansible.builtin.file: + src: "{{ ansible_user_home.stdout }}/.radicle/man/man1/{{ item }}.1" + dest: "/usr/local/share/man/man1/{{ item }}.1" + state: link + loop: + - rad + - radicle-node + - git-remote-rad + - rad-id + - rad-patch +- name: Reboot machine for shell environment change + ansible.builtin.reboot: + msg: Rebooting machine \ No newline at end of file diff --git a/roles/init-server/tasks/contingent/pkg/rustup.yml b/roles/init-server/tasks/contingent/pkg/rustup.yml new file mode 100644 index 0000000..c78c1cc --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/rustup.yml @@ -0,0 +1,28 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Acquiring current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo {{ ansible_user }}" + register: current_user +- name: Executing shell-scripted installation process for Rust + become: true + become_user: "{{ current_user.stdout }}" + ansible.builtin.shell: + cmd: "{{ ansible_user_home.stdout }}/.local/bin/rustup-install.sh -yq" + creates: "{{ ansible_user_home.stdout }}/.cargo/bin" +- name: Linking binaries to directories already in PATH environment variable + become: true + ansible.builtin.file: + src: "{{ ansible_user_home.stdout }}/.cargo/bin/{{ item }}" + dest: "/usr/local/bin/{{ item }}" + state: link + loop: + - rustup +- name: Reboot machine for shell environment change + ansible.builtin.reboot: + msg: Rebooting machine \ No newline at end of file diff --git a/roles/init-server/tasks/contingent/pkg/surge.yml b/roles/init-server/tasks/contingent/pkg/surge.yml new file mode 100644 index 0000000..dcd2441 --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/surge.yml @@ -0,0 +1,26 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Linking binaries to directories already in PATH environment variable + become: true + ansible.builtin.file: + src: "{{ ansible_user_home.stdout }}/downloads/archives/released/surge/{{ item }}" + dest: "/usr/local/bin/{{ item }}" + state: link + loop: + - surge +- name: Installing accompanying complementary Surge system service + ansible.builtin.command: + cmd: surge service install +- name: Acquiring API token for remote Surge service control + ansible.builtin.command: + cmd: surge token + register: surge_token +- name: Presenting Surge API token to Control Node + ansible.builtin.debug: + msg: "Make sure to store the following API token for Surge:\n {{ surge_token.stdout }}" +- name: Pausing to ensure completion of manual act + ansible.builtin.pause: diff --git a/roles/init-server/tasks/contingent/pkg/uv.yml b/roles/init-server/tasks/contingent/pkg/uv.yml new file mode 100644 index 0000000..8c72c82 --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/uv.yml @@ -0,0 +1,29 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Acquiring current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo {{ ansible_user }}" + register: current_user +- name: Executing a shell-scripted installation process + become: true + become_user: "{{ current_user.stdout }}" + ansible.builtin.shell: + cmd: "{{ ansible_user_home.stdout }}/.local/bin/uv-install.sh" + creates: "{{ ansible_user_home.stdout }}/.local/bin/uv" +- name: Linking binaries to directories already in PATH environment variable + become: true + ansible.builtin.file: + src: "{{ ansible_user_home.stdout }}/.local/bin/{{ item }}" + dest: "/usr/local/bin/{{ item }}" + state: link + loop: + - uv + - uvx +- name: Reboot machine for shell environment change + ansible.builtin.reboot: + msg: Rebooting machine \ No newline at end of file diff --git a/roles/init-server/tasks/contingent/pkg/vim.yml b/roles/init-server/tasks/contingent/pkg/vim.yml new file mode 100644 index 0000000..05f20fa --- /dev/null +++ b/roles/init-server/tasks/contingent/pkg/vim.yml @@ -0,0 +1,71 @@ +--- +- name: Acquiring home of current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo ~{{ ansible_user }}" + register: ansible_user_home +- name: Acquiring current user + when: ansible_facts["system"] == "Linux" + ansible.builtin.shell: + cmd: "echo {{ ansible_user }}" + register: current_user +- name: Preparing to create a directory structure for ViM paths + become: true + become_user: "{{ current_user.stdout }}" + block: + - name: Creating directory structure for ViM paths + ansible.builtin.file: + path: "{{ ansible_user_home.stdout }}/.vim/{{ item }}" + recurse: true + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + state: directory + loop: + - autoload + - backup + - colors + - plugged +- name: Pulling and integrating ViM plugin manager + become: true + become_user: "{{ current_user.stdout }}" + ansible.builtin.uri: + url: "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" + dest: "{{ ansible_user_home.stdout }}/.vim/autoload/" + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + force: true + mode: "644" + follow_redirects: safe +- name: Configuring ViM + become: true + become_user: "{{ current_user.stdout }}" + ansible.builtin.template: + src: vimrc.j2 + dest: "{{ ansible_user_home.stdout }}/.vimrc" + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + force: true + backup: true + vars: + vim_spatialize: true + vim_tabgap: 2 + vim_blockedcursor: true + vim_historyspan: 500 + vim_origami: true + vim_eddelimiters: true + vim_gitspice: true + vim_statusline: true + vim_fancycomment: true + vim_idelangs: true + vim_pathcompletion: true + vimignore: + - "*.docx" + - "*.jpg" + - "*.png" + - "*.gif" + - "*.pdf" + - "*.pyc" + - "*.exe" + - "*.flv" + - "*.img" + - "*.xlsx"