dotfiles.yml

Wed, 13 Apr 2016 12:34:57 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 13 Apr 2016 12:34:57 -0400
changeset 33
55dd06908d87
parent 30
f468e5f566d1
child 43
31d5f9b7cff2
permissions
-rw-r--r--

Add become

---
- 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

mercurial