From f3e4b1dbc056ad980ff1dc09c8760cd1efbc21b2 Mon Sep 17 00:00:00 2001 From: Nils Gerstner Date: Mon, 27 Mar 2023 16:28:55 +0200 Subject: [PATCH] Use git repositories as source --- install.sh | 8 ++++++-- tasks/dotfiles.yml | 39 ++++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/install.sh b/install.sh index e2e40e1..68e5b0e 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/usr/bin/bash SUDO="sudo" -WORKDIR="/tmp/ansible" +WORKDIR="/tmp/ansible_setup" if [ "$(whoami)" == "root" ]; then SUDO="" @@ -14,9 +14,13 @@ fail() { if ! which ansible-playbook; then ${SUDO} apt update - ${SUDO} apt install -y ansible || fail "Failed to install ansible!" + ${SUDO} apt install -y ansible wget || fail "Failed to install ansible!" fi +cd /tmp +wget https://git.gerstner.se/nils/ansible_setup/archive/main.zip +unzip main.zip + cd ${WORKDIR} || fail "Could not change to work directory!" ansible-playbook local.yml || fail "Failed to execute ansible playbook" # ansible-playbook all.yml || fail "Failed to execute ansible playbook" diff --git a/tasks/dotfiles.yml b/tasks/dotfiles.yml index a977fb6..0ffae03 100644 --- a/tasks/dotfiles.yml +++ b/tasks/dotfiles.yml @@ -30,31 +30,32 @@ - dotfiles - productivity -# - name: Clone the dotfiles repository -# git: -# repo: https://gitlab.com/bhavin192/dotfiles.git -# dest: ~/dotfiles -# when: st.stat.islnk is not defined -# tags: -# - install -# - dotfiles -# - productivity - -- name: Move dotfiles to dest folder - ansible.builtin.copy: - src: /tmp/ansible/dotfiles - dest: ~/ - remote_src: yes - owner: root - group: root - # mode: u+rw,g-wx,o-rwx - # validate: /usr/sbin/visudo -csf %s +- name: Clone the dotfiles repository + git: + repo: https://git.gerstner.se/nils/ansible_dotfiles.git + dest: ~/dotfiles + when: st.stat.islnk is not defined tags: - git - install - dotfiles - productivity +# - name: Move dotfiles to dest folder +# ansible.builtin.copy: +# src: /tmp/ansible/dotfiles +# dest: ~/ +# remote_src: yes +# owner: root +# group: root +# # mode: u+rw,g-wx,o-rwx +# # validate: /usr/sbin/visudo -csf %s +# tags: +# - git +# - install +# - dotfiles +# - productivity + - name: Stow the dotfiles shell: | stow --verbose 2 --dir "${HOME}/dotfiles" --target "${HOME}" .