aboutsummaryrefslogtreecommitdiff
path: root/playbook.yml
diff options
context:
space:
mode:
Diffstat (limited to 'playbook.yml')
-rw-r--r--playbook.yml5
1 files changed, 5 insertions, 0 deletions
diff --git a/playbook.yml b/playbook.yml
index 6a4bdd5..298db81 100644
--- a/playbook.yml
+++ b/playbook.yml
@@ -5,9 +5,14 @@
- name: Create user
user: name={{ username }}
+ - name: Check for user key
+ stat: path=keys/{{ username }}.pub
+ register: user_key
+
- name: Upload user key
authorized_key: user={{ username }}
key="{{ item }}"
+ when: user_key.stat.exists
with_file:
- keys/{{ username }}.pub