diff options
author | Georg Pfuetzenreuter | 2022-02-13 01:37:39 +0100 |
---|---|---|
committer | Georg Pfuetzenreuter | 2022-02-13 01:41:30 +0100 |
commit | 642290c73407a7969857197810123633c83c6a26 (patch) | |
tree | 501c138a617d11abaf88d28812baab5a2ee639dd /ansible/deployment_poc/tasks/netbox_primaryip.yml | |
parent | a2be10311173cef2c39da721b3e47888c379e7bc (diff) | |
download | system-642290c73407a7969857197810123633c83c6a26.tar.gz system-642290c73407a7969857197810123633c83c6a26.tar.bz2 system-642290c73407a7969857197810123633c83c6a26.zip |
Bulk update
Signed-off-by: Georg Pfuetzenreuter <georg@lysergic.dev>
Diffstat (limited to 'ansible/deployment_poc/tasks/netbox_primaryip.yml')
-rw-r--r-- | ansible/deployment_poc/tasks/netbox_primaryip.yml | 20 |
1 files changed, 20 insertions, 0 deletions
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 + |