1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-22 15:01:59 +01:00

switch from powerline to airline, from localhost to multiple hosts

This commit is contained in:
eoli3n 2018-01-04 20:59:34 +01:00
parent 5d00b616c4
commit 2f56fe787c
15 changed files with 100 additions and 97 deletions

@ -39,7 +39,7 @@ Please check ``vagrant/*/README.md`` and ``docker/*/README.md``
## Desktop/Laptop Environment ## Desktop/Laptop Environment
Don't run as ``root``. Don't use as ``root``.
### Supported OS ### Supported OS
@ -83,8 +83,31 @@ Ansible will backup any existing conf file before erasing it (.zshrc, .i3/config
``` ```
git clone --recursive https://github.com/eoli3n/dotfiles git clone --recursive https://github.com/eoli3n/dotfiles
cd dotfiles cd dotfiles
# To list tasks, dryrun then install
./install.sh <desktop|laptop|[any package tag]> # edit hosts, then add your hostnames in right section <server|desktop|laptop>
# test connectivity
ansible all -m ping
# To list tasks and tags
ansible-playbook install.yml --list-tasks
# To dry-run and print files diff on all declared hosts
ansible-playbook install.yml -CDK
# To run the whole playbook for all hosts
ansible-playbook install.yml -K
# To install 1 tag on 1 host
ansible-playbook install.yml -K -l <hostname> -t <tag>
# To run only locally, add your hostname in right hosts file section
# you can replace server with <desktop|laptop>
echo << EOF > hosts
[server]
localhost ansible_connection=local
EOF
# then
ansible-playbook install.yml
``` ```
### Manual configurations ### Manual configurations
@ -126,9 +149,31 @@ To use dark theme, go to graphical configuration and click ``Use GTK+ Theme``
``` ```
git clone --recursive https://github.com/eoli3n/dotfiles git clone --recursive https://github.com/eoli3n/dotfiles
cd dotfiles cd dotfiles
# To list tasks, dryrun then install
./install.sh <server|[any package tag]>
# edit hosts, then add your hostnames in right section <server|desktop|laptop>
# test connectivity
ansible all -m ping
# To list tasks and tags
ansible-playbook install.yml --list-tasks
# To dry-run and print files diff on all declared hosts
ansible-playbook install.yml -CDK
# To run the whole playbook for all hosts
ansible-playbook install.yml -K
# To install 1 tag on 1 host
ansible-playbook install.yml -K -l <hostname> -t <tag>
# To run only locally, add your hostname in right hosts file section
# you can replace server with <desktop|laptop>
echo << EOF > hosts
[server]
localhost ansible_connection=local
EOF
# then
ansible-playbook install.yml
``` ```
# Previously # Previously

2
TODO

@ -3,7 +3,6 @@
- borgbackup: install and configure role - borgbackup: install and configure role
- tmux: install and configure role - tmux: install and configure role
- playbook: change includes in import tasks to be able to resolv with list-tasks - playbook: change includes in import tasks to be able to resolv with list-tasks
- powerline: check best install method all distrib
- zsh: check neon specific alias and others - zsh: check neon specific alias and others
- playbook: update all vagrant specific task to match docker hosts - playbook: update all vagrant specific task to match docker hosts
- playbook: test if tag limit exists - playbook: test if tag limit exists
@ -12,7 +11,6 @@
# TOFIX # TOFIX
- vagrant: chsh in vagrant config file for FreeBSD - vagrant: chsh in vagrant config file for FreeBSD
- powerline: not working with centos|debian|freebsd
- playbook: add {{ tag }} to fail module to print in "limit to distrib" task - playbook: add {{ tag }} to fail module to print in "limit to distrib" task
- vagrant: tty in qwerty for debian keyboard - vagrant: tty in qwerty for debian keyboard
- playbook: {{playbook_dir}} -> {{role_path}} - playbook: {{playbook_dir}} -> {{role_path}}

@ -44,6 +44,7 @@ RUN cd /tmp; curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBU
RUN cd /tmp; makepkg PKGBUILD --install --needed --noconfirm RUN cd /tmp; makepkg PKGBUILD --install --needed --noconfirm
RUN mkdir dotfiles RUN mkdir dotfiles
COPY . dotfiles/ COPY . dotfiles/
RUN cd dotfiles; ./install.sh desktop | tee ansible.log RUN cd dotfiles; echo "[desktop]\nlocalhost ansible_connection=local" > hosts
RUN cd dotfiles; ansible-playbook install.yml | tee ansible.log
RUN echo -e "test" | chsh -s '/usr/bin/zsh' RUN echo -e "test" | chsh -s '/usr/bin/zsh'
ENTRYPOINT /usr/bin/zsh ENTRYPOINT /usr/bin/zsh

@ -33,6 +33,7 @@ WORKDIR /home/test/
ENV LANG="fr_FR.UTF-8" ENV LANG="fr_FR.UTF-8"
RUN mkdir dotfiles RUN mkdir dotfiles
COPY . dotfiles/ COPY . dotfiles/
RUN cd dotfiles; ./install.sh server | tee ansible.log RUN cd dotfiles; echo "[server]\nlocalhost ansible_connection=local" > hosts
RUN cd dotfiles; ansible-playbook install.yml | tee ansible.log
RUN echo -e "dockerpass" | chsh -s /bin/zsh RUN echo -e "dockerpass" | chsh -s /bin/zsh
ENTRYPOINT /usr/bin/zsh ENTRYPOINT /usr/bin/zsh

@ -34,6 +34,7 @@ WORKDIR /home/test/
ENV LANG="fr_FR.UTF-8" ENV LANG="fr_FR.UTF-8"
RUN mkdir dotfiles RUN mkdir dotfiles
COPY . dotfiles/ COPY . dotfiles/
RUN cd dotfiles; ./install.sh server | tee ansible.log RUN cd dotfiles; echo "[server]\nlocalhost ansible_connection=local" > hosts
RUN cd dotfiles; ansible-playbook install.yml | tee ansible.log
RUN sudo chsh -s '/usr/bin/zsh' test RUN sudo chsh -s '/usr/bin/zsh' test
ENTRYPOINT /usr/bin/zsh ENTRYPOINT /usr/bin/zsh

7
hosts Normal file

@ -0,0 +1,7 @@
[server]
cesium ansible_user=root
neon ansible_user=root
[laptop]
osz ansible_user=user
work ansible_user=userarch

@ -1,36 +0,0 @@
#!/bin/bash
cd "$( dirname "${BASH_SOURCE[0]}" )"
command -v ansible-playbook >/dev/null 2>&1 || { echo >&2 "I require ansible but it's not installed. Aborting."; exit 1; }
if [[ -z ${1+x} ]]
then
echo "Please choose a tag to install as param:"
ansible-playbook -i "localhost," -c local install.yml --list-tags
exit 1
fi
echo "### LIST TASKS #################################################################"
ansible-playbook -i "localhost," -c local install.yml --list-tasks -t $1 | grep TAGS | egrep -v 'play|debug|include_role' | sed 's/\ *\(.*\)TAGS.*$/\1/'
echo "Do you want to dryrun ? (y/N)"
read ok
ok=${ok:-N}
if [[ "$ok" == "y" ]]
then
echo "### DRYRUN ###################################################################"
ansible-playbook -i "localhost," -c local install.yml --ask-become-pass -CD -t $1 || exit 1
fi
echo "Do you want to install ? (Y/n)"
read ok
ok=${ok:-Y}
if [[ "$ok" == "Y" ]]
then
echo "### RUN ####################################################################"
ansible-playbook -i "localhost," -c local install.yml --ask-become-pass -t $1 || exit 1
fi

@ -1,7 +1,6 @@
--- ---
- hosts: all - hosts: server
tags: server tags: limit
tasks: tasks:
- name: Limit to Archlinux/Debian/Centos/FreeBSD - name: Limit to Archlinux/Debian/Centos/FreeBSD
fail: fail:
@ -11,23 +10,20 @@
(ansible_distribution != "Archlinux") and (ansible_distribution != "Archlinux") and
(ansible_distribution != "FreeBSD") (ansible_distribution != "FreeBSD")
- hosts: all - hosts: desktop:laptop
tags: [ 'desktop', 'laptop' ] tags: limit
tasks: tasks:
- name: Limit to Archlinux - name: Limit to Archlinux
fail: fail:
msg: "{{ ansible_distribution }} is not supported with this tag." msg: "{{ ansible_distribution }} is not supported with this tag."
when: ansible_distribution != "Archlinux" when: ansible_distribution != "Archlinux"
- name: Limit to user account - name: Limit to user accounts
fail: fail:
msg: "Don't run as root." msg: "Don't run as root."
when: ansible_user_id == "root" when: ansible_user_id == "root"
- hosts: all - hosts: server:desktop:laptop
tags: [ 'server', 'laptop', 'desktop' ]
roles: roles:
- { role: packages-common, tags: packages-common } - { role: packages-common, tags: packages-common }
- { role: zsh, tags: zsh } - { role: zsh, tags: zsh }
@ -36,9 +32,7 @@
- { role: screen, tags: screen } - { role: screen, tags: screen }
- { role: authorized_keys, tags: authorized_keys } - { role: authorized_keys, tags: authorized_keys }
- hosts: all - hosts: desktop:laptop
tags: [ 'desktop', 'laptop' ]
roles: roles:
- { role: packages-desktop, tags: packages-desktop } - { role: packages-desktop, tags: packages-desktop }
- { role: cursor, tags: cursor } - { role: cursor, tags: cursor }
@ -51,16 +45,13 @@
- { role: termite, tags: termite } - { role: termite, tags: termite }
- { role: weechat, tags: weechat } - { role: weechat, tags: weechat }
- { role: ssh-agent, tags: ssh-agent } - { role: ssh-agent, tags: ssh-agent }
tasks: tasks:
- include_role: - include_role:
name: vagrant name: vagrant
when: ansible_user_id == "vagrant" when: ansible_user_id == "vagrant"
tags: vagrant tags: vagrant
- hosts: all - hosts: laptop
tags: laptop
roles: roles:
- { role: packages-laptop, tags: packages-laptop } - { role: packages-laptop, tags: packages-laptop }
- { role: xbindkeys, tags: xbindkeys } - { role: xbindkeys, tags: xbindkeys }

@ -5,29 +5,6 @@
- vim - vim
become: True become: True
- name : Install powerline [Centos]
pip: name={{item}} state=present
with_items:
- powerline-status
become: True
when: ansible_distribution == "CentOS"
- name : Install powerline [Archlinux]
pacman: name={{item}} state=present
with_items:
- powerline2
- powerline-vim
- powerline-fonts
become: True
when: ansible_os_family == "Archlinux"
- name : Install powerline [FreeBSD]
package: name={{item}} state=present
with_items:
- py27-powerline-status
become: True
when: ansible_os_family == "FreeBSD"
- name: Create .vim dirs - name: Create .vim dirs
file: path={{item}} state=directory file: path={{item}} state=directory
with_items: with_items:
@ -35,6 +12,16 @@
- ~/.vim/bundle - ~/.vim/bundle
- ~/.vim/autoload - ~/.vim/autoload
- name: Clone airline
git:
repo: https://github.com/vim-airline/vim-airline
dest: ~/.vim/bundle/vim-airline
- name: Clone airline-themes
git:
repo: https://github.com/vim-airline/vim-airline-themes
dest: ~/.vim/bundle/vim-airline-thmes
- name: Configure vim - name: Configure vim
template: src=templates/vimrc dest=~/.vimrc backup=yes template: src=templates/vimrc dest=~/.vimrc backup=yes

@ -20,10 +20,12 @@ autocmd VimEnter,Colorscheme * :hi MatchParen cterm=none ctermbg=white ctermfg=b
" remember last cursor place " remember last cursor place
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
" powerline " airline
set laststatus=2 let g:airline_powerline_fonts = 1
set t_Co=256 if !exists('g:airline_symbols')
let g:powerline_pycmd="py3" let g:airline_symbols = {}
{% if ansible_os_family == "FreeBSD" %} endif
set rtp+=/usr/local/lib/python2.7/site-packages/powerline/bindings/vim/ let g:airline_symbols.space = "\ua0"
{% endif %} "let g:airline#extensions#tabline#enabled = 1
"let g:airline#extensions#tabline#show_buffers = 0
let g:airline_theme = 'minimalist'

@ -45,6 +45,7 @@
- zsh-syntax-highlighting - zsh-syntax-highlighting
become: True become: True
when: ansible_distribution == "Debian" when: ansible_distribution == "Debian"
ignore_errors: True
- name: Configure zsh-syntax-highlighting repo [CentOS] - name: Configure zsh-syntax-highlighting repo [CentOS]
shell: creates=/etc/yum.repos.d/shells:zsh-users:zsh-syntax-highlighting.repo cd /etc/yum.repos.d/; wget https://download.opensuse.org/repositories/shells:zsh-users:zsh-syntax-highlighting/CentOS_7/shells:zsh-users:zsh-syntax-highlighting.repo shell: creates=/etc/yum.repos.d/shells:zsh-users:zsh-syntax-highlighting.repo cd /etc/yum.repos.d/; wget https://download.opensuse.org/repositories/shells:zsh-users:zsh-syntax-highlighting/CentOS_7/shells:zsh-users:zsh-syntax-highlighting.repo
@ -59,6 +60,7 @@
- zsh-syntax-highlighting - zsh-syntax-highlighting
become: True become: True
when: ansible_distribution != "Debian" when: ansible_distribution != "Debian"
ignore_errors: True
- name: Install oh-my-zsh - name: Install oh-my-zsh
shell: creates=~/.oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh) ||:" shell: creates=~/.oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh) ||:"

