# HG changeset patch # User Meredith Howard # Date 1460564422 14400 # Node ID f468e5f566d1517f34afac0b0fd1a8ad16ac4007 # Parent 9b3befb1c773b61b35b31deb5ab8676e2a1b361c break out dotfiles playbook and enable agent forwarding diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,2 @@ +[ssh_connection] +ssh_args=-o ForwardAgent=yes diff --git a/dotfiles.yml b/dotfiles.yml new file mode 100644 --- /dev/null +++ b/dotfiles.yml @@ -0,0 +1,32 @@ +--- +- hosts: devbox + gather_facts: false + tasks: + - name: Clone dotfiles + become_user: "{{user.name}}" + shell: > + hg clone -U {{dotfiles_repository | quote}} _dotfiles_ + && mv _dotfiles_/.hg . + && rmdir _dotfiles_ + && hg -R ~ update -C + args: + chdir: "~" + creates: "~/.hg" + + - name: Update dotfiles + become_user: "{{user.name}}" + command: hg pull -u + args: + chdir: "~" + register: update_dotfiles + changed_when: update_dotfiles.stdout | match("added|updated") + failed_when: update_dotfiles.rc > 1 + + - name: Run homedir-setup + become_user: "{{user.name}}" + shell: bin/homedir-setup + args: + chdir: "~" + register: homedir_setup + changed_when: homedir_setup.stdout | match("Updating|Cloning") + failed_when: homedir_setup.rc != 0