ansible/test/integration/targets/hostname/tasks/test_normal.yml
Sam Doran 7352457e7b
hostname - add macOS (#54439)
* Add DarwinStrategy class and integration tests

macOS has three seprate hostname params that need to be set. One of those params, LocalHostName, has more stringent requirements than the other two, which accept special characters and spaces. Create a method to scrub the hostname to ensure it works well with the system requirements.

* Update documentation

* Account for virtualization type returned on Azure Pipelines

* Do not be dependent on order of self.name_types

Use the scrubbed name when the name type is LocalHostName
2020-10-27 17:30:54 -04:00

24 lines
644 B
YAML

- name: Run hostname module for real now
hostname:
name: crocodile.ansible.test.doesthiswork.net.example.com
register: hn2
- name: Get hostname
command: hostname
register: current_after_hn2
- name: Run hostname again to ensure it does not change
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