1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/interfaces_file/tasks/main.yml

64 lines
1.5 KiB
YAML
Raw Normal View History

---
- name:
set_fact:
interfaces_testfile: '{{ remote_tmp_dir }}/interfaces'
interfaces_testfile_3841: '{{ remote_tmp_dir }}/interfaces_3841'
- name: Copy interfaces file
copy:
src: 'files/interfaces_ff'
dest: '{{ interfaces_testfile }}'
- name: Change IP address to 1.2.3.5
community.general.interfaces_file:
dest: "{{ interfaces_testfile }}"
iface: eno1
option: address
value: 1.2.3.5
register: ifile_1
- assert:
that:
- ifile_1 is changed
- name: Change IP address to 1.2.3.5 again
community.general.interfaces_file:
dest: "{{ interfaces_testfile }}"
iface: eno1
option: address
value: 1.2.3.5
register: ifile_2
- assert:
that:
- ifile_2 is not changed
- name: 3841 - copy interfaces file
copy:
src: 'files/interfaces_ff_3841'
dest: '{{ interfaces_testfile_3841 }}'
- name: 3841 - floating_ip_interface_up_ip 2a01:a:b:c::1/64 dev eth0
interfaces_file:
option: up
iface: eth0
dest: "{{ interfaces_testfile_3841 }}"
value: 'ip addr add 2a01:a:b:c::1/64 dev eth0'
state: present
register: ifile_3841_a
- name: 3841 - floating_ip_interface_up_ip 2a01:a:b:c::1/64 dev eth0 (again)
interfaces_file:
option: up
iface: eth0
dest: "{{ interfaces_testfile_3841 }}"
value: 'ip addr add 2a01:a:b:c::1/64 dev eth0'
state: present
register: ifile_3841_b
- name: 3841 - check assertions
assert:
that:
- ifile_3841_a is changed
- ifile_3841_b is not changed