Skip to content

Commit

Permalink
feat!: massive refactoring and enhancement
Browse files Browse the repository at this point in the history
Drop linux support as it complexifies code and is never used.
Replace deprecated antigen zsh package manager by antidote.
Replace Ppwerlevel10k prompt by starship.
Replace iTerm2 terminal app by alacritty.
Replace docker by podman.
Use zellij as terminal multiplexer.
And more...

Closes #51, #50, #23, #19, #18, #17, #15
  • Loading branch information
bsemp committed Jun 9, 2023
1 parent 4c01b4c commit eb3cdfa
Show file tree
Hide file tree
Showing 103 changed files with 2,453 additions and 2,497 deletions.
12 changes: 9 additions & 3 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
---
profile: production

exclude_paths:
- .github
- roles/**/files

warn_list:
- no-changed-when # Commands should not change things if nothing needs doing
- no-changed-when # Commands should not change things if nothing needs doing

skip_list:
- unnamed-task # All tasks should be named
- package-latest # Package installs should not use latest
- unnamed-task # All tasks should be named
- package-latest # Package installs should not use latest
45 changes: 10 additions & 35 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ env:
PYTHON_VERSION: 3.11

jobs:
dependencies:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -53,42 +49,17 @@ jobs:
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

lint:
needs: [dependencies]
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up python
uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/[email protected]
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Run lint
run: poetry run ansible-lint