@ -50,7 +50,8 @@ Vagrant.configure("2") do |config|
cd /tmp cd /tmp
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=packer-git; makepkg PKGBUILD --install --needed --noconfirm curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=packer-git; makepkg PKGBUILD --install --needed --noconfirm
cd $HOME/dotfiles cd $HOME/dotfiles
./install.sh desktop && echo -e "vagrant\n/usr/bin/zsh" | chsh echo "[desktop]\nlocalhost ansible_connection=local" > hosts
ansible-playbook install.yml && echo -e "vagrant\n/usr/bin/zsh" | chsh
SCRIPT SCRIPT
config.vm.provision "shell", inline: $script, privileged: false config.vm.provision "shell", inline: $script, privileged: false

@ -39,7 +39,8 @@ Vagrant.configure("2") do |config|
touch ~/.vimrc; rm ~/.vimrc touch ~/.vimrc; rm ~/.vimrc
# EXEC # EXEC
cd $HOME/dotfiles cd $HOME/dotfiles
./install.sh server && echo -e "vagrant" | chsh -s /bin/zsh echo "[server]\nlocalhost ansible_connection=local" > hosts
ansible-playbook install.yml && echo -e "vagrant" | chsh -s /bin/zsh
SCRIPT SCRIPT
config.vm.provision "shell", inline: $script, privileged: false config.vm.provision "shell", inline: $script, privileged: false

