roles/user/tasks/main.yml

changeset 28
6f7483dfe742
parent 17
d0d9fdf1f9d3
child 29
9b3befb1c773
--- a/roles/user/tasks/main.yml
+++ b/roles/user/tasks/main.yml
@@ -1,5 +1,4 @@
 ---
-
 # Create/update my user, don't clobber my extra groups.
 - name: User setup
   user:
@@ -11,7 +10,7 @@
   register: user
   tags: user
 
-- name: ssh | Pubkey for user
+- name: ssh : Pubkey for user
   authorized_key:
     manage_dir: true
     user: "{{user.name}}"
@@ -20,7 +19,7 @@
     - public_keys/{{user.name}}
   tags: user, ssh
 
-- name: ssh | Ensure known_hosts keys
+- name: ssh : Ensure known_hosts keys
   become: true
   become_user: "{{user.name}}"
   lineinfile:
@@ -32,7 +31,7 @@
   with_dict: "{{hostkeys}}"
   tags: user, ssh
 
-- name: ssh | Purge invalid known_hosts keys
+- name: ssh : Purge invalid known_hosts keys
   become: true
   become_user: "{{user.name}}"
   lineinfile:
@@ -46,19 +45,15 @@
 # I like to make my ~ my dotfiles working directory (some folks symlink
 # everything) Here that means I clone, move hg, then checkout, clobbering any
 # conflicts with /etc/skel stuff.
-- name: Check for dotfiles checkout in homedir
-  stat: path={{user.home}}/.hg
-  register: dotfiles
-  tags: user, dotfiles
-
 - name: Clone dotfiles
-  when: dotfiles.stat.exists == false
   shell: >
     hg clone -U {{dotfiles_repository}} {{user.home}}/_dotfiles_
     && mv {{user.home}}/_dotfiles_/.hg {{user.home}}
     && rmdir {{user.home}}/_dotfiles_
     && chown -R {{user.name}}:{{user.group}} {{user.home}}/.hg
     && sudo -u {{user.name}} hg -R {{user.home}} update -C
+  args:
+    create: "{{user.home}}/.hg"
   tags: user, dotfiles
 
 
@@ -67,9 +62,10 @@
 - name: Run homedir-setup
   become: true
   become_user: "{{user.name}}"
-  shell: bin/homedir-setup chdir={{user.home}}
+  shell: bin/homedir-setup
+  args:
+    chdir: "{{user.home}}"
   register: homedir_setup
   changed_when: homedir_setup.stdout | match("Updating|Cloning")
   failed_when: homedir_setup.rc != 0
   tags: user, install
-

mercurial