test:
needs: [dependencies]
deploy:
needs: lint
runs-on: ${{ matrix.os }}
if: ${{ github.actor != 'dependabot[bot]' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
os: [macOS-latest]
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand All @@ -112,5 +83,9 @@ jobs:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install playbook
run: poetry run ansible-playbook playbooks/main.yml -vv
9 changes: 0 additions & 9 deletions .yamllint

This file was deleted.

14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Example:
playbook: playbooks/main.yml

play #1 (all): Setup workstation TAGS: []
TASK TAGS: [azure, cli-tools, docker, fonts, git, gnu-tools, gpg, homebrew-update, iterm2, javascript, kubernetes, python, screen, ssh, terraform, vim, zsh]
TASK TAGS: [akamai, alacritty, always, azure, cli-tools, docker, fonts, git, gpg, homebrew-update, iterm2, javascript, kubernetes, nvim, python, ssh, terraform, vim, zsh]

#### Install selected components

Expand All @@ -66,4 +66,14 @@ poetry run ansible-playbook playbooks/main.yml -t <tag>,<tag>

Example:

`poetry run ansible-playbook playbooks/main.yml -t kubernetes,terraform`
```bash
poetry run ansible-playbook playbooks/main.yml -t kubernetes,terraform
```

## Development

### Code lint

```bash
poetry run ansible-lint
```
11 changes: 11 additions & 0 deletions host_vars/localhost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
home_directory: "{{ ansible_env.HOME }}"
# XDG environment variables (https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html)
xdg_data_home: "{{ home_directory }}/.local/share"
xdg_config_home: "{{ home_directory }}/.config"
xdg_state_home: "{{ home_directory }}/.local/state"
xdg_data_dirs: "/usr/local/share/:/usr/share/"
xdg_config_dirs: "/etc/xdg"
xdg_cache_home: "{{ home_directory }}/.cache"
xdg_runtime_dir: ""

shell_config_dir: "{{ xdg_config_home }}/shell_config"
231 changes: 115 additions & 116 deletions playbooks/main.yml
Original file line number Diff line number Diff line change
@@ -1,123 +1,122 @@
---
- name: Setup workstation
hosts: all
hosts: localhost
gather_facts: true

vars:
shell_config_dir: "{{ lookup('env','HOME') }}/.config/zsh"

tasks:
- name: Update homebrew
when: ansible_system == "Darwin"
community.general.homebrew:
update_homebrew: true
tags:
- homebrew-update

- ansible.builtin.import_role:
name: fonts
tags:
- fonts

- ansible.builtin.import_role:
name: python
tags:
- python

- ansible.builtin.import_role:
name: zsh
vars:
zsh_config_dir: "{{ shell_config_dir }}"
tags:
- zsh

- ansible.builtin.import_role:
name: git
tags:
- git

- ansible.builtin.import_role:
name: gnu_tools
vars:
gnu_tools_shell_config_file: "{{ shell_config_dir }}/custom/gnu-tools.zsh"
- name: Init Homebrew
when: ansible_system == "Darwin"
tags:
- gnu-tools

- ansible.builtin.import_role:
name: cli_tools
vars:
cli_tools_shell_config_file: "{{ shell_config_dir }}/custom/cli-tools.zsh"
tags:
- cli-tools

- ansible.builtin.import_role:
name: docker
vars:
docker_shell_config_file: "{{ shell_config_dir }}/custom/docker.zsh"
tags:
- docker

- ansible.builtin.import_role:
name: vim
tags:
- vim

- ansible.builtin.import_role:
name: screen
tags:
- screen

- ansible.builtin.import_role:
name: ssh
tags:
- ssh

- ansible.builtin.import_role:
name: gpg
vars:
gpg_shell_config_file: "{{ shell_config_dir }}/custom/gpg.zsh"
tags:
- gpg

- ansible.builtin.import_role:
name: kubernetes
vars:
k8s_shell_config_file: "{{ shell_config_dir }}/custom/kubernetes.zsh"
tags:
- kubernetes

- ansible.builtin.import_role:
name: terraform
vars:
terraform_shell_config_file: "{{ shell_config_dir }}/custom/terraform.zsh"
tags:
- terraform

- ansible.builtin.import_role:
name: azure
vars:
azure_shell_config_file: "{{ shell_config_dir }}/custom/azure.zsh"
tags:
- azure

- ansible.builtin.import_role:
name: javascript
vars:
javascript_shell_config_file: "{{ shell_config_dir }}/custom/javascript.zsh"
tags:
- javascript

- ansible.builtin.import_role:
name: iterm2
vars:
iterm2_defaults:
- name: OnlyWhenMoreTabs
type: string
value: true
- name: PromptOnQuit
type: bool
value: false
tags: always
block:
- name: Retrieve homebrew prefix
ansible.builtin.shell: |
brew --prefix
register: brew_prefix
changed_when: false

- name: Register homebrew prefix as fact
ansible.builtin.set_fact:
homebrew_prefix: "{{ brew_prefix.stdout }}"

- name: Disable homebrew analytics
ansible.builtin.shell: |
brew analytics off
changed_when: false

- name: Update homebrew
community.general.homebrew:
update_homebrew: true
tags:
- homebrew-update

- ansible.builtin.debug:
msg: |
Homebrew Prefix: {{ homebrew_prefix }}
- name: Install MacOs tools
when: ansible_system == "Darwin"
tags:
- iterm2
block:
- ansible.builtin.import_role:
name: fonts
tags:
- fonts

- ansible.builtin.import_role:
name: python
tags:
- python

- ansible.builtin.import_role:
name: zsh
tags:
- zsh

- ansible.builtin.import_role:
name: git
tags:
- git

- ansible.builtin.import_role:
name: cli_tools
tags:
- cli-tools

- ansible.builtin.import_role:
name: docker
tags:
- docker

- ansible.builtin.import_role:
name: vim
tags:
- vim

- ansible.builtin.import_role:
name: nvim
tags:
- nvim

- ansible.builtin.import_role:
name: ssh
tags:
- ssh

- ansible.builtin.import_role:
name: gpg
tags:
- gpg

- ansible.builtin.import_role:
name: kubernetes
tags:
- kubernetes

- ansible.builtin.import_role:
name: terraform
tags:
- terraform

- ansible.builtin.import_role:
name: azure
tags:
- azure

- ansible.builtin.import_role:
name: javascript
tags:
- javascript

- ansible.builtin.import_role:
name: iterm2
tags:
- iterm2

- ansible.builtin.import_role:
name: akamai
tags:
- akamai

- ansible.builtin.import_role:
name: alacritty
tags:
- alacritty
Loading

0 comments on commit eb3cdfa

Please sign in to comment.