mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
Without this change the "Import variables specific to distribution" tasks fail with "Could not find file on the Ansible Controller..." on environments with inject facts disabled. This changes the tests to run with ansible with inject_facts_as_vars = false and fixes other roles and playbooks.
131 lines
4.1 KiB
YAML
131 lines
4.1 KiB
YAML
---
|
|
- name: Test host principal
|
|
hosts: ipaserver
|
|
become: true
|
|
|
|
tasks:
|
|
- name: Get Domain from server name
|
|
set_fact:
|
|
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
|
|
when: ipaserver_domain is not defined
|
|
|
|
- name: Get Realm from server name
|
|
set_fact:
|
|
ipaserver_realm: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') | upper }}"
|
|
when: ipaserver_realm is not defined
|
|
|
|
- name: Set host1_fqdn
|
|
set_fact:
|
|
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
|
|
|
|
- name: Host host1 absent
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name:
|
|
- "{{ host1_fqdn }}"
|
|
update_dns: yes
|
|
state: absent
|
|
|
|
- name: Host host1... present with principal host/testhost1...
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal:
|
|
- "{{ 'host/testhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
force: yes
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Host host1... principal host/host1... present (existing already)
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal:
|
|
- "{{ 'host/host1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
action: member
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Host host1... principal host/testhost1... present again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal: "{{ 'host/testhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
action: member
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Host host1... principal host/testhost1... absent
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal: "{{ 'host/testhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
action: member
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Host host1... principal host/testhost1... absent again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal: "{{ 'host/testhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
action: member
|
|
state: absent
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Host host1... principal host/testhost1... and host/myhost1... present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal:
|
|
- "{{ 'host/testhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
- "{{ 'host/myhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
action: member
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Host host1... principal host/testhost1... and host/myhost1... present again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal:
|
|
- "{{ 'host/testhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
- "{{ 'host/myhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
action: member
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Host host1... principal host/testhost1... and host/myhost1... absent
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal:
|
|
- "{{ 'host/testhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
- "{{ 'host/myhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
action: member
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Host host1... principal host/testhost1... and host/myhost1... absent again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ host1_fqdn }}"
|
|
principal:
|
|
- "{{ 'host/testhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
- "{{ 'host/myhost1.' + ipaserver_domain + '@' + ipaserver_realm }}"
|
|
action: member
|
|
state: absent
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Host host1... absent
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name:
|
|
- "{{ host1_fqdn }}"
|
|
update_dns: yes
|
|
state: absent
|