Make sure ../backupninja/.ssh/ dir exists bafore updating keys
At the moment we ensure that home directory '../backupninja/' exists
before populating '../backupninja/.ssh/authorized_keys. This patch
makes sure we created '../backupninja/.ssh/' as task that populates
authorized_keys file require .ssh dir to be present.
Change-Id: I680775ff123e69df2bd5987ca5b162b1e3fa7296
Related-Prod: PROD-18986
diff --git a/backupninja/server.sls b/backupninja/server.sls
index 3d09e97..58bf986 100644
--- a/backupninja/server.sls
+++ b/backupninja/server.sls
@@ -21,6 +21,14 @@
- user: backupninja_user
- pkg: backupninja_server_packages
+{{ server.home_dir }}/.ssh:
+ file.directory:
+ - mode: 700
+ - user: backupninja
+ - group: backupninja
+ - require:
+ - file: {{ server.home_dir }}
+
{{ server.home_dir }}/.ssh/authorized_keys:
file.managed:
- user: backupninja
@@ -29,6 +37,7 @@
- source: salt://backupninja/files/authorized_keys
- require:
- file: {{ server.home_dir }}
+ - file: {{ server.home_dir }}/.ssh
{%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %}
@@ -50,4 +59,4 @@
{%- endfor %}
-{%- endif %}
\ No newline at end of file
+{%- endif %}