summaryrefslogtreecommitdiffstats
path: root/ansible/deployment_poc/tasks/netbox_init_ip.yml
blob: 5db97f455e5736905dd94d4d4086d5b77816b58d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
- 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