diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/hostname/tasks/test_normal.yml | |
parent | Initial commit. (diff) | |
download | ansible-core-upstream/2.14.3.tar.xz ansible-core-upstream/2.14.3.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | test/integration/targets/hostname/tasks/test_normal.yml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/integration/targets/hostname/tasks/test_normal.yml b/test/integration/targets/hostname/tasks/test_normal.yml new file mode 100644 index 0000000..9534d73 --- /dev/null +++ b/test/integration/targets/hostname/tasks/test_normal.yml @@ -0,0 +1,54 @@ +- name: Ensure hostname doesn't confuse NetworkManager + when: ansible_os_family == 'RedHat' and ansible_distribution_major_version is version('8') + block: + - name: slurp /var/log/messages + slurp: + path: /var/log/messages + become: yes + register: messages_before + + - assert: + that: + - > + 'current hostname was changed outside NetworkManager' not in messages_before.content|b64decode + +- name: Run hostname module for real now + become: 'yes' + hostname: + name: crocodile.ansible.test.doesthiswork.net.example.com + register: hn2 + +- name: Get hostname + command: hostname + register: current_after_hn2 + +- name: Ensure hostname doesn't confuse NetworkManager + when: ansible_os_family == 'RedHat' and ansible_distribution_major_version is version('8') + block: + - name: slurp /var/log/messages + slurp: + path: /var/log/messages + become: yes + register: messages_after + + - assert: + that: + - > + 'current hostname was changed outside NetworkManager' not in messages_after.content|b64decode + +- name: Run hostname again to ensure it does not change + become: 'yes' + hostname: + name: crocodile.ansible.test.doesthiswork.net.example.com + register: hn3 + +- name: Get hostname + command: hostname + register: current_after_hn3 + +- assert: + that: + - hn2 is changed + - hn3 is not changed + - current_after_hn2.stdout == 'crocodile.ansible.test.doesthiswork.net.example.com' + - current_after_hn2.stdout == current_after_hn2.stdout |