Use git repositories as source

main
Nils Gerstner 2 years ago
parent 69e55a3fcb
commit f3e4b1dbc0

@ -1,6 +1,6 @@
#!/usr/bin/bash #!/usr/bin/bash
SUDO="sudo" SUDO="sudo"
WORKDIR="/tmp/ansible" WORKDIR="/tmp/ansible_setup"
if [ "$(whoami)" == "root" ]; then if [ "$(whoami)" == "root" ]; then
SUDO="" SUDO=""
@ -14,9 +14,13 @@ fail() {
if ! which ansible-playbook; then if ! which ansible-playbook; then
${SUDO} apt update ${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 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!" cd ${WORKDIR} || fail "Could not change to work directory!"
ansible-playbook local.yml || fail "Failed to execute ansible playbook" ansible-playbook local.yml || fail "Failed to execute ansible playbook"
# ansible-playbook all.yml || fail "Failed to execute ansible playbook" # ansible-playbook all.yml || fail "Failed to execute ansible playbook"

@ -30,31 +30,32 @@
- dotfiles - dotfiles
- productivity - productivity
# - name: Clone the dotfiles repository - name: Clone the dotfiles repository
# git: git:
# repo: https://gitlab.com/bhavin192/dotfiles.git repo: https://git.gerstner.se/nils/ansible_dotfiles.git
# dest: ~/dotfiles dest: ~/dotfiles
# when: st.stat.islnk is not defined 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
tags: tags:
- git - git
- install - install
- dotfiles - dotfiles
- productivity - 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 - name: Stow the dotfiles
shell: | shell: |
stow --verbose 2 --dir "${HOME}/dotfiles" --target "${HOME}" . stow --verbose 2 --dir "${HOME}/dotfiles" --target "${HOME}" .

Loading…
Cancel
Save