aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--roles/sshdns/tasks/main.yml18
1 files changed, 16 insertions, 2 deletions
diff --git a/roles/sshdns/tasks/main.yml b/roles/sshdns/tasks/main.yml
index 0942e68..30cc958 100644
--- a/roles/sshdns/tasks/main.yml
+++ b/roles/sshdns/tasks/main.yml
@@ -4,13 +4,27 @@
---
+- name: get real user
+ shell: logname
+ register: sshdns_user
+ delegate_to: localhost
+
+- name: parse real username
+ set_fact:
+ sshdns_user: "{{ sshdns_user.stdout }}"
+
- name: create config directory
file:
- path: "{{ lookup('env', 'HOME') }}/.ssh/config.d"
+ #path: "{{ lookup('env', 'HOME') }}/.ssh/config.d"
+ path: "/home/{{ sshdns_user }}/.ssh/config.d"
state: directory
mode: 0700
+ become: true
+ become_user: "{{ sshdns_user }}"
- name: Generate template to localhost
template:
src: templates/generate_dns.j2
- dest: "{{ lookup('env', 'HOME') }}/.ssh/config.d/ssh_dns"
+ dest: "/home/{{ sshdns_user }}//.ssh/config.d/ssh_dns"
+ become: true
+ become_user: "{{ sshdns_user }}"
remember that computers suck.