@ -40,7 +40,8 @@ Vagrant.configure("2") do |config|
touch ~/.vimrc; rm ~/.vimrc touch ~/.vimrc; rm ~/.vimrc
# EXEC # EXEC
cd $HOME/dotfiles cd $HOME/dotfiles
./install.sh server && echo -e "vagrant\n/usr/bin/zsh" | chsh echo "[server]\nlocalhost ansible_connection=local" > hosts
ansible-playbook install.yml && echo -e "vagrant\n/usr/bin/zsh" | chsh
SCRIPT SCRIPT
config.vm.provision "shell", inline: $script, privileged: false config.vm.provision "shell", inline: $script, privileged: false

@ -28,7 +28,8 @@ Vagrant.configure("2") do |config|
touch ~/.vimrc; rm ~/.vimrc touch ~/.vimrc; rm ~/.vimrc
# EXEC # EXEC
cd $HOME/dotfiles cd $HOME/dotfiles
./install.sh server echo "[server]\nlocalhost ansible_connection=local" > hosts
ansible-playbook install.yml
#CHANGE SH LINE : chsh -s /usr/local/bin/zsh -p ?? how to use crypt #CHANGE SH LINE : chsh -s /usr/local/bin/zsh -p ?? how to use crypt
SCRIPT SCRIPT
config.vm.provision "shell", inline: $script, privileged: false config.vm.provision "shell", inline: $script, privileged: false