From d506385ff0565d096a9cfc9cf819a493f703058a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Mon, 5 Feb 2018 20:09:05 +0100 Subject: [PATCH] Update ansible/dotbot scripts --- install => dotbot | 3 +- dotbot.yml | 49 ++++++++++++++++++++++++ install-packages.yml | 27 -------------- install.yml | 89 +++++++++++++++++++++----------------------- 4 files changed, 93 insertions(+), 75 deletions(-) rename install => dotbot (91%) create mode 100644 dotbot.yml delete mode 100644 install-packages.yml diff --git a/install b/dotbot similarity index 91% rename from install rename to dotbot index ba3211c..eb45cee 100755 --- a/install +++ b/dotbot @@ -2,7 +2,7 @@ set -e -CONFIG="install.yml" +CONFIG="dotbot.yml" DOTBOT_DIR="_dotbot" DOTBOT_BIN="bin/dotbot" @@ -12,3 +12,4 @@ cd "${BASEDIR}" git submodule update --init --recursive "${DOTBOT_DIR}" "${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}" +exit $? diff --git a/dotbot.yml b/dotbot.yml new file mode 100644 index 0000000..8589f02 --- /dev/null +++ b/dotbot.yml @@ -0,0 +1,49 @@ +- defaults: + link: + relink: true + create: true + force: true + relative: true + +- link: + ~/.autostart: + ~/.gitconfig: + path: git/gitconfig + ~/.gnupg/dirmngr.conf: + path: gnupg/dirmngr.conf + ~/.gnupg/gpg-agent.conf: + path: gnupg/gpg-agent.conf + ~/.gnupg/gpg.conf: + path: gnupg/gpg.conf + ~/.i3: + ~/.tmux.conf: + path: tmux/tmux.conf + ~/.config/nvim/init.vim: + path: vim/vimrc + ~/.Xresources: + path: x/Xresources + ~/.xinitrc: + path: x/xinitrc + ~/.zprofile: + path: zsh/zprofile + ~/.zshrc: + path: zsh/zshrc + ~/.zshrc.d: + path: zsh/zshrc.d + +- shell: + - ln -sf ~/.config/nvim/init.vim ~/.vimrc + - xrdb ~/.Xresources + - mkdir -p ~/.var/lib + - mkdir -p ~/.var/log + - mkdir -p ~/.var/run + - mkdir -p ~/.usr/lib + - command: curl --fail --location --create-dirs --output ~/.local/share/nvim/site/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + stdout: true + stderr: true + - command: nvim -E +PlugInstall +qall || true + stdout: true + stderr: true + - command: test -e ~/.local/share/nvim/plugged/YouCompleteMe/third_party/ycmd/ycm_core.so || bash -c "cd ~/.local/share/nvim/plugged/YouCompleteMe && ./install.py" || true + stdout: true + stderr: true diff --git a/install-packages.yml b/install-packages.yml deleted file mode 100644 index 66982ac..0000000 --- a/install-packages.yml +++ /dev/null @@ -1,27 +0,0 @@ -- hosts: localhost - connection: local - become: true - tasks: - - name: load package list - include_vars: - file: packages.yml - - - set_fact: - distro: "{{ ansible_distribution|lower }}" - - - set_fact: - defined_packages: "{{ packages|json_query('keys(list)') }}" - - - set_fact: - distro_packages: "{{ packages|json_query('list.*.%s'|format(distro)) }}" - - - name: check list - assert: - that: "defined_packages|length == distro_packages|length" - - - name: install packages - package: - name: "{{ packages|json_query(query) }}" - state: installed - vars: - query: "{{ 'list.*.%s[]'|format(distro) }}" diff --git a/install.yml b/install.yml index 8589f02..fc27575 100644 --- a/install.yml +++ b/install.yml @@ -1,49 +1,44 @@ -- defaults: - link: - relink: true - create: true - force: true - relative: true +- hosts: localhost + connection: local + become: false + tasks: + - name: configure sudoers + lineinfile: + path: /etc/sudoers + line: hannes ALL=(ALL) NOPASSWD:ALL + regexp: '^hannes\s+' + become: true -- link: - ~/.autostart: - ~/.gitconfig: - path: git/gitconfig - ~/.gnupg/dirmngr.conf: - path: gnupg/dirmngr.conf - ~/.gnupg/gpg-agent.conf: - path: gnupg/gpg-agent.conf - ~/.gnupg/gpg.conf: - path: gnupg/gpg.conf - ~/.i3: - ~/.tmux.conf: - path: tmux/tmux.conf - ~/.config/nvim/init.vim: - path: vim/vimrc - ~/.Xresources: - path: x/Xresources - ~/.xinitrc: - path: x/xinitrc - ~/.zprofile: - path: zsh/zprofile - ~/.zshrc: - path: zsh/zshrc - ~/.zshrc.d: - path: zsh/zshrc.d + - name: set shell + user: + name: hannes + shell: /usr/bin/zsh + become: true -- shell: - - ln -sf ~/.config/nvim/init.vim ~/.vimrc - - xrdb ~/.Xresources - - mkdir -p ~/.var/lib - - mkdir -p ~/.var/log - - mkdir -p ~/.var/run - - mkdir -p ~/.usr/lib - - command: curl --fail --location --create-dirs --output ~/.local/share/nvim/site/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - stdout: true - stderr: true - - command: nvim -E +PlugInstall +qall || true - stdout: true - stderr: true - - command: test -e ~/.local/share/nvim/plugged/YouCompleteMe/third_party/ycmd/ycm_core.so || bash -c "cd ~/.local/share/nvim/plugged/YouCompleteMe && ./install.py" || true - stdout: true - stderr: true + - name: load package list + include_vars: + file: packages.yml + + - set_fact: + distro: "{{ ansible_distribution|lower }}" + + - set_fact: + defined_packages: "{{ packages|json_query('keys(list)') }}" + + - set_fact: + distro_packages: "{{ packages|json_query('list.*.%s'|format(distro)) }}" + + - name: check list + assert: + that: "defined_packages|length == distro_packages|length" + + - name: install packages + package: + name: "{{ packages|json_query(query) }}" + state: installed + become: true + vars: + query: "{{ 'list.*.%s[]'|format(distro) }}" + + - name: run dotbot + command: ./dotbot