From d755786857491ff0c4515756f7b46bb827a3ae04 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 27 Dec 2017 14:32:59 +0100 Subject: [PATCH] littles fixes --- TODO | 50 ++++++++++++++++++++--------------- docker/debian/Dockerfile | 7 +++-- roles/zsh/templates/.zshrc | 6 +---- vagrant/archlinux/README.md | 15 +++++------ vagrant/archlinux/Vagrantfile | 12 ++++----- vagrant/centos/README.md | 37 ++++++++++++++++++++++++++ vagrant/centos/Vagrantfile | 22 ++++++++++----- vagrant/debian/README.md | 37 ++++++++++++++++++++++++++ vagrant/debian/Vagrantfile | 24 ++++++++++------- vagrant/freebsd/README.md | 37 ++++++++++++++++++++++++++ vagrant/freebsd/Vagrantfile | 6 +++-- 11 files changed, 191 insertions(+), 62 deletions(-) create mode 100644 vagrant/centos/README.md create mode 100644 vagrant/debian/README.md create mode 100644 vagrant/freebsd/README.md diff --git a/TODO b/TODO index 9587fc5..df4f6d2 100644 --- a/TODO +++ b/TODO @@ -1,23 +1,31 @@ -- TODO: borgbackup conf -- TODO: tmux and configure -- TOTEST: ansible provisionner vagrant : https://github.com/hashicorp/vagrant/issues/7890 -- TODO: change includes in import tasks to be able to resolv with list-tasks -- TOFIX: chsh in vagrant config file for FreeBSD -- TOTEST: powerlines -- TOTEST: vagrant centos locales fr ? -- TOTEST: configure root account ? -- TODO: check best install method all distrib powerline -- TODO: clean zshrc -- TODO: Ubuntu compat and vagrant for server tag -- TODO: Debian/Ubuntu/CentOS/FreeBSD compat and vagrant for desktop/laptop tag -- TODO: Add a tag "dotfiles", and pass every copy/templates/file with dest={{ dotsroot }} +# TODO + +- 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 + +# TOFIX + +- vagrant: chsh in vagrant config file for FreeBSD +- powerline: not working with centos|debian|freebsd +- zsh: clean zshrc template +- playbook: add {{ tag }} to fail module to print in "limit to distrib" task +- vagrant: tty in qwerty for debian keyboard + +# TOTEST + +- playbook: as root working ? + +# FEATURE IDEA + +- playbook: Add a tag "dotfiles", and pass every copy/templates/file with dest={{ dotsroot }} then : ansible-playbook localhost install.yml -t dotfiles -e 'dotsroot: tmp' to compile only dotfiles in an example dir ~/tmp ? what about lineinfile module ? -- TODO: Add {{ tag }} to fail module to limit to distrib -- TOFIX: get current branch to checkout in Dockerfile var - https://superuser.com/questions/701735/run-script-on-host-machine-during-vagrant-up - git symbolic-ref --short -q HEAD -- TODO: update all vagrant specific task to match docker tasks -- TODO: install virtual display xephyr -- TODO: docker autobuild to docker run directly, edit README.md -- TODO: grep -ri 'git clone', dynamic git branch ? +- vagrant: ansible provisionner -> https://github.com/hashicorp/vagrant/issues/7890 +- all: Ubuntu compat|docker|vagrant for server tag +- all: Debian|Ubuntu|CentOS|FreeBSD compat|docker|vagrant for desktop/laptop tag +- docker: install virtual display xephyr to use docker as vagrant +- docker: autobuild to docker run directly without building locally diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile index 14c92e8..fbd30eb 100644 --- a/docker/debian/Dockerfile +++ b/docker/debian/Dockerfile @@ -1,10 +1,10 @@ FROM debian:stable # Locales keyboard -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ +RUN apt-get update && apt-get install -y locales \ && localedef -i fr_FR -c -f UTF-8 -A /usr/share/locale/locale.alias fr_FR.UTF-8 ENV LANG fr_FR.UTF-8 # Debian Deps -RUN apt-get update && apt-get install -y \ +RUN apt-get install -y \ sudo \ binutils \ util-linux \ @@ -20,7 +20,7 @@ ENV PATH="${PATH}:/usr/bin/core_perl" # Project deps RUN echo 'deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main' >> /etc/apt/sources.list \ && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 -RUN apt-get update && apt-get install -y \ +RUN apt-get install -y \ ansible \ git # Create test user @@ -34,7 +34,6 @@ WORKDIR /home/test/ ENV LANG="fr_FR.UTF-8" RUN mkdir dotfiles COPY . dotfiles/ -RUN chown -R test:test dotfiles RUN cd dotfiles; ./install.sh server | tee ansible.log RUN sudo chsh -s '/usr/bin/zsh' test ENTRYPOINT /usr/bin/zsh diff --git a/roles/zsh/templates/.zshrc b/roles/zsh/templates/.zshrc index 117cc84..061f843 100644 --- a/roles/zsh/templates/.zshrc +++ b/roles/zsh/templates/.zshrc @@ -54,17 +54,13 @@ dupkg() { expac '%m\t%n' | sort -h | awk '{cmd = "numfmt --to=si "$1; cmd | getl dupkg_ex() { expac -H M "%011m\t%-20n\t%10d" $(comm -23 <(pacman -Qqen | sort) <(pacman -Qqg base base-devel | sort)) | sort -n } ### EXPORTS +export LANG='fr_FR.UTF-8' export EDITOR='vim' export VISUAL='vim' export BROWSER='google-chrome-stable' export POWERLINE_CONFIG_COMMAND='powerline-config' export PAGER='most' -if [[ $TERM == xterm-termite ]] && [[ -z "$SSH_CLIENT" ]] || [[ -z "$SSH_TTY" ]]; then - . /etc/profile.d/vte.sh - __vte_osc7 -fi - ### ZSHRC NODE source ~/.zshrc_node diff --git a/vagrant/archlinux/README.md b/vagrant/archlinux/README.md index 84ae289..ffc6877 100644 --- a/vagrant/archlinux/README.md +++ b/vagrant/archlinux/README.md @@ -1,12 +1,7 @@ -https://asciinema.org/a/BHA2aFe0yq9vbBuEx5QCFPhKx?speed=5 -[![asciicast](https://asciinema.org/a/BHA2aFe0yq9vbBuEx5QCFPhKx.png)](https://asciinema.org/a/BHA2aFe0yq9vbBuEx5QCFPhKx?speed=5&autoplay=1) - # Dependencies - Vagrant - Virtualbox -- 900M free on $HOME for Archlinux vagrant box ``~/.vagrant.d/boxes/terrywang-VAGRANTSLASH-archlinux`` -- \~6G free on $HOME for Archlinux virtualbox VM ``~/VirtualBox\ VMs/archlinux_dotfiles`` # Provision @@ -15,13 +10,14 @@ This is fully automatised ``` git clone --recursive https://github.com/eoli3n/dotfiles cd dotfiles -cd vagrant/archlinux +git checkout +cd vagrant/ vagrant up ``` # Test -- Launch virtualbox GUI, open ``archlinux-dotfiles`` VM +- Launch virtualbox GUI, open VM - Login in TTY - Login : ``vagrant`` - Password : ``vagrant`` @@ -31,10 +27,11 @@ vagrant up - Suppress Virtualbox VM ``` -cd ~/dotfiles/vagrant/archlinux +cd ~/dotfiles/vagrant/ vagrant destroy ``` - Suppress Vagrant box ``` -vagrant box remove terrywang/archlinux +vagrant box list +vagrant box remove ``` diff --git a/vagrant/archlinux/Vagrantfile b/vagrant/archlinux/Vagrantfile index 909ab21..da3f292 100644 --- a/vagrant/archlinux/Vagrantfile +++ b/vagrant/archlinux/Vagrantfile @@ -36,21 +36,21 @@ Vagrant.configure("2") do |config| # DEPS pacman -S ansible jshon --noconfirm pacman -R cowsay --noconfirm || : + # DOTFILES DIR + mkdir -p /home/vagrant/dotfiles SHELL + config.vm.synced_folder "../../", "/home/vagrant/dotfiles/", type: "rsync", rsync__exclude: [".git/", ".vagrant.d/"] + $script = <<-SCRIPT # PREP touch ~/.viminfo; rm ~/.viminfo touch ~/.vimrc; rm ~/.vimrc # EXEC - git clone --recursive https://github.com/eoli3n/dotfiles - cd dotfiles - git submodule update --init --recursive cd /tmp curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=packer-git; makepkg PKGBUILD --install --needed --noconfirm - cd - - ./install.sh desktop - echo -e "vagrant\n/usr/bin/zsh" | chsh + cd dotfiles + ./install.sh desktop && echo -e "vagrant\n/usr/bin/zsh" | chsh SCRIPT config.vm.provision "shell", inline: $script, privileged: false diff --git a/vagrant/centos/README.md b/vagrant/centos/README.md new file mode 100644 index 0000000..ffc6877 --- /dev/null +++ b/vagrant/centos/README.md @@ -0,0 +1,37 @@ +# Dependencies + +- Vagrant +- Virtualbox + +# Provision + +This is fully automatised + +``` +git clone --recursive https://github.com/eoli3n/dotfiles +cd dotfiles +git checkout +cd vagrant/ +vagrant up +``` + +# Test + +- Launch virtualbox GUI, open VM +- Login in TTY + - Login : ``vagrant`` + - Password : ``vagrant`` +- ``startx`` + +# Clean after test + +- Suppress Virtualbox VM +``` +cd ~/dotfiles/vagrant/ +vagrant destroy +``` +- Suppress Vagrant box +``` +vagrant box list +vagrant box remove +``` diff --git a/vagrant/centos/Vagrantfile b/vagrant/centos/Vagrantfile index c4437d7..35683c3 100644 --- a/vagrant/centos/Vagrantfile +++ b/vagrant/centos/Vagrantfile @@ -3,6 +3,7 @@ Vagrant.configure("2") do |config| config.vm.box = "centos/7" + config.vm.hostname = "centos" config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine @@ -15,21 +16,30 @@ Vagrant.configure("2") do |config| end config.vm.provision "shell", inline: <<-SHELL + # LOCALES + sed -i 's/^\(override_install_langs.*\)$/#\1/' /etc/yum.conf + yum -y -q reinstall glibc-common + echo 'LANG="fr_FR.UTF-8"' > /etc/locale.conf + source /etc/locale.conf + # KEYBOARD + loadkeys fr + localectl set-keymap fr + localectl set-x11-keymap fr + # DEPS yum install ansible git -y - echo "centos" > /etc/hostname - hostname centos + # DOTFILES DIR + mkdir -p /home/vagrant/dotfiles SHELL + config.vm.synced_folder "../../", "/home/vagrant/dotfiles/", type: "rsync", rsync__exclude: [".git/", ".vagrant.d/"] + $script = <<-SCRIPT # PREP touch ~/.viminfo; rm ~/.viminfo touch ~/.vimrc; rm ~/.vimrc # EXEC - git clone --recursive https://github.com/eoli3n/dotfiles cd dotfiles - git submodule update --init --recursive - ./install.sh server - echo -e "vagrant" | chsh -s /bin/zsh + ./install.sh server && echo -e "vagrant" | chsh -s /bin/zsh SCRIPT config.vm.provision "shell", inline: $script, privileged: false diff --git a/vagrant/debian/README.md b/vagrant/debian/README.md new file mode 100644 index 0000000..ffc6877 --- /dev/null +++ b/vagrant/debian/README.md @@ -0,0 +1,37 @@ +# Dependencies + +- Vagrant +- Virtualbox + +# Provision + +This is fully automatised + +``` +git clone --recursive https://github.com/eoli3n/dotfiles +cd dotfiles +git checkout +cd vagrant/ +vagrant up +``` + +# Test + +- Launch virtualbox GUI, open VM +- Login in TTY + - Login : ``vagrant`` + - Password : ``vagrant`` +- ``startx`` + +# Clean after test + +- Suppress Virtualbox VM +``` +cd ~/dotfiles/vagrant/ +vagrant destroy +``` +- Suppress Vagrant box +``` +vagrant box list +vagrant box remove +``` diff --git a/vagrant/debian/Vagrantfile b/vagrant/debian/Vagrantfile index 4fed42d..1594ba4 100644 --- a/vagrant/debian/Vagrantfile +++ b/vagrant/debian/Vagrantfile @@ -3,7 +3,7 @@ Vagrant.configure("2") do |config| config.vm.box = "debian/jessie64" - + config.vm.hostname = "debian" config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine #vb.gui = true @@ -15,26 +15,32 @@ Vagrant.configure("2") do |config| end config.vm.provision "shell", inline: <<-SHELL + # LOCALES + apt-get update && apt-get install -y locales + localedef -i fr_FR -c -f UTF-8 -A /usr/share/locale/locale.alias fr_FR.UTF-8 + echo 'LANG="fr_FR.UTF-8"' > /etc/locale.conf + # KEYBOARD + loadkeys fr + localectl set-keymap fr + localectl set-x11-keymap fr + # DEPS echo 'deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main' >> /etc/apt/sources.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 apt update apt install git ansible -y - # HOSTNAME - echo "debian" > /etc/hostname - echo "127.0.0.1 localhost localhost.localdomain debian" > /etc/hosts - hostname debian + # DOTFILES DIR + mkdir -p /home/vagrant/dotfiles SHELL + config.vm.synced_folder "../../", "/home/vagrant/dotfiles/", type: "rsync", rsync__exclude: [".git/", ".vagrant.d/"] + $script = <<-SCRIPT # PREP touch ~/.viminfo; rm ~/.viminfo touch ~/.vimrc; rm ~/.vimrc # EXEC - git clone --recursive https://github.com/eoli3n/dotfiles cd dotfiles - git submodule update --init --recursive - ./install.sh server - echo -e "vagrant\n/usr/bin/zsh" | chsh + ./install.sh server && echo -e "vagrant\n/usr/bin/zsh" | chsh SCRIPT config.vm.provision "shell", inline: $script, privileged: false diff --git a/vagrant/freebsd/README.md b/vagrant/freebsd/README.md new file mode 100644 index 0000000..ffc6877 --- /dev/null +++ b/vagrant/freebsd/README.md @@ -0,0 +1,37 @@ +# Dependencies + +- Vagrant +- Virtualbox + +# Provision + +This is fully automatised + +``` +git clone --recursive https://github.com/eoli3n/dotfiles +cd dotfiles +git checkout +cd vagrant/ +vagrant up +``` + +# Test + +- Launch virtualbox GUI, open VM +- Login in TTY + - Login : ``vagrant`` + - Password : ``vagrant`` +- ``startx`` + +# Clean after test + +- Suppress Virtualbox VM +``` +cd ~/dotfiles/vagrant/ +vagrant destroy +``` +- Suppress Vagrant box +``` +vagrant box list +vagrant box remove +``` diff --git a/vagrant/freebsd/Vagrantfile b/vagrant/freebsd/Vagrantfile index 75364a5..726e500 100644 --- a/vagrant/freebsd/Vagrantfile +++ b/vagrant/freebsd/Vagrantfile @@ -16,16 +16,18 @@ Vagrant.configure("2") do |config| ln -s /usr/local/bin/python2 /usr/bin/python echo 'hostname="freebsd"' >> /etc/rc.conf hostname freebsd + # DOTFILES DIR + mkdir -p /home/vagrant/dotfiles SHELL + config.vm.synced_folder "../../", "/home/vagrant/dotfiles/", type: "rsync", rsync__exclude: [".git/", ".vagrant.d/"] + $script = <<-SCRIPT # PREP touch ~/.viminfo; rm ~/.viminfo touch ~/.vimrc; rm ~/.vimrc # EXEC - git clone --recursive https://github.com/eoli3n/dotfiles cd dotfiles - git submodule update --init --recursive ./install.sh server #CHANGE SH LINE : chsh -s /usr/local/bin/zsh -p ?? how to use crypt SCRIPT