From 31e25cb3f0598d89b8154bd88261d8a9d62460f2 Mon Sep 17 00:00:00 2001 From: Marcus Meurs Date: Thu, 5 Apr 2018 11:32:19 +0200 Subject: [PATCH] Make API call local_action Having the controller talk to the ZeroTier API instead of connecting to the target hosts and make them do it is much faster. --- tasks/authorize_node.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/authorize_node.yml b/tasks/authorize_node.yml index 50c34e7..a6f7c87 100644 --- a/tasks/authorize_node.yml +++ b/tasks/authorize_node.yml @@ -10,7 +10,8 @@ zerotier_node_id: "{{ nodeid.stdout }}" - name: Add and authorize members to network - uri: + local_action: + module: uri url: "{{ zerotier_api_url }}/api/network/{{ zerotier_network_id }}/member/{{ zerotier_node_id }}" method: POST headers: @@ -24,6 +25,7 @@ ipAssignments: "{{ zerotier_member_ip_assignments | default([]) | list }}" body_format: json register: apiresult + become: false when: - zerotier_accesstoken is defined