From f0e509fbe2d438a9ef3ef9981767dedfb8e16b66 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sun, 13 Oct 2024 19:36:06 -0400 Subject: [PATCH] fix: address failing configure-from-scratch steps --- Dockerfile | 9 +++-- roles/dev-toolchain/tasks/main.yml | 2 ++ roles/editor-tweaks/tasks/main.yml | 8 +++++ roles/shell-tweaks/tasks/main.yml | 53 ++++++++++++++++++---------- roles/system-packages/tasks/main.yml | 9 +++++ 5 files changed, 60 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 126e076..211919c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,13 @@ FROM debian:bookworm COPY . . -RUN apt update && apt install pipx -y +RUN apt update && apt upgrade -y --autoremove + +RUN apt install -y\ + pipx \ + make \ + sudo ENV PATH="$PATH:/root/.local/bin" -CMD ./run.sh ./home.yml +CMD make configure-env PLAY=./home.yml diff --git a/roles/dev-toolchain/tasks/main.yml b/roles/dev-toolchain/tasks/main.yml index 9c8d2fd..484ba57 100644 --- a/roles/dev-toolchain/tasks/main.yml +++ b/roles/dev-toolchain/tasks/main.yml @@ -2,12 +2,14 @@ - name: Check if rustup is installed shell: which rustup register: which_rustup + ignore_errors: true - name: Install rustup shell: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y when: which_rustup.rc == 1 - name: Check if go is installed shell: go version register: check_go_version + ignore_errors: true - name: Install go become: true shell: | diff --git a/roles/editor-tweaks/tasks/main.yml b/roles/editor-tweaks/tasks/main.yml index 5d01071..429d0d6 100644 --- a/roles/editor-tweaks/tasks/main.yml +++ b/roles/editor-tweaks/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: Ensure general config dir exists + file: + path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nvim" + state: directory +- name: Ensure .zshrc exists + file: + path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nvim/init.vim" + state: touch - name: Add nvim managed block blockinfile: path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nvim/init.vim" diff --git a/roles/shell-tweaks/tasks/main.yml b/roles/shell-tweaks/tasks/main.yml index d551479..d42f511 100644 --- a/roles/shell-tweaks/tasks/main.yml +++ b/roles/shell-tweaks/tasks/main.yml @@ -1,35 +1,50 @@ --- +- name: Ensure general config dir exists + file: + path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config" + state: directory - name: Install OMZsh shell: | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" args: creates: "{{ lookup('ansible.builtin.env', 'HOME') }}/.oh-my-zsh" +- name: Ensure .zshrc exists + file: + path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc" + state: touch - name: Add zsh managed block blockinfile: path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc" marker: "# Marc's env managed block - {mark}" block: "{{ lookup('ansible.builtin.file', 'files/shell_extras') }}" +- name: Install Starship + shell: $HOME/.cargo/bin/cargo install starship +- name: Ensure Starship config exists + file: + path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/starship.toml" + state: touch - name: Add starship managed block blockinfile: path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/starship.toml" marker: "# Marc's env managed block - {mark}" block: "{{ lookup('ansible.builtin.file', 'files/starship.toml') }}" -- name: Check if gh-dash is installed - shell: gh extension list - register: gh_ext_list -- name: Install gh CLI extensions (gh-dash) - command: gh extension install dlvhdr/gh-dash - when: gh_ext_list.stdout.find('gh dash') == -1 -- name: Ensure gh-dash config directory exists - file: - path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash" - state: directory -- name: Ensure gh-dash config exists - file: - path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash/config.yml" - state: touch -- name: Add gh-dash configuration managed block - blockinfile: - path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash/config.yml" - marker: "# Marc's env managed block - {mark}" - block: "{{ lookup('ansible.builtin.file', 'files/gh-dash.yml') }}" + # TODO: Add gh cli login. + #- name: Check if gh-dash is installed + # shell: gh extension list + # register: gh_ext_list + #- name: Install gh CLI extensions (gh-dash) + # command: gh extension install dlvhdr/gh-dash + # when: gh_ext_list.stdout.find('gh dash') == -1 + #- name: Ensure gh-dash config directory exists + # file: + # path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash" + # state: directory + #- name: Ensure gh-dash config exists + # file: + # path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash/config.yml" + # state: touch + #- name: Add gh-dash configuration managed block + # blockinfile: + # path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash/config.yml" + # marker: "# Marc's env managed block - {mark}" + # block: "{{ lookup('ansible.builtin.file', 'files/gh-dash.yml') }}" diff --git a/roles/system-packages/tasks/main.yml b/roles/system-packages/tasks/main.yml index d7e1b29..af4f848 100644 --- a/roles/system-packages/tasks/main.yml +++ b/roles/system-packages/tasks/main.yml @@ -4,6 +4,13 @@ apt: update_cache: true upgrade: "yes" +- name: Install Build Essentials + become: true + apt: + pkg: + - make + - build-essential + - cmake - name: Install terminal & shell become: true apt: @@ -16,6 +23,8 @@ pkg: - shellcheck - gh + - curl + - git - name: Install DB-related tooling become: true apt: