Skip to content

Commit

Permalink
Add fzf, aws completion
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeeq committed Dec 18, 2024
1 parent a1f3de2 commit 51d1896
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 53 deletions.
46 changes: 23 additions & 23 deletions playbooks/fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
- name: Include a playbook for including arch specifc vars
import_playbook: vars.yml

- name: Fedora bootstrap
hosts:
- "{{ hosts_to_deploy | default('local') }}"
# - mikeeClevo
become: true
pre_tasks:
# - debug:
# var: hostvars[inventory_hostname]
roles:
- pkg_mgmt/dnf
- pkg_mgmt/flatpak
- desktop/apps/google_chrome
- desktop/apps/keeweb
- apps/docker
- apps/qemu
- desktop/apps/terminator
- apps/vagrant
- apps/packer
- desktop/gnome
- desktop/apps/vscode
- desktop/apps/x11docker
- desktop/fedora
# - apps/nordvpn
# - name: Fedora bootstrap
# hosts:
# - "{{ hosts_to_deploy | default('local') }}"
# # - mikeeClevo
# become: true
# pre_tasks:
# # - debug:
# # var: hostvars[inventory_hostname]
# roles:
# - pkg_mgmt/dnf
# - pkg_mgmt/flatpak
# - desktop/apps/google_chrome
# - desktop/apps/keeweb
# - apps/docker
# - apps/qemu
# - desktop/apps/terminator
# - apps/vagrant
# - apps/packer
# - desktop/gnome
# - desktop/apps/vscode
# - desktop/apps/x11docker
# - desktop/fedora
# # - apps/nordvpn

- name: Include a playbook for generic-core provisioning
import_playbook: generic-core.yml
Expand Down
30 changes: 15 additions & 15 deletions playbooks/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
hosts: "{{ hosts_to_deploy | default('local') }}"
become: true
roles:
- pkg_mgmt/pip
# - apps/keybase
- apps/kubectl
- apps/helm
- apps/stern
- apps/kail
- apps/hadolint
- apps/kubescore
- apps/istioctl
- apps/netcore_sdk
- apps/argocd
# - pkg_mgmt/pip
# # - apps/keybase
# - apps/kubectl
# - apps/helm
# - apps/stern
# - apps/kail
# - apps/hadolint
# - apps/kubescore
# - apps/istioctl
# - apps/netcore_sdk
# - apps/argocd
- apps/aws-cli
- apps/terraform
- apps/terragrunt
- apps/terraform-docs
- apps/azure-functions-core-tools
# - apps/terraform
# - apps/terragrunt
# - apps/terraform-docs
# - apps/azure-functions-core-tools
2 changes: 2 additions & 0 deletions playbooks/group_vars/aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ flatpak_apps:
# https://github.com/ishantanu/awesome-kubectl-plugins
krew_plugins:
- hns

aws_cli_session_manager_plugin_architecture_common_name: "arm64"
2 changes: 2 additions & 0 deletions playbooks/group_vars/x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ krew_plugins:

dnf_extra_pkgs:
- steam-devices

aws_cli_session_manager_plugin_architecture_common_name: "64bit"
24 changes: 12 additions & 12 deletions roles/apps/aws-cli/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Install PIP aws-cli in virtualenv
pip:
# - name: Install PIP aws-cli in virtualenv
# pip:
# name: "https://github.com/aws/aws-cli/archive/refs/tags/{{ aws_cli_version }}.tar.gz"
# state: present
# virtualenv: "{{ virtualenv_install_path }}/aws-cli"
# virtualenv_python: "python3.12"

- name: Install PIPx aws-cli
community.general.pipx:
name: "https://github.com/aws/aws-cli/archive/refs/tags/{{ aws_cli_version }}.tar.gz"
state: present
virtualenv: "{{ virtualenv_install_path }}/aws-cli"
virtualenv_python: "python3.12"

