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.
186 lines
4.8 KiB
YAML
186 lines
4.8 KiB
YAML
---
|
|
- name: Test hostgroup
|
|
hosts: ipaserver
|
|
become: true
|
|
gather_facts: 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: Ensure host-group databases, mysql-server and oracle-server are absent
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name:
|
|
- databases
|
|
- mysql-server
|
|
- oracle-server
|
|
state: absent
|
|
|
|
- name: Test hosts db1 and db2 absent
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name:
|
|
- "{{ 'db1.' + ipaserver_domain }}"
|
|
- "{{ 'db2.' + ipaserver_domain }}"
|
|
state: absent
|
|
|
|
- name: Host "{{ 'db1.' + ipaserver_domain }}" present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ 'db1.' + ipaserver_domain }}"
|
|
force: yes
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Host "{{ 'db2.' + ipaserver_domain }}" present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: "{{ 'db2.' + ipaserver_domain }}"
|
|
force: yes
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Ensure host-group mysql-server is present
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: mysql-server
|
|
state: present
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Ensure host-group mysql-server is present again
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: mysql-server
|
|
state: present
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Ensure host-group oracle-server is present
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: oracle-server
|
|
state: present
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Ensure host-group oracle-server is present again
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: oracle-server
|
|
state: present
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Ensure host-group databases is present
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: databases
|
|
state: present
|
|
host:
|
|
- "{{ 'db1.' + ipaserver_domain }}"
|
|
hostgroup:
|
|
- oracle-server
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Ensure host-group databases is present again
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: databases
|
|
state: present
|
|
host:
|
|
- "{{ 'db1.' + ipaserver_domain }}"
|
|
hostgroup:
|
|
- oracle-server
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Ensure host db2 is member of host-group databases
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: databases
|
|
state: present
|
|
host:
|
|
- "{{ 'db2.' + ipaserver_domain }}"
|
|
action: member
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Ensure host db2 is member of host-group databases again
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: databases
|
|
state: present
|
|
host:
|
|
- "{{ 'db2.' + ipaserver_domain }}"
|
|
action: member
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Ensure host-group mysql-server is member of host-group databases
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: databases
|
|
state: present
|
|
hostgroup:
|
|
- mysql-server
|
|
action: member
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Ensure host-group mysql-server is member of host-group databases again
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: databases
|
|
state: present
|
|
hostgroup:
|
|
- mysql-server
|
|
action: member
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Ensure host-group oracle-server is member of host-group databases (again)
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name: databases
|
|
state: present
|
|
hostgroup:
|
|
- oracle-server
|
|
action: member
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Ensure host-group databases, mysql-server and oracle-server are absent
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name:
|
|
- databases
|
|
- mysql-server
|
|
- oracle-server
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Ensure host-group databases, mysql-server and oracle-server are absent again
|
|
ipahostgroup:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name:
|
|
- databases
|
|
- mysql-server
|
|
- oracle-server
|
|
state: absent
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Test hosts db1 and db2 absent
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
name:
|
|
- "{{ 'db1.' + ipaserver_domain }}"
|
|
- "{{ 'db2.' + ipaserver_domain }}"
|
|
state: absent
|