summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-01-12 05:17:51 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-01-12 05:17:51 +0100
commit291b63ffbe2dc34b23b9c9cad7c1dfbe25f61603 (patch)
treecccc9d17ce811ca98d5a67a15a23306df55abe0e /roles
parentadded https for elevate media server (diff)
dyndns/client: minor cleanup
Diffstat (limited to 'roles')
-rw-r--r--roles/dyndns/client/defaults/main.yml2
-rw-r--r--roles/dyndns/client/tasks/main.yml8
-rw-r--r--roles/dyndns/client/templates/dyndns.service.j24
-rw-r--r--roles/dyndns/client/templates/ssh_config.j26
4 files changed, 11 insertions, 9 deletions
diff --git a/roles/dyndns/client/defaults/main.yml b/roles/dyndns/client/defaults/main.yml
new file mode 100644
index 00000000..4c633305
--- /dev/null
+++ b/roles/dyndns/client/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+dyndns_client_id: "{{ hostvars[dyndns.server].dyndns.clients[inventory_hostname] }}"
diff --git a/roles/dyndns/client/tasks/main.yml b/roles/dyndns/client/tasks/main.yml
index 81f74936..ad470dad 100644
--- a/roles/dyndns/client/tasks/main.yml
+++ b/roles/dyndns/client/tasks/main.yml
@@ -11,12 +11,12 @@
register: dyndns_user
- name: install ssh key on server
- delegate_to: "{{ dyndns_server }}"
+ delegate_to: "{{ dyndns.server }}"
lineinfile:
path: /var/lib/dyndns/.ssh/authorized_keys
mode: 0600
- regexp: 'command="/usr/local/bin/dyndns.py {{ dyndns_client_name }}"'
- line: 'no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding,no-user-rc,command="/usr/local/bin/dyndns.py {{ dyndns_client_name }}" {{ dyndns_user.ssh_public_key }}'
+ regexp: 'command="/usr/local/bin/dyndns.py {{ dyndns_client_id }}"'
+ line: 'no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding,no-user-rc,command="/usr/local/bin/dyndns.py {{ dyndns_client_id }}" {{ dyndns_user.ssh_public_key }}'
- name: install ssh config
template:
@@ -28,7 +28,7 @@
## TODO: fix me!!!
- name: hack to make known_hosts work (1/2)
- command: "ssh-keyscan -p {{ hostvars[dyndns_server].ansible_port }} {{ hostvars[dyndns_server].host_name }}.{{ hostvars[dyndns_server].host_domain }}"
+ command: "ssh-keyscan -p {{ hostvars[dyndns.server].ansible_port }} {{ hostvars[dyndns.server].host_name }}.{{ hostvars[dyndns.server].host_domain }}"
args:
creates: /var/lib/dyndns/.ssh/known_hosts
changed_when: False
diff --git a/roles/dyndns/client/templates/dyndns.service.j2 b/roles/dyndns/client/templates/dyndns.service.j2
index 31a430ee..7997a8ea 100644
--- a/roles/dyndns/client/templates/dyndns.service.j2
+++ b/roles/dyndns/client/templates/dyndns.service.j2
@@ -1,9 +1,9 @@
[Unit]
-Description=Update dyndns using {{ hostvars[dyndns_server].host_name }}.{{ hostvars[dyndns_server].host_domain }}
+Description=Update dyndns using {{ hostvars[dyndns.server].host_name }}.{{ hostvars[dyndns.server].host_domain }}
[Service]
Type=oneshot
-ExecStart=/usr/bin/ssh {{ hostvars[dyndns_server].host_name }}.{{ hostvars[dyndns_server].host_domain }} {{ dyndns_client_name }}
+ExecStart=/usr/bin/ssh {{ hostvars[dyndns.server].host_name }}.{{ hostvars[dyndns.server].host_domain }} {{ dyndns_client_id }}
User=dyndns
Group=dyndns
Nice=19
diff --git a/roles/dyndns/client/templates/ssh_config.j2 b/roles/dyndns/client/templates/ssh_config.j2
index fd15bc49..24a1b2a6 100644
--- a/roles/dyndns/client/templates/ssh_config.j2
+++ b/roles/dyndns/client/templates/ssh_config.j2
@@ -1,6 +1,6 @@
-Host {{ hostvars[dyndns_server].host_name }}.{{ hostvars[dyndns_server].host_domain }}
- Port {{ hostvars[dyndns_server].ansible_port }}
- User {{ hostvars[dyndns_server].user | default('dyndns') }}
+Host {{ hostvars[dyndns.server].host_name }}.{{ hostvars[dyndns.server].host_domain }}
+ Port {{ hostvars[dyndns.server].ansible_port }}
+ User {{ hostvars[dyndns.server].user | default('dyndns') }}
IdentityFile {{ dyndns_user.ssh_key_file }}
IdentitiesOnly yes
PasswordAuthentication no