system/ansible/deployment_poc/tasks/netbox_init_ip.yml
Georg Pfuetzenreuter 642290c734 Bulk update
Signed-off-by: Georg Pfuetzenreuter <georg@lysergic.dev>
2022-02-13 01:41:30 +01:00

21 lines
627 B
YAML

---
- name: Create IP address object
ansible.builtin.uri:
url: "{{ endpoint }}/ipam/ip-addresses/"
client_cert: "{{ cert }}"
client_key: "{{ key }}"
method: POST
return_content: yes
status_code:
- 201
- 400
headers:
Accept: application/json
Authorization: "Token {{ token }}"
body_format: json
body: ' {"address": "{{ ip_address_cidr }}", "tenant": 1, "status": "active", "assigned_object_type": "virtualization.vminterface", "assigned_object_id": {{ ifid }}, "dns_name": "{{ vm_fqdn }}"}'
register: nb_ip_3
when: "ip_address_type|string == 'new'"
delegate_to: localhost