Add Ansible
This commit is contained in:
55
dot_bootstrap/setup.yml
Normal file
55
dot_bootstrap/setup.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
- name: Role out main Configuration to {{ ansible_hostname }}
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: true
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
- name: Get my user
|
||||
ansible.builtin.set_fact:
|
||||
regular_user: "{{ ansible_env.SUDO_USER or ansible_user_id }}"
|
||||
|
||||
- name: Install common packages
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
# Terminal tools
|
||||
- git
|
||||
- htop
|
||||
- fzf
|
||||
- zoxide
|
||||
- bat
|
||||
- eza
|
||||
- duf
|
||||
- ripgrep
|
||||
- yazi
|
||||
- tmux
|
||||
# Editor
|
||||
- nvim
|
||||
# Backup/Restor
|
||||
#- chezmoi
|
||||
- rsync
|
||||
# Network
|
||||
- mosh
|
||||
- nmap
|
||||
- tcpdump
|
||||
|
||||
- name: Change shell to zsh
|
||||
ansible.builtin.user:
|
||||
name: "{{ regular_user }}"
|
||||
shell: /usr/bin/zsh
|
||||
|
||||
- name: Create fonts directory
|
||||
ansible.builtin.file:
|
||||
path: "~{{ regular_user }}/.fonts"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: "{{ regular_user }}"
|
||||
|
||||
- name: Installing Nerdfonts
|
||||
ansible.builtin.unarchive:
|
||||
src: https://github.com/eliheuer/caskaydia-cove/archive/refs/heads/master.zip
|
||||
dest: "~{{ regular_user }}/.fonts/"
|
||||
remote_src: true
|
||||
mode: "0755"
|
||||
owner: "{{ regular_user }}"
|
||||
|
||||
36
run_once_install_ansible.sh
Normal file
36
run_once_install_ansible.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
install_on_debian() {
|
||||
sudo apt update
|
||||
sudo apt install -y ansible
|
||||
}
|
||||
|
||||
install_on_arch() {
|
||||
sudo pacman -Sy ansible
|
||||
}
|
||||
|
||||
install_linux() {
|
||||
case $1 in
|
||||
"Arch"|"EndevourOS")
|
||||
install_on_arch
|
||||
;;
|
||||
"Ubuntu"|"Debian"|"Linuxmint")
|
||||
install_on_debian
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
OS="$(uname -s)"
|
||||
case "${OS}" in
|
||||
Linux*)
|
||||
if [ -f /etc/os-release ]; then
|
||||
source /etc/os-release
|
||||
else
|
||||
export PRETTY_NAME="$(lsb_release -i | column --table -N Dist,ID,Name -H Dist,ID -d)"
|
||||
fi
|
||||
|
||||
install_linux $PRETTY_NAME
|
||||
;;
|
||||
esac
|
||||
|
||||
ansible-playbook ~/.bootstrap/setup.yml --ask-become-pass
|
||||
7
run_onchange_bootstrap.sh.tmpl
Normal file
7
run_onchange_bootstrap.sh.tmpl
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# .bootstrap/setup.yml hash: {{ include "dot_bootstrap/setup.yml" | sha256sum }}
|
||||
|
||||
if command -v ansible-playbook &> /dev/null; then
|
||||
ansible-playbook {{ joinPath .chezmoi.sourceDir "dot_bootstrap/setup.yml" | quote }} --ask-become-pass
|
||||
fi
|
||||
Reference in New Issue
Block a user