Skip to content

Commit

Permalink
bump to ubuntu 24.04 and finish oh my zsh w/ config
Browse files Browse the repository at this point in the history
  • Loading branch information
Giancarmine committed Aug 28, 2024
1 parent a01459c commit 97849d7
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Vagrant.require_version ">= 1.8.0"

Vagrant.configure("2") do |config|
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.box = "generic/ubuntu2204"
config.vm.box = "bento/ubuntu-24.04"
# config.vm.network 'private_network', ip: '192.168.22.4'
config.vm.synced_folder ".", "/vagrant"

Expand Down
8 changes: 4 additions & 4 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ username: "{{ lookup('env', 'USER') }}"
home: /home/{{ lookup('env', 'USER') }}

packages_apt:
- wget
- copyq
- curl
- fwupd
- git
- zip
- unrar
- unzip
- net-tools
- python3-pip
- software-properties-common
- wget
- zip
- zsh

packages_pip:
- ansicolors
Expand All @@ -28,7 +27,6 @@ kops_version: 1.22.5
kubectl_version: 1.23.13
kubelogin_version: 1.25.1
istioctl_version: 1.11.8
meshctl_version: 1.1.2
helm_version: 3.9.3
kustomize_version: 4.0.4

Expand All @@ -53,3 +51,5 @@ binaries:
nvm_version: 0.39.0
nvm_node_versions:
- 16.9.1

oh_my_zsh_version: 0.9.20
26 changes: 13 additions & 13 deletions roles/base/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
- apt

# PIP configuration
- name: Configure PIP
block:
- name: Configure PIP (directory)
file:
path: ~/.pip
state: directory
tags:
- pip
# - name: Configure PIP
# block:
# - name: Configure PIP (directory)
# file:
# path: ~/.pip
# state: directory
# tags:
# - pip

# Install PIP packages
- name: Install PIP packages
pip:
name: "{{ packages_pip }}"
tags:
- pip
# - name: Install PIP packages
# pip:
# name: "{{ packages_pip }}"
# tags:
# - pip

# Install SNAP packages
- name: Install SNAP packages
Expand Down
79 changes: 79 additions & 0 deletions roles/ohmyzsh/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
- name: Install Oh My Zsh
become: true
apt:
name: zsh
state: present

- name: Clone Oh My Zsh
become: true
git:
repo: https://github.com/ohmyzsh/oh-my-zsh.git
dest: ~/.oh-my-zsh
recursive: yes

- name: Clone zsh-autosuggestions
become: true
git:
repo: https://github.com/zsh-users/zsh-autosuggestions
dest: ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
recursive: yes

- name: Clone zsh-syntax-highlighting
become: true
git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
recursive: yes

- name: Clone zsh-history-substring-search
become: true
git:
repo: https://github.com/zsh-users/zsh-history-substring-search
dest: ~/.oh-my-zsh/custom/plugins/zsh-history-substring-search
recursive: yes

- name: Set Zsh as default shell
become: true
user:
name: "{{ username }}"
shell: /bin/zsh

- name: Ensure .zshrc file exists
become: true
stat:
path: "{{ home }}/.zshrc"
register: zshrc_stat

- name: Create .zshrc file if it doesn't exist
become: true
file:
path: "{{ home }}/.zshrc"
state: touch
when: not zshrc_stat.stat.exists

- name: Configure Oh My Zsh
become: true
template:
src: zshrc.j2
dest: "{{ home }}/.zshrc"
mode: '0644'

- name: Reload shell
become: true
shell: |
echo "Reloading shell..."
if [[ -n "$SHELL" ]]; then
eval "$(echo $SHELL)"
fi
if [[ -n "$HOME" ]]; then
cd ~
fi
if [[ -f ~/.zshrc ]]; then
source ~/.zshrc
else
echo "Warning: .zshrc file not found."
fi
args:
executable: /bin/bash
creates: "{{ home }}/.zshrc"
19 changes: 19 additions & 0 deletions roles/ohmyzsh/templates/zshrc.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# roles/ohmyzsh/templates/zshrc.j2

export PATH="$HOME/bin:$PATH"
export HIST_STAMPS='yyyy-mm-dd HH:MM:ss'
export HISTSIZE=10000
export SAVEHIST=10000

plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)

ZSH_THEME="robbyrussell"

source $HOME/.oh-my-zsh/lib/theme-and-apPEARance.zsh
source $HOME/.oh-my-zsh/lib/key-bindings.zsh

autoload -U compinit && compinit

0 comments on commit 97849d7

Please sign in to comment.