diff --git a/templates/wg b/templates/wg
index 9342b512a11ace806176f2ca0113542d17cc2405..737dc3d3ac1315c774afba74cd2d55936f3216c9 100644
--- a/templates/wg
+++ b/templates/wg
@@ -5,6 +5,6 @@ PostUp = wg set %i private-key privatekey
 ListenPort = 51902
 
 [Peer]
-PublicKey = {{ server_pubkey }}
+PublicKey = {{  }}
 Endpoint = {{ dst }}:51888
 AllowedIPs = 10.0.0.0/24
diff --git a/wg.yml b/wg.yml
index bf0ccd4e3283b54a902c1c52f49b093bf1a9b930..c189e7cdfcf028a7f085eb27f49cfc956a38e445 100644
--- a/wg.yml
+++ b/wg.yml
@@ -3,7 +3,7 @@
   roles:
     - role: wg
       vars:
-        otherHost: h2
+        server_pubkey: "{{ hostvars[h2].publickey }}" 
         myAddr: 10.0.0.1
         dst: 10.0.3.2
 
@@ -12,7 +12,7 @@
   roles:
     - role: wg
       vars:
-        otherHost: h1
+        server_pubkey: "{{ hostvars[h2].publickey }}" 
         myAddr: 10.0.0.2
         dst: 10.0.1.2