refactor: split into roles
Some checks are pending
/ sast (push) Waiting to run

This commit is contained in:
Marc 2024-09-28 23:31:23 -04:00
parent 78ea75997a
commit 178c51628b
Signed by: marc
GPG key ID: 048E042F22B5DC79
11 changed files with 72 additions and 75 deletions

View file

@ -1,13 +1,5 @@
# 🥫Environment-in-a-can
Environment tweaks for everyday happiness.
Environment tweaks for (my) everyday happiness.
## Setup
Just run `./setup.sh`!
_Note_: This expects `pipx` to be installed on your system.
## Contributing
I'm not currently looking for contributions since this is mainly about standardizing my own setup across machines.
Do the thing, it will do the needful: `./run.sh <playbook-path>`

7
home.yml Normal file
View file

@ -0,0 +1,7 @@
---
- name: Local environment
hosts: localhost
roles:
- ubuntu
- managed-blocks
- tool-config

View file

@ -1,64 +0,0 @@
---
- name: Local environment
hosts: localhost
tasks:
- name: Ensure system up-to-date
become: true
apt:
update_cache: true
upgrade: "yes"
- name: Install terminal & shell
apt:
pkg:
- zsh
- tmux
- 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: Install CLI tooling
apt:
pkg:
- shellcheck
- gh
- name: Install gh CLI extensions (gh-dash)
command: gh extension install dlvhdr/gh-dash
- name: Install DB-related tooling
apt:
pkg:
- postgresql
- postgresql-contrib
- 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: Add nvim managed block
blockinfile:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nvim/init.vim"
marker: "\" Marc's env managed block - {mark}"
block: "{{ lookup('ansible.builtin.file', 'files/extras.vim') }}"
- 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: 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') }}"
- name: Configure git
shell: |
git config --global commit.gpgsign true
git config --global fetch.prune true

View file

@ -0,0 +1,29 @@
---
- 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: Add nvim managed block
blockinfile:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nvim/init.vim"
marker: "\" Marc's env managed block - {mark}"
block: "{{ lookup('ansible.builtin.file', 'files/extras.vim') }}"
- 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: 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') }}"

View file

@ -0,0 +1,5 @@
---
- name: Configure git
shell: |
git config --global commit.gpgsign true
git config --global fetch.prune true

View file

@ -0,0 +1,28 @@
---
- name: Ensure system up-to-date
become: true
apt:
update_cache: true
upgrade: "yes"
- name: Install terminal & shell
apt:
pkg:
- zsh
- tmux
- 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: Install CLI tooling
apt:
pkg:
- shellcheck
- gh
- name: Install gh CLI extensions (gh-dash)
command: gh extension install dlvhdr/gh-dash
- name: Install DB-related tooling
apt:
pkg:
- postgresql
- postgresql-contrib

View file

@ -6,4 +6,4 @@ if [[ -z "$(command -v pipx)" ]]; then
fi
pipx install "ansible~=10.0"
ansible-playbook -v --ask-become-pass ./playbook.yml
ansible-playbook -v --ask-become-pass "$1"