- name: Create a symbolic link for aws-cli
file:
src: "{{ virtualenv_install_path }}/aws-cli/bin/aws"
dest: "/usr/local/bin/aws"
owner: root
group: root
state: link
install_deps: true
global: true
python: "python3.12"
25 changes: 25 additions & 0 deletions roles/apps/aws-cli/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,28 @@

- include_tasks: install.yml
when: installed_aws_cli_version.stdout != aws_cli_version

- name: Install Session Manager plugin on Fedora
dnf:
name: "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/linux_{{ aws_cli_session_manager_plugin_architecture_common_name }}/session-manager-plugin.rpm"
state: present
when:
- ansible_distribution == "Fedora"

- name: Install Session Manager plugin on Ubuntu
apt:
deb: "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_{{ aws_cli_session_manager_plugin_architecture_common_name }}/session-manager-plugin.deb"
state: present
when:
- ansible_distribution == "Ubuntu"

- name: Create a symbolic link for aws-cli
file:
src: "/opt/pipx/venvs/awscli/bin/{{ item }}"
dest: "/usr/local/bin/{{ item }}"
owner: root
group: root
state: link
loop:
- aws
- aws_completer
33 changes: 33 additions & 0 deletions roles/apps/oh_my_zsh/tasks/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,36 @@
url: "https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.zsh"
dest: /usr/share/doc/fzf/examples/key-bindings.zsh
when: ansible_distribution == "Ubuntu"

- name: "Download zsh-completion"
become: true
become_user: "{{ item }}"
git:
repo: 'https://github.com/zsh-users/zsh-completions'
dest: "~/.oh-my-zsh/custom/plugins/zsh-completions"
update: true
with_items:
- "{{ user_name }}"
- root

- name: "Download fzf-tab-completion"
become: true
become_user: "{{ item }}"
git:
repo: 'https://github.com/lincheney/fzf-tab-completion.git'
dest: "~/.oh-my-zsh/custom/plugins/fzf-tab-completion"
update: true
with_items:
- "{{ user_name }}"
- root

- name: "Download fzf-tab"
become: true
become_user: "{{ item }}"
git:
repo: 'https://github.com/Aloxaf/fzf-tab'
dest: "~/.oh-my-zsh/custom/plugins/fzf-tab"
update: true
with_items:
- "{{ user_name }}"
- root
19 changes: 16 additions & 3 deletions roles/apps/oh_my_zsh/templates/oh_my_zsh_zshrc.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
Expand All @@ -15,10 +17,13 @@ plugins=(
zsh-syntax-highlighting
docker
ansible
fzf
dnf
z
colored-man-pages
aws
fzf
fzf-tab
# zsh-completions
{% if item != 'root' %}
vscode
terraform
Expand All @@ -31,7 +36,7 @@ plugins=(
source $ZSH/oh-my-zsh.sh

{% if item != 'root' %}
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$HOME/.cargo/bin:/opt/azure_functions_core_tools:$PATH"
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$HOME/.cargo/bin:/opt/azure_functions_core_tools:$HOME/.local/bin:$PATH"
{% endif %}

# Extracting Dockerfile from image
Expand Down Expand Up @@ -71,7 +76,7 @@ export EDITOR=/usr/bin/vim

autoload -U +X bashcompinit && bashcompinit
{% if skip_azure_cli_autocompletion is not defined %}
source /opt/virtualenv/azure-cli/bin/az.completion.sh
source /opt/pipx/venvs/azure-cli/bin/az.completion.sh
{% endif %}

alias git_root='cd $(git rev-parse --show-toplevel)'
Expand All @@ -89,3 +94,11 @@ WORK_PROFILES_PATH="$HOME/.work_profiles"
if [[ -n $WORK_PROFILE ]]; then
source $WORK_PROFILES_PATH/.zshrc
fi

{# source $HOME/.oh-my-zsh/custom/plugins/fzf-tab-completion/zsh/fzf-zsh-completion.sh
# only aws command completion
# zstyle ':completion:*:*:aws' fzf-search-display true
# or for everything
zstyle ':completion:*' fzf-search-display true #}

autoload -U compinit && compinit //override comp

0 comments on commit 51d1896

Please sign in to comment.