mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
Current version of ansible-list pre-commit hook required changes in the ansible-freeipa yamllint configuration and these changes triggered issues in the current playbooks on roles and tests. This patch adds the required changes to yaml lint configuration and fixes the affected playbooks. Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
255 lines
7.7 KiB
YAML
255 lines
7.7 KiB
YAML
---
|
|
- name: Test host
|
|
hosts: "{{ ipa_test_host | default('ipaserver') }}"
|
|
become: true
|
|
|
|
tasks:
|
|
- name: Get Domain from server name
|
|
ansible.builtin.set_fact:
|
|
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join('.') }}"
|
|
when: ipaserver_domain is not defined
|
|
|
|
- name: Set host1_fqdn .. host6_fqdn
|
|
ansible.builtin.set_fact:
|
|
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
|
|
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
|
|
host3_fqdn: "{{ 'host3.' + ipaserver_domain }}"
|
|
host4_fqdn: "{{ 'host4.' + ipaserver_domain }}"
|
|
host5_fqdn: "{{ 'host5.' + ipaserver_domain }}"
|
|
host6_fqdn: "{{ 'host6.' + ipaserver_domain }}"
|
|
|
|
- name: Host absent
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name:
|
|
- "{{ host1_fqdn }}"
|
|
- "{{ host2_fqdn }}"
|
|
- "{{ host3_fqdn }}"
|
|
- "{{ host4_fqdn }}"
|
|
- "{{ host5_fqdn }}"
|
|
- "{{ host6_fqdn }}"
|
|
update_dns: yes
|
|
state: absent
|
|
|
|
- name: Ensure leftover DNS records for test hosts are not present.
|
|
ipadnsrecord:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
zone_name: "{{ ipaserver_domain }}"
|
|
records:
|
|
- name: "host1"
|
|
del_all: true
|
|
- name: "host2"
|
|
del_all: true
|
|
- name: "host3"
|
|
del_all: true
|
|
- name: "host4"
|
|
del_all: true
|
|
- name: "host5"
|
|
del_all: true
|
|
- name: "host6"
|
|
del_all: true
|
|
state: absent
|
|
|
|
- name: Get IPv4 address prefix from server node
|
|
ansible.builtin.set_fact:
|
|
ipv4_prefix: "{{ ansible_facts['default_ipv4'].address.split('.')[:-1] |
|
|
join('.') }}"
|
|
|
|
- name: Host "{{ host1_fqdn }}" present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host1_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.201' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Host "{{ host1_fqdn }}" present again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host1_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.201' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Host "{{ host2_fqdn }}" present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host2_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.202' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Host "{{ host2_fqdn }}" present again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host2_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.202' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Host "{{ host3_fqdn }}" present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host3_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.203' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Host "{{ host3_fqdn }}" present again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host3_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.203' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Host "{{ host4_fqdn }}" present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host4_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.204' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Host "{{ host4_fqdn }}" present again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host4_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.204' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Host "{{ host5_fqdn }}" present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host5_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.205' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Host "{{ host5_fqdn }}" present again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host5_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.205' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
- name: Host "{{ host6_fqdn }}" present
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host6_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.206' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Host "{{ host6_fqdn }}" present again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name: "{{ host6_fqdn }}"
|
|
ip_address: "{{ ipv4_prefix + '.206' }}"
|
|
update_dns: yes
|
|
reverse: no
|
|
register: result
|
|
failed_when: result.changed or result.failed
|
|
|
|
# disabled can only be checked with enabled hosts, all hosts above are
|
|
# not enabled.
|
|
# - name: Hosts host1..host6 disabled
|
|
# ipahost:
|
|
# ipaadmin_password: SomeADMINpassword
|
|
# ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
# name:
|
|
# - "{{ host1_fqdn }}"
|
|
# - "{{ host2_fqdn }}"
|
|
# - "{{ host3_fqdn }}"
|
|
# - "{{ host4_fqdn }}"
|
|
# - "{{ host5_fqdn }}"
|
|
# - "{{ host6_fqdn }}"
|
|
# state: disabled
|
|
# register: result
|
|
# failed_when: not result.changed or result.failed
|
|
#
|
|
# - name: Hosts host1..host6 disabled again
|
|
# ipahost:
|
|
# ipaadmin_password: SomeADMINpassword
|
|
# ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
# name:
|
|
# - "{{ host1_fqdn }}"
|
|
# - "{{ host2_fqdn }}"
|
|
# - "{{ host3_fqdn }}"
|
|
# - "{{ host4_fqdn }}"
|
|
# - "{{ host5_fqdn }}"
|
|
# - "{{ host6_fqdn }}"
|
|
# state: disabled
|
|
# register: result
|
|
# failed_when: result.changed or result.failed
|
|
|
|
- name: Hosts host1..host6 absent
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name:
|
|
- "{{ host1_fqdn }}"
|
|
- "{{ host2_fqdn }}"
|
|
- "{{ host3_fqdn }}"
|
|
- "{{ host4_fqdn }}"
|
|
- "{{ host5_fqdn }}"
|
|
- "{{ host6_fqdn }}"
|
|
update_dns: yes
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed or result.failed
|
|
|
|
- name: Hosts host1..host6 absent again
|
|
ipahost:
|
|
ipaadmin_password: SomeADMINpassword
|
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
name:
|
|
- "{{ host1_fqdn }}"
|
|
- "{{ host2_fqdn }}"
|
|
- "{{ host3_fqdn }}"
|
|
- "{{ host4_fqdn }}"
|
|
- "{{ host5_fqdn }}"
|
|
- "{{ host6_fqdn }}"
|
|
update_dns: yes
|
|
state: absent
|
|
register: result
|
|
failed_when: result.changed or result.failed
|