1
0
Fork 0
mirror of https://github.com/eoli3n/dotfiles synced 2024-04-20 00:53:47 +02:00

updated fish role

This commit is contained in:
eoli3n 2020-05-15 18:03:40 +02:00
parent 84ca7df0e2
commit 0372506533
6 changed files with 60 additions and 50 deletions

View File

@ -55,25 +55,20 @@ cp hosts.template hosts
Add your hostnames in section:
- ***cli***: install only cli tools
- ***desktop***: install cli tools + desktop environment
Define which user will get configurations with *ansible_user* var.
- *desktop* hosts **can't use root**.
###### a. localhost run
Let's use a trick to let ansible think that there is 2 different hosts.
It will configure *root* with *cli* tools only and *user* with *desktop* environment.
That trick needs ``-K`` without ``-b`` when running playbook.
```
[cli]
cli_user ansible_connection=local ansible_user=root
[desktop]
desktop ansible_connection=local ansible_user=user
localhost ansible_connection=local
```
###### b. multiple hosts run
Note: *desktop* hosts **can't use root**.
```
[cli]
server1 ansible_user=root
@ -95,10 +90,11 @@ ssh-copy-id -i path/to/ssh/key.pub user@host
ansible-playbook install.yml -CD
ansible-playbook install.yml
```
To configure cli tools for root on desktop hosts:
*Note: ansible_user needs to be sudoers.*
For *desktop* hosts, if ``ansible_user`` is sudoer, to install cli tools for *root*, use:
```
ansible-playbook install.yml -b -K -l desktop
ansible-playbook install.yml -l host1 -b -K
```
-----

2
TODO
View File

@ -10,6 +10,8 @@
# FIX
- copy/paste kitty->firefox remove '\n' ?
- move to brightnessctl waybar config and bindsym
- root config of fish no pure prompt
# ISSUES
* tiny-irc : https://github.com/osa1/tiny/issues/created_by/eoli3n

View File

@ -3,3 +3,4 @@ inventory = ./hosts
callback_whitelist = skippy
display_skipped_hosts = False
host_key_checking = False
interpreter_python = auto_silent

View File

@ -1,3 +1,3 @@
#localhost ansible_connection=local ansible_user=user
#localhost ansible_connection=local
[cli]
[desktop]

View File

@ -1,34 +1,46 @@
---
- hosts: desktop
tags: limit
tasks:
- hosts: all
gather_facts: yes
pre_tasks:
- name: Limit to Archlinux and NixOS
fail:
msg: "{{ ansible_distribution }} is not supported with this tag."
when: (ansible_distribution != "Archlinux") and
(ansible_distribution != "NixOS")
- name: Limit to user accounts
fail:
msg: "Don't run as root."
when: ansible_user_id == "root"
- hosts: cli:desktop
roles:
- { role: fish, tags: fish }
- { role: neovim, tags: neovim }
- { role: screen, tags: screen }
- { role: git, tags: git }
- { role: userbin, tags: userbin }
- role: fish
tags: fish
- role: neovim
tags: neovim
- role: screen
tags: screen
- role: git
tags: git,cli
- role: userbin
tags: userbin
- hosts: desktop
roles:
- role: ssh-agent
tags: ssh-agent
when: ansible_distribution == "Archlinux"
- { role: gtk, tags: gtk }
- { role: sway, tags: sway }
- { role: waybar, tags: waybar }
- { role: wofi, tags: wofi }
- { role: mako, tags: mako }
- { role: kitty, tags: kitty }
when: ansible_distribution == "Archlinux" and ansible_user_id != 'root'
- role: gtk
tags: gtk
when: ansible_user_id != 'root'
- role: sway
tags: sway
when: ansible_user_id != 'root'
- role: waybar
tags: waybar
when: ansible_user_id != 'root'
- role: wofi
tags: wofi
when: ansible_user_id != 'root'
- role: mako
tags: mako
when: ansible_user_id != 'root'
- role: kitty
tags: kitty
when: ansible_user_id != 'root'

View File

@ -3,13 +3,14 @@
get_url:
url: https://get.oh-my.fish
dest: /tmp/oh-my.fish
mode: '7550'
mode: '0777'
changed_when: false
- name: Install oh-my-fish
shell: fish -c "/tmp/oh-my.fish --noninteractive -y"
shell: /tmp/oh-my.fish --noninteractive -y
args:
creates: ~/.config/fish/conf.d/omf.fish
executable: /usr/bin/fish
- name: Remove oh-my-fish installer
file:
@ -20,11 +21,12 @@
- name: Install pureprompt plugin
become_method: su
shell: |
fish -c "omf install pure"
fish -lc "ln -s $OMF_PATH/themes/pure/conf.d/pure.fish ~/.config/fish/conf.d/pure.fish"
fish -lc "ln -s $OMF_PATH/themes/pure/conf.d/_pure_init.fish ~/.config/fish/conf.d/pure_init.fish"
omf install pure
ln -s $OMF_PATH/themes/pure/conf.d/pure.fish ~/.config/fish/conf.d/pure.fish
ln -s $OMF_PATH/themes/pure/conf.d/_pure_init.fish ~/.config/fish/conf.d/pure_init.fish
args:
creates: ~/.config/fish/conf.d/pure.fish
executable: /usr/bin/fish
- name: check git plugin install
shell: grep 'abbr.*git' ~/.config/fish/fish_variables
@ -34,7 +36,9 @@
- name: Install git plugin
become_method: su
shell: fish -c "omf install https://github.com/jhillyerd/plugin-git"
shell: omf install https://github.com/jhillyerd/plugin-git
args:
executable: /usr/bin/fish
when: gitcheck is failed
- name: Copy dircolors
@ -48,26 +52,21 @@
src: fish/cli/
dest: ~/.config/fish
recursive: yes
when: ansible_user_id != "root"
when: ansible_user_id != 'root'
tags: rsync
- name: Sync fish config files for cli (if root)
synchronize:
src: fish/cli/
dest: /root/.config/fish
recursive: yes
when: ansible_user_id == "root"
when: ansible_user_id == 'root'
tags: rsync
- name: Sync fish config files for desktop (if user)
synchronize:
src: files/fish/desktop/
src: fish/desktop/
dest: ~/.config/fish
recursive: yes
when: ansible_user_id != "root"
- name: Sync fish config files for desktop (if root)
synchronize:
src: files/fish/desktop
dest: /root/.config/fish
recursive: yes
when: ansible_user_id == "root"
when: ansible_user_id != 'root'
tags: rsync