summaryrefslogtreecommitdiffstats
path: root/ansible/deployment_poc/tasks/netbox_evaluate_ip.yml
blob: 47ce9dc2120e5d15daa1ae3763376ea18975150a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
- name: Define existing IP address
  set_fact:
    ip_address: "{{ nb_ip_1.json.results[0].address | ansible.netcommon.ipaddr('address') }}" 
    ip_address_cidr: "{{ nb_ip_1.json.results[0].address }}"
    ip_address_type: "existing"
    ipid: "{{ nb_ip_1.json.results[0].id }}"
  when: "nb_ip_1.status|int == 200 and nb_ip_1.json.count|int != 0 and (nb_ip_1.json.results[0].status is defined and nb_ip_1.json.results[0].status.value == 'active')"
  tags:
    - init_dp
    - init_ssh

- name: Define new IP address
  set_fact:
    ip_address: "{{ nb_ip_2.json[0].address | ansible.netcommon.ipaddr('address') }}" 
    ip_address_cidr: "{{ nb_ip_2.json[0].address }}"
    ip_address_type: "new"
  when: "nb_ip_2.status is defined and nb_ip_2.status|int == 200"
  tags:
    - init_dp
    - init_ssh