Files
ansible-freeipa/tests/host/test_host_random.yml
Thomas Woerner c36cb9543b ipahost: Return generated random password
The random password is only returned if random is yes and the host did
not exist or update_password is yes.

If only one host is handled by the module, the returned dict is containing
this dict:

  { "randompassword": "<the host random password>" }

If several hosts are handled by the module (future feature):

  { "<host>": { "randompassword": "<the host random password>" } }

Fixes issue #134 (ipahost does not return the random password)
2019-11-20 19:50:39 +01:00

42 lines
1.1 KiB
YAML

---
- name: Test ipahost random password generation
hosts: ipaserver
become: true
tasks:
- name: Get Domain from server name
set_fact:
ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Test hosts absent
ipahost:
ipaadmin_password: MyPassword123
name:
- "{{ 'host1.' + ipaserver_domain }}"
- "{{ 'host2.' + ipaserver_domain }}"
update_dns: yes
state: absent
- name: Host "{{ 'host1.' + ipaserver_domain }}" present with random password
ipahost:
ipaadmin_password: MyPassword123
name: "{{ 'host1.' + ipaserver_domain }}"
random: yes
force: yes
update_password: on_create
register: ipahost
failed_when: not ipahost.changed or
ipahost.host.randompassword is not defined
- name: Print generated random password
debug:
var: ipahost.host.randompassword
- name: Host "{{ 'host1.' + ipaserver_domain }}" absent
ipahost:
ipaadmin_password: MyPassword123
name:
- "{{ 'host1.' + ipaserver_domain }}"
state: absent