From 642290c73407a7969857197810123633c83c6a26 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sun, 13 Feb 2022 01:37:39 +0100 Subject: Bulk update Signed-off-by: Georg Pfuetzenreuter --- ansible/deployment_poc/tasks/netbox_primaryip.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ansible/deployment_poc/tasks/netbox_primaryip.yml (limited to 'ansible/deployment_poc/tasks/netbox_primaryip.yml') diff --git a/ansible/deployment_poc/tasks/netbox_primaryip.yml b/ansible/deployment_poc/tasks/netbox_primaryip.yml new file mode 100644 index 0000000..1b319dc --- /dev/null +++ b/ansible/deployment_poc/tasks/netbox_primaryip.yml @@ -0,0 +1,20 @@ +--- +- name: Register IP address object ID #only for new addresses, existing ones have ipid set in _evaluate_ip.yml + set_fact: + ipid: "{{ nb_ip_3.json.id }}" + when: "ip_address_type|string == 'new'" + +- name: Set primary IPv4 address + ansible.builtin.uri: + url: "{{ endpoint }}/virtualization/virtual-machines/{{ id }}/" + client_cert: "{{ cert }}" + client_key: "{{ key }}" + method: PATCH + return_content: yes + headers: + Accept: application/json + Authorization: "Token {{ token }}" + body_format: json + body: ' {"primary_ip4": {{ ipid }}}' + delegate_to: localhost + -- cgit v1.2.3