From faab5aede0806803e277f2675587bc051a485a9a Mon Sep 17 00:00:00 2001
From: Andrea Dell'Amico <adellam@sevenseas.org>
Date: Wed, 27 Feb 2019 19:54:06 +0100
Subject: [PATCH] Fix the vpn client variables.

---
 openvpn/tasks/openvpn.yml | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/openvpn/tasks/openvpn.yml b/openvpn/tasks/openvpn.yml
index 4155147..d050ba7 100644
--- a/openvpn/tasks/openvpn.yml
+++ b/openvpn/tasks/openvpn.yml
@@ -103,13 +103,15 @@
     - name: Get the dh file from the master host
       synchronize:
         src: '{{ openvpn_conf_dir }}/dh2048.pem'
-        dest: 'rsync://root@{{ ansible_fqdn }}/{{ openvpn_conf_dir }}/dh2048.pem'
+        #dest: 'rsync://root@{{ ansible_fqdn }}/{{ openvpn_conf_dir }}/dh2048.pem'
+        dest: '/{{ openvpn_conf_dir }}/dh2048.pem'
       delegate_to: '{{ openvpn_master_host }}'
       
     - name: Get the ta key from the master host
       synchronize:
         src: '{{ openvpn_conf_dir }}/ta.key'
-        dest: 'rsync://root@{{ ansible_fqdn }}/{{ openvpn_conf_dir }}/ta.key'
+        #dest: 'rsync://root@{{ ansible_fqdn }}/{{ openvpn_conf_dir }}/ta.key'
+        dest: '/{{ openvpn_conf_dir }}/ta.key'
       delegate_to: '{{ openvpn_master_host }}'
 
   when:
@@ -117,6 +119,24 @@
     - not openvpn_is_master_host
   tags: [ 'openvpn', 'openvpn_conf', 'openvpn_shared_secrets' ]
 
+- block:
+    - name: Get the dh file from the master host
+      synchronize:
+        src: '{{ openvpn_conf_dir }}/dh2048.pem'
+        #dest: 'rsync://root@{{ ansible_fqdn }}/{{ openvpn_conf_dir }}/dh2048.pem'
+        dest: '/{{ openvpn_conf_dir }}/dh2048.pem'
+      delegate_to: '{{ openvpn_master_host }}'
+
+    - name: Get the ta key from the master host
+      synchronize:
+        src: '{{ openvpn_conf_dir }}/ta.key'
+        #dest: 'rsync://root@{{ ansible_fqdn }}/{{ openvpn_conf_dir }}/ta.key'
+        dest: '/{{ openvpn_conf_dir }}/ta.key'
+      delegate_to: '{{ openvpn_master_host }}'
+
+  when: openvpn_mode != 'server'
+  tags: [ 'openvpn', 'openvpn_conf', 'openvpn_shared_secrets' ]
+
 
 - block:
     - name: Enable kernel forwarding