1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-22 06:51:58 +01: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

@ -55,25 +55,20 @@ cp hosts.template hosts
Add your hostnames in section: Add your hostnames in section:
- ***cli***: install only cli tools - ***cli***: install only cli tools
- ***desktop***: install cli tools + desktop environment - ***desktop***: install cli tools + desktop environment
Define which user will get configurations with *ansible_user* var. Define which user will get configurations with *ansible_user* var.
- *desktop* hosts **can't use root**.
###### a. localhost run ###### 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]
cli_user ansible_connection=local ansible_user=root
[desktop] [desktop]
desktop ansible_connection=local ansible_user=user localhost ansible_connection=local
``` ```
###### b. multiple hosts run ###### b. multiple hosts run
Note: *desktop* hosts **can't use root**.
``` ```
[cli] [cli]
server1 ansible_user=root 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 -CD
ansible-playbook install.yml 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

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

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

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

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

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