add ansible playbook setup
This commit is contained in:
parent
78bfbc3ed6
commit
ba324fa3c4
3 changed files with 131 additions and 0 deletions
25
bootstrap/bootstrap.sh
Executable file
25
bootstrap/bootstrap.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if ! command -v uv >/dev/null 2>&1; then
|
||||||
|
echo -e "Installing UV...\n"
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "Executing playbook...\n"
|
||||||
|
|
||||||
|
if [[ -d ~/.config/dotfiles ]]; then
|
||||||
|
pushd ~/.config/dotfiles/bootstrap/ || exit
|
||||||
|
|
||||||
|
# dotfiles are cloned, executed localy
|
||||||
|
uvx --with ansible --from ansible-core ansible-playbook --ask-become-pass bootstrap.yaml
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# dotfiles are not cloned, executed remotly
|
||||||
|
uvx --with ansible --from ansible-core ansible-pull --ask-become-pass --url ssh://git@git.alecodes.page:24062/alecodes/dots.git bootstrap/bootstrap.yaml
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd || exit
|
||||||
|
|
||||||
|
echo -e "Done!\n"
|
||||||
39
bootstrap/bootstrap.yaml
Normal file
39
bootstrap/bootstrap.yaml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
- name: Bootstrap system installation
|
||||||
|
hosts: localhost
|
||||||
|
vars_files:
|
||||||
|
- ./variables.yaml
|
||||||
|
tasks:
|
||||||
|
- name: Fedora setup
|
||||||
|
when: ansible_facts['distribution'] == "Fedora"
|
||||||
|
block:
|
||||||
|
- name: Enable copr repos
|
||||||
|
become: true
|
||||||
|
loop: "{{ fedora.copr }}"
|
||||||
|
community.general.copr:
|
||||||
|
state: enabled
|
||||||
|
name: "{{ item }}"
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
become: true
|
||||||
|
ansible.builtin.package:
|
||||||
|
state: present
|
||||||
|
name: "{{ global.packages }}"
|
||||||
|
|
||||||
|
- name: Generate an OpenSSH keypair
|
||||||
|
community.crypto.openssh_keypair:
|
||||||
|
path: ~/.ssh/id_ed25519
|
||||||
|
type: ed25519
|
||||||
|
|
||||||
|
- name: Clone dotfiles
|
||||||
|
ignore_errors: true
|
||||||
|
notify: Deploy dots
|
||||||
|
ansible.builtin.git:
|
||||||
|
accept_newhostkey: true
|
||||||
|
repo: ssh://git@git.alecodes.page:24062/alecodes/dots.git
|
||||||
|
dest: ~/.config/dotfiles
|
||||||
|
update: true
|
||||||
|
version: main
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: Deploy dots
|
||||||
|
ansible.builtin.command: tuckr add *
|
||||||
67
bootstrap/variables.yaml
Normal file
67
bootstrap/variables.yaml
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
fedora:
|
||||||
|
copr:
|
||||||
|
- atim/lazygit
|
||||||
|
- the4runner/firefox-dev
|
||||||
|
packages: {}
|
||||||
|
|
||||||
|
global:
|
||||||
|
packages:
|
||||||
|
- adwaita-cursor-theme
|
||||||
|
- adwaita-icon-theme
|
||||||
|
- adwaita-icon-theme-legacy
|
||||||
|
- adwaita-mono-fonts
|
||||||
|
- adwaita-sans-fonts
|
||||||
|
- bat
|
||||||
|
- breeze-icon-theme
|
||||||
|
- breeze-icon-theme-fedora
|
||||||
|
- curl
|
||||||
|
- duf
|
||||||
|
- eza
|
||||||
|
- fd-find
|
||||||
|
- firefox-dev
|
||||||
|
- fish
|
||||||
|
- flatpak
|
||||||
|
- fzf
|
||||||
|
- git
|
||||||
|
- grim
|
||||||
|
- kitty
|
||||||
|
- lazygit
|
||||||
|
- neovim
|
||||||
|
- nodejs
|
||||||
|
- openssh
|
||||||
|
- openssh-askpass
|
||||||
|
- openssh-clients
|
||||||
|
- openssh-server
|
||||||
|
- openssl
|
||||||
|
- openssl-devel
|
||||||
|
- openssl-libs
|
||||||
|
- php-cli
|
||||||
|
- php-common
|
||||||
|
- php-intl
|
||||||
|
- php-mbstring
|
||||||
|
- php-pecl-zip
|
||||||
|
- php-process
|
||||||
|
- php-soap
|
||||||
|
- php-xml
|
||||||
|
- rhythmbox
|
||||||
|
- ripgrep
|
||||||
|
- rofi-themes
|
||||||
|
- rofi-wayland
|
||||||
|
- rofimoji
|
||||||
|
- rootfiles
|
||||||
|
- rsync
|
||||||
|
- sd
|
||||||
|
- sed
|
||||||
|
- sushi
|
||||||
|
- swappy
|
||||||
|
- tailscale
|
||||||
|
- tealdeer
|
||||||
|
- trash-cli
|
||||||
|
- tree
|
||||||
|
- tree-sitter-cli
|
||||||
|
- udisks2
|
||||||
|
- unrar
|
||||||
|
- unrar-free
|
||||||
|
- unzip
|
||||||
|
- zip
|
||||||
|
- zoxide
|
||||||
Loading…
Add table
Add a link
Reference in a new issue