Feat: modularie user and dotfiles
This commit is contained in:
parent
5ffb1dbfa8
commit
e346a61ced
@ -37,3 +37,12 @@ def test_clone_dotfiles(host):
|
|||||||
dotfiles = host.file(admin.home + "/.dotfiles")
|
dotfiles = host.file(admin.home + "/.dotfiles")
|
||||||
assert dotfiles.exists
|
assert dotfiles.exists
|
||||||
assert dotfiles.user == admin.name
|
assert dotfiles.user == admin.name
|
||||||
|
|
||||||
|
def test_stow_config(host):
|
||||||
|
user = host.user("user")
|
||||||
|
nvim_config = host.files(user.home + "/.config/nvim/")
|
||||||
|
assert nvim_config.exists
|
||||||
|
|
||||||
|
admin = host.user("admin")
|
||||||
|
nvim_config = host.files(admin.home + "/.config/nvim/")
|
||||||
|
assert not nvim_config.exists
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
community.general.pacman:
|
community.general.pacman:
|
||||||
name: stow
|
name: stow
|
||||||
state: present
|
state: present
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Install git
|
- name: Install git
|
||||||
community.general.pacman:
|
community.general.pacman:
|
||||||
name: git
|
name: git
|
||||||
state: present
|
state: present
|
||||||
become: true
|
|
||||||
|
37
roles/user/tasks/dotfiles.yml
Normal file
37
roles/user/tasks/dotfiles.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
- name: Install for arch
|
||||||
|
import_tasks: arch.yml
|
||||||
|
when: ansible_os_family == "Archlinux"
|
||||||
|
|
||||||
|
- name: Install for debian
|
||||||
|
import_tasks: debian.yml
|
||||||
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
- name: init neovim
|
||||||
|
import_tasks: neovim.yml
|
||||||
|
when: '"nvim" in user.config.stowing'
|
||||||
|
|
||||||
|
- name: init vim
|
||||||
|
import_tasks: vim.yml
|
||||||
|
when: '"vim" in user.config.stowing'
|
||||||
|
|
||||||
|
- name: init sway
|
||||||
|
import_tasks: sway.yml
|
||||||
|
when: '"sway" in user.config.stowing'
|
||||||
|
|
||||||
|
- name: Clone dotfiles
|
||||||
|
ansible.builtin.git:
|
||||||
|
repo: "{{ user.config.giturl }}"
|
||||||
|
dest: "/home/{{ user.username }}/.dotfiles"
|
||||||
|
|
||||||
|
- name: user owns its dotfiles
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/home/{{ user.username }}/.dotfiles"
|
||||||
|
owner: "{{ user.username }}"
|
||||||
|
|
||||||
|
- name: stow configs
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: stow {{ item }}
|
||||||
|
chdir: "/home/{{ user.username }}/.dotfiles"
|
||||||
|
with_items: "{{ user.config.stowing }}"
|
||||||
|
|
@ -27,27 +27,6 @@
|
|||||||
when: user.public_key
|
when: user.public_key
|
||||||
|
|
||||||
# Dotfiles
|
# Dotfiles
|
||||||
- name: Install for arch
|
- name: set dotfiles
|
||||||
import_tasks: arch.yml
|
import_tasks: dotfiles.yml
|
||||||
when: ansible_os_family == "Archlinux"
|
|
||||||
|
|
||||||
- name: Install for debian
|
|
||||||
import_tasks: debian.yml
|
|
||||||
when: ansible_os_family == "Debian"
|
|
||||||
|
|
||||||
- name: Clone dotfiles
|
|
||||||
ansible.builtin.git:
|
|
||||||
repo: "{{ user.config.giturl }}"
|
|
||||||
dest: "/home/{{ user.username }}/.dotfiles"
|
|
||||||
|
|
||||||
- name: user owns its dotfiles
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "/home/{{ user.username }}/.dotfiles"
|
|
||||||
owner: "{{ user.username }}"
|
|
||||||
|
|
||||||
- name: stow configs
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: stow {{ item }}
|
|
||||||
chdir: "/home/{{ user.username }}/.dotfiles"
|
|
||||||
with_items: "{{ user.config.stowing }}"
|
|
||||||
|
|
||||||
|
24
roles/user/tasks/neovim.yml
Normal file
24
roles/user/tasks/neovim.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
- name: Install neovim
|
||||||
|
community.general.pacman:
|
||||||
|
name: neovim
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == "Archlinux"
|
||||||
|
|
||||||
|
- name: Install neovim
|
||||||
|
apt:
|
||||||
|
name: neovim
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
- name: Install packer
|
||||||
|
ansible.builtin.git:
|
||||||
|
repo: "https://github.com/wbthomason/packer.nvim"
|
||||||
|
dest: "/home/{{ user.username }}/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
||||||
|
depth: 1
|
||||||
|
|
||||||
|
- name: user owns packer
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/home/{{ user.username }}/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
||||||
|
owner: "{{ user.username }}"
|
||||||
|
|
23
roles/user/tasks/sway.yml
Normal file
23
roles/user/tasks/sway.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
- name: Install sway packages
|
||||||
|
community.general.pacman:
|
||||||
|
name:
|
||||||
|
- sway
|
||||||
|
- gammastep
|
||||||
|
- mako
|
||||||
|
- rofi
|
||||||
|
- rofi-pass
|
||||||
|
- grim
|
||||||
|
- kanshi
|
||||||
|
- blueman
|
||||||
|
- pamixer
|
||||||
|
- waybar
|
||||||
|
- network-manager-applet
|
||||||
|
- wlroots
|
||||||
|
- xdg-desktop-portal-wlr
|
||||||
|
- wl-clipboard
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Install sway AUR packages
|
||||||
|
aut:
|
||||||
|
- avizo
|
23
roles/user/tasks/vim.yml
Normal file
23
roles/user/tasks/vim.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
- name: Install vim
|
||||||
|
community.general.pacman:
|
||||||
|
name: vim
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == "Archlinux"
|
||||||
|
|
||||||
|
- name: Install vim
|
||||||
|
apt:
|
||||||
|
name: vim
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
- name: Install vim-plug
|
||||||
|
get_url:
|
||||||
|
url: "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
|
||||||
|
dest: "/home/{{ user.username }}/.vim/autoload/plug.vim"
|
||||||
|
|
||||||
|
- name: user owns vim-plug
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/home/{{ user.username }}/.vim/autoload/plug.vim"
|
||||||
|
owner: "{{ user.username }}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user