1
0
Fork 0
mirror of https://github.com/eoli3n/dotfiles synced 2024-05-12 18:46:05 +02: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

View File

@ -39,7 +39,7 @@ Please check ``vagrant/*/README.md`` and ``docker/*/README.md``
## Desktop/Laptop Environment
Don't run as ``root``.
Don't use as ``root``.
### 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
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
@ -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
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

2
TODO
View File

@ -3,7 +3,6 @@
- borgbackup: install and configure role
- tmux: install and configure role
- 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
- playbook: update all vagrant specific task to match docker hosts
- playbook: test if tag limit exists
@ -12,7 +11,6 @@
# TOFIX
- 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
- vagrant: tty in qwerty for debian keyboard
- playbook: {{playbook_dir}} -> {{role_path}}

View File

@ -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 mkdir 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'
ENTRYPOINT /usr/bin/zsh

View File

@ -33,6 +33,7 @@ WORKDIR /home/test/
ENV LANG="fr_FR.UTF-8"
RUN mkdir 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
ENTRYPOINT /usr/bin/zsh

View File

@ -34,6 +34,7 @@ WORKDIR /home/test/
ENV LANG="fr_FR.UTF-8"
RUN mkdir 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
ENTRYPOINT /usr/bin/zsh

7
hosts Normal file
View File

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

View File

@ -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

View File

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

View File

@ -5,29 +5,6 @@
- vim
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
file: path={{item}} state=directory
with_items:
@ -35,6 +12,16 @@
- ~/.vim/bundle
- ~/.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
template: src=templates/vimrc dest=~/.vimrc backup=yes

View File

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

View File

@ -45,6 +45,7 @@
- zsh-syntax-highlighting
become: True
when: ansible_distribution == "Debian"
ignore_errors: True
- 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
@ -59,6 +60,7 @@
- zsh-syntax-highlighting
become: True
when: ansible_distribution != "Debian"
ignore_errors: True
- 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) ||:"

View File

@ -50,7 +50,8 @@ Vagrant.configure("2") do |config|
cd /tmp
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=packer-git; makepkg PKGBUILD --install --needed --noconfirm
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
config.vm.provision "shell", inline: $script, privileged: false

View File

@ -39,7 +39,8 @@ Vagrant.configure("2") do |config|
touch ~/.vimrc; rm ~/.vimrc
# EXEC
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
config.vm.provision "shell", inline: $script, privileged: false

View File

@ -40,7 +40,8 @@ Vagrant.configure("2") do |config|
touch ~/.vimrc; rm ~/.vimrc
# EXEC
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
config.vm.provision "shell", inline: $script, privileged: false

View File

@ -28,7 +28,8 @@ Vagrant.configure("2") do |config|
touch ~/.vimrc; rm ~/.vimrc
# EXEC
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
SCRIPT
config.vm.provision "shell", inline: $script, privileged: false