zahodi.ansible-mikrotik/tests/integration/tasks/test-ip-pool.yml
2017-06-14 23:29:30 -07:00

90 lines
2.1 KiB
YAML

---
- name: Test adding ip pool
mt_ip:
hostname: "{{ mt_hostname }}"
username: "{{ mt_user }}"
password: "{{ mt_pass }}"
state: present
parameter: pool
settings:
name: ansible_test
ranges: 102.3.4.5
- name: NEVER_CHANGES Test adding duplicate ip pool
mt_ip:
hostname: "{{ mt_hostname }}"
username: "{{ mt_user }}"
password: "{{ mt_pass }}"
state: present
parameter: pool
settings:
name: ansible_test
ranges: 102.3.4.5
register: ip_pool_test_1_add
failed_when: (
not ansible_check_mode
) and (
( ip_pool_test_1_add | changed )
)
- name: ALWAYS_CHANGES Test adding second ip pool to be removed later
mt_ip:
hostname: "{{ mt_hostname }}"
username: "{{ mt_user }}"
password: "{{ mt_pass }}"
state: present
parameter: pool
settings:
name: ansible_test2
ranges: 102.3.4.22
register: ip_pool_test_2_add
failed_when: (
not ansible_check_mode
) and (
not ( ip_pool_test_2_add | changed )
)
- name: Test adding ip pool to be used as next_pool
mt_ip:
hostname: "{{ mt_hostname }}"
username: "{{ mt_user }}"
password: "{{ mt_pass }}"
state: present
parameter: pool
settings:
name: next_pool1
ranges: 10.1.2.30-10.2.3.40
- name: ALWAYS_CHANGES Test editing an existing ip-pool item (change ranges add next_pool)
mt_ip:
hostname: "{{ mt_hostname }}"
username: "{{ mt_user }}"
password: "{{ mt_pass }}"
state: present
parameter: pool
settings:
name: ansible_test
ranges: 102.3.4.6
next_pool: next_pool1
register: ip_pool_test_1_edit
failed_when: (
not ansible_check_mode
) and (
not ( ip_pool_test_1_edit | changed )
)
- name: ALWAYS_CHANGES Test remove ip pool
mt_ip:
hostname: "{{ mt_hostname }}"
username: "{{ mt_user }}"
password: "{{ mt_pass }}"
state: absent
parameter: pool
settings:
name: ansible_test2
register: ip_pool_test_2_rem
failed_when: (
not ansible_check_mode
) and (
not ( ip_pool_test_2_rem | changed )
)