mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-06-23 09:14:43 +00:00
ipaclient: Calm down ansible and yaml lint in ansible-galaxy
This commit is contained in:
@@ -13,7 +13,7 @@ galaxy_info:
|
|||||||
- name: EL
|
- name: EL
|
||||||
versions:
|
versions:
|
||||||
- 7
|
- 7
|
||||||
- 8
|
# - 8
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- identity
|
- identity
|
||||||
- ipa
|
- ipa
|
||||||
|
|||||||
@@ -19,9 +19,11 @@
|
|||||||
- name: Install - Set ipaclient_servers from cluster inventory
|
- name: Install - Set ipaclient_servers from cluster inventory
|
||||||
set_fact:
|
set_fact:
|
||||||
ipaclient_servers: "{{ groups['ipaserver'] | list }}"
|
ipaclient_servers: "{{ groups['ipaserver'] | list }}"
|
||||||
when: ipaclient_no_dns_lookup | bool and groups.ipaserver is defined and ipaclient_servers is not defined
|
when: ipaclient_no_dns_lookup | bool and groups.ipaserver is defined and
|
||||||
|
ipaclient_servers is not defined
|
||||||
|
|
||||||
- fail: msg="ipaadmin_principal and ipaadmin_keytab cannot be used together"
|
- name: Install - Check that either principal or keytab is set
|
||||||
|
fail: msg="ipaadmin_principal and ipaadmin_keytab cannot be used together"
|
||||||
when: ipaadmin_keytab is defined and ipaadmin_principal is defined
|
when: ipaadmin_keytab is defined and ipaadmin_principal is defined
|
||||||
|
|
||||||
- name: Install - Set default principal if no keytab is given
|
- name: Install - Set default principal if no keytab is given
|
||||||
@@ -65,7 +67,7 @@
|
|||||||
ntp_servers: "{{ ipaclient_ntp_servers | default(omit) }}"
|
ntp_servers: "{{ ipaclient_ntp_servers | default(omit) }}"
|
||||||
ntp_pool: "{{ ipaclient_ntp_pool | default(omit) }}"
|
ntp_pool: "{{ ipaclient_ntp_pool | default(omit) }}"
|
||||||
no_ntp: "{{ ipaclient_no_ntp }}"
|
no_ntp: "{{ ipaclient_no_ntp }}"
|
||||||
#force_ntpd: "{{ ipaclient_force_ntpd }}"
|
# force_ntpd: "{{ ipaclient_force_ntpd }}"
|
||||||
on_master: "{{ ipaclient_on_master }}"
|
on_master: "{{ ipaclient_on_master }}"
|
||||||
### additional ###
|
### additional ###
|
||||||
servers: "{{ result_ipaclient_test.servers }}"
|
servers: "{{ result_ipaclient_test.servers }}"
|
||||||
@@ -81,10 +83,13 @@
|
|||||||
kinit_attempts: "{{ ipaclient_kinit_attempts | default(omit) }}"
|
kinit_attempts: "{{ ipaclient_kinit_attempts | default(omit) }}"
|
||||||
register: result_ipaclient_test_keytab
|
register: result_ipaclient_test_keytab
|
||||||
|
|
||||||
- name: Install - Disable One-Time Password for client with working krb5.keytab
|
- name: Install - Disable One-Time Password for client with working
|
||||||
|
krb5.keytab
|
||||||
set_fact:
|
set_fact:
|
||||||
ipaclient_use_otp: "no"
|
ipaclient_use_otp: "no"
|
||||||
when: ipaclient_use_otp | bool and result_ipaclient_test_keytab.krb5_keytab_ok and not ipaclient_force_join | bool
|
when: ipaclient_use_otp | bool and
|
||||||
|
result_ipaclient_test_keytab.krb5_keytab_ok and
|
||||||
|
not ipaclient_force_join | bool
|
||||||
|
|
||||||
# The following block is executed when using OTP to enroll IPA client
|
# The following block is executed when using OTP to enroll IPA client
|
||||||
# ie when ipaclient_use_otp is set.
|
# ie when ipaclient_use_otp is set.
|
||||||
@@ -93,7 +98,8 @@
|
|||||||
# If a keytab is specified in the hostent, then the hostent will be disabled
|
# If a keytab is specified in the hostent, then the hostent will be disabled
|
||||||
# if ipaclient_use_otp is set.
|
# if ipaclient_use_otp is set.
|
||||||
- block:
|
- block:
|
||||||
- fail: msg="Keytab or password is required for otp"
|
- name: Install - Keytab or password is required for otp
|
||||||
|
fail: msg="Keytab or password is required for otp"
|
||||||
when: ipaadmin_keytab is undefined and ipaadmin_password is undefined
|
when: ipaadmin_keytab is undefined and ipaadmin_password is undefined
|
||||||
|
|
||||||
- name: Install - Save client ansible_python_interpreter setting
|
- name: Install - Save client ansible_python_interpreter setting
|
||||||
@@ -105,7 +111,7 @@
|
|||||||
delegate_to: "{{ result_ipaclient_test.servers[0] }}"
|
delegate_to: "{{ result_ipaclient_test.servers[0] }}"
|
||||||
|
|
||||||
- name: Install - Get One-Time Password for client enrollment
|
- name: Install - Get One-Time Password for client enrollment
|
||||||
#no_log: yes
|
no_log: yes
|
||||||
ipaclient_get_otp:
|
ipaclient_get_otp:
|
||||||
state: present
|
state: present
|
||||||
principal: "{{ ipaadmin_principal | default('admin') }}"
|
principal: "{{ ipaadmin_principal | default('admin') }}"
|
||||||
@@ -118,14 +124,17 @@
|
|||||||
register: result_ipaclient_get_otp
|
register: result_ipaclient_get_otp
|
||||||
# If the host is already enrolled, this command will exit on error
|
# If the host is already enrolled, this command will exit on error
|
||||||
# The error can be ignored
|
# The error can be ignored
|
||||||
failed_when: result_ipaclient_get_otp is failed and "Password cannot be set on enrolled host" not in result_ipaclient_get_otp.msg
|
failed_when: result_ipaclient_get_otp is failed and
|
||||||
|
"Password cannot be set on enrolled host" not
|
||||||
|
in result_ipaclient_get_otp.msg
|
||||||
delegate_to: "{{ result_ipaclient_test.servers[0] }}"
|
delegate_to: "{{ result_ipaclient_test.servers[0] }}"
|
||||||
delegate_facts: True
|
delegate_facts: yes
|
||||||
|
|
||||||
- name: Install - Store the previously obtained OTP
|
- name: Install - Store the previously obtained OTP
|
||||||
no_log: yes
|
no_log: yes
|
||||||
set_fact:
|
set_fact:
|
||||||
ipaadmin_password: "{{ result_ipaclient_get_otp.host.randompassword if result_ipaclient_get_otp.host is defined }}"
|
ipaadmin_password: "{{ result_ipaclient_get_otp.host.randompassword
|
||||||
|
if result_ipaclient_get_otp.host is defined }}"
|
||||||
|
|
||||||
- name: Install - Restore client ansible_python_interpreter setting
|
- name: Install - Restore client ansible_python_interpreter setting
|
||||||
set_fact:
|
set_fact:
|
||||||
@@ -144,11 +153,14 @@
|
|||||||
|
|
||||||
- name: Install - Check if principal and keytab are set
|
- name: Install - Check if principal and keytab are set
|
||||||
fail: msg="Principal and keytab cannot be used together"
|
fail: msg="Principal and keytab cannot be used together"
|
||||||
when: ipaadmin_principal is defined and ipaadmin_principal != "" and ipaclient_keytab is defined and ipaclient_keytab != ""
|
when: ipaadmin_principal is defined and ipaadmin_principal|length > 0
|
||||||
|
and ipaclient_keytab is defined and ipaclient_keytab|length > 0
|
||||||
|
|
||||||
- name: Install - Check if one of password and keytab are set
|
- name: Install - Check if one of password and keytab are set
|
||||||
fail: msg="At least one of password or keytab must be specified"
|
fail: msg="At least one of password or keytab must be specified"
|
||||||
when: not result_ipaclient_test_keytab.krb5_keytab_ok and (ipaadmin_password is undefined or ipaadmin_password == "") and (ipaclient_keytab is undefined or ipaclient_keytab == "")
|
when: not result_ipaclient_test_keytab.krb5_keytab_ok and
|
||||||
|
(ipaadmin_password is undefined or ipaadmin_password == "") and
|
||||||
|
(ipaclient_keytab is undefined or ipaclient_keytab == "")
|
||||||
when: not ipaclient_on_master | bool
|
when: not ipaclient_on_master | bool
|
||||||
|
|
||||||
- name: Install - Purge {{ result_ipaclient_test.realm }} from host keytab
|
- name: Install - Purge {{ result_ipaclient_test.realm }} from host keytab
|
||||||
@@ -160,7 +172,8 @@
|
|||||||
# Do not fail on error codes 3 and 5:
|
# Do not fail on error codes 3 and 5:
|
||||||
# 3 - Unable to open keytab
|
# 3 - Unable to open keytab
|
||||||
# 5 - Principal name or realm not found in keytab
|
# 5 - Principal name or realm not found in keytab
|
||||||
failed_when: result_ipa_rmkeytab.rc != 0 and result_ipa_rmkeytab.rc != 3 and result_ipa_rmkeytab.rc != 5
|
failed_when: result_ipa_rmkeytab.rc != 0 and
|
||||||
|
result_ipa_rmkeytab.rc != 3 and result_ipa_rmkeytab.rc != 5
|
||||||
when: ipaclient_use_otp | bool or ipaclient_force_join | bool
|
when: ipaclient_use_otp | bool or ipaclient_force_join | bool
|
||||||
|
|
||||||
- name: Install - Backup and set hostname
|
- name: Install - Backup and set hostname
|
||||||
@@ -177,25 +190,36 @@
|
|||||||
basedn: "{{ result_ipaclient_test.basedn }}"
|
basedn: "{{ result_ipaclient_test.basedn }}"
|
||||||
hostname: "{{ result_ipaclient_test.hostname }}"
|
hostname: "{{ result_ipaclient_test.hostname }}"
|
||||||
force_join: "{{ ipaclient_force_join | default(omit) }}"
|
force_join: "{{ ipaclient_force_join | default(omit) }}"
|
||||||
principal: "{{ ipaadmin_principal if not ipaclient_use_otp | bool and ipaclient_keytab is not defined else '' }}"
|
principal: "{{ ipaadmin_principal if not ipaclient_use_otp | bool and
|
||||||
|
ipaclient_keytab is not defined else '' }}"
|
||||||
password: "{{ ipaadmin_password | default(omit) }}"
|
password: "{{ ipaadmin_password | default(omit) }}"
|
||||||
keytab: "{{ ipaclient_keytab | default(omit) }}"
|
keytab: "{{ ipaclient_keytab | default(omit) }}"
|
||||||
#ca_cert_file: "{{ ipaclient_ca_cert_file | default(omit) }}"
|
# ca_cert_file: "{{ ipaclient_ca_cert_file | default(omit) }}"
|
||||||
kinit_attempts: "{{ ipaclient_kinit_attempts | default(omit) }}"
|
kinit_attempts: "{{ ipaclient_kinit_attempts | default(omit) }}"
|
||||||
register: result_ipaclient_join
|
register: result_ipaclient_join
|
||||||
when: not ipaclient_on_master | bool and (not result_ipaclient_test_keytab.krb5_keytab_ok or ipaclient_force_join)
|
when: not ipaclient_on_master | bool and
|
||||||
|
(not result_ipaclient_test_keytab.krb5_keytab_ok or
|
||||||
|
ipaclient_force_join)
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- fail:
|
- fail:
|
||||||
msg: "The krb5 configuration is not correct, please enable allow_repair to fix this."
|
msg: >
|
||||||
|
The krb5 configuration is not correct, please enable allow_repair
|
||||||
|
to fix this.
|
||||||
when: not result_ipaclient_test_keytab.krb5_conf_ok
|
when: not result_ipaclient_test_keytab.krb5_conf_ok
|
||||||
- fail:
|
- fail:
|
||||||
msg: "The IPA test failed, please enable allow_repair to fix this."
|
msg: "The IPA test failed, please enable allow_repair to fix this."
|
||||||
when: not result_ipaclient_test_keytab.ping_test_ok
|
when: not result_ipaclient_test_keytab.ping_test_ok
|
||||||
- fail:
|
- fail:
|
||||||
msg: "The ca.crt file is missing, please enable allow_repair to fix this."
|
msg: >
|
||||||
|
The ca.crt file is missing, please enable allow_repair to fix this.
|
||||||
when: not result_ipaclient_test_keytab.ca_crt_exists
|
when: not result_ipaclient_test_keytab.ca_crt_exists
|
||||||
when: not ipaclient_on_master | bool and not result_ipaclient_join.changed and not ipaclient_allow_repair | bool and (result_ipaclient_test_keytab.krb5_keytab_ok or (result_ipaclient_join.already_joined is defined and result_ipaclient_join.already_joined))
|
when: not ipaclient_on_master | bool and
|
||||||
|
not result_ipaclient_join.changed and
|
||||||
|
not ipaclient_allow_repair | bool and
|
||||||
|
(result_ipaclient_test_keytab.krb5_keytab_ok or
|
||||||
|
(result_ipaclient_join.already_joined is defined and
|
||||||
|
result_ipaclient_join.already_joined))
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Install - Configure IPA default.conf
|
- name: Install - Configure IPA default.conf
|
||||||
@@ -235,7 +259,7 @@
|
|||||||
hostname: "{{ result_ipaclient_test.hostname }}"
|
hostname: "{{ result_ipaclient_test.hostname }}"
|
||||||
sssd: "{{ result_ipaclient_test.sssd }}"
|
sssd: "{{ result_ipaclient_test.sssd }}"
|
||||||
force: "{{ ipaclient_force }}"
|
force: "{{ ipaclient_force }}"
|
||||||
#on_master: "{{ ipaclient_on_master }}"
|
# on_master: "{{ ipaclient_on_master }}"
|
||||||
when: not ipaclient_on_master | bool
|
when: not ipaclient_on_master | bool
|
||||||
|
|
||||||
- name: Install - IPA API calls for remaining enrollment parts
|
- name: Install - IPA API calls for remaining enrollment parts
|
||||||
@@ -243,7 +267,7 @@
|
|||||||
servers: "{{ result_ipaclient_test.servers }}"
|
servers: "{{ result_ipaclient_test.servers }}"
|
||||||
realm: "{{ result_ipaclient_test.realm }}"
|
realm: "{{ result_ipaclient_test.realm }}"
|
||||||
hostname: "{{ result_ipaclient_test.hostname }}"
|
hostname: "{{ result_ipaclient_test.hostname }}"
|
||||||
#debug: yes
|
# debug: yes
|
||||||
register: result_ipaclient_api
|
register: result_ipaclient_api
|
||||||
|
|
||||||
- name: Install - Fix IPA ca
|
- name: Install - Fix IPA ca
|
||||||
@@ -252,7 +276,9 @@
|
|||||||
realm: "{{ result_ipaclient_test.realm }}"
|
realm: "{{ result_ipaclient_test.realm }}"
|
||||||
basedn: "{{ result_ipaclient_test.basedn }}"
|
basedn: "{{ result_ipaclient_test.basedn }}"
|
||||||
allow_repair: "{{ ipaclient_allow_repair }}"
|
allow_repair: "{{ ipaclient_allow_repair }}"
|
||||||
when: not ipaclient_on_master | bool and result_ipaclient_test_keytab.krb5_keytab_ok and not result_ipaclient_test_keytab.ca_crt_exists
|
when: not ipaclient_on_master | bool and
|
||||||
|
result_ipaclient_test_keytab.krb5_keytab_ok and
|
||||||
|
not result_ipaclient_test_keytab.ca_crt_exists
|
||||||
|
|
||||||
- name: Install - Create IPA NSS database
|
- name: Install - Create IPA NSS database
|
||||||
ipaclient_setup_nss:
|
ipaclient_setup_nss:
|
||||||
@@ -301,12 +327,19 @@
|
|||||||
- name: Install - Configure NIS
|
- name: Install - Configure NIS
|
||||||
ipaclient_setup_nis:
|
ipaclient_setup_nis:
|
||||||
domain: "{{ result_ipaclient_test.domain }}"
|
domain: "{{ result_ipaclient_test.domain }}"
|
||||||
nisdomain: "{{ ipaclient_nisdomain | default(omit)}}"
|
nisdomain: "{{ ipaclient_nisdomain | default(omit) }}"
|
||||||
when: not ipaclient_no_nisdomain | bool
|
when: not ipaclient_no_nisdomain | bool
|
||||||
|
|
||||||
when: not (not ipaclient_on_master | bool and not result_ipaclient_join.changed and not ipaclient_allow_repair | bool and (result_ipaclient_test_keytab.krb5_keytab_ok or (result_ipaclient_join.already_joined is defined and result_ipaclient_join.already_joined)))
|
when: not (not ipaclient_on_master | bool and
|
||||||
|
not result_ipaclient_join.changed and
|
||||||
|
not ipaclient_allow_repair | bool
|
||||||
|
and (result_ipaclient_test_keytab.krb5_keytab_ok
|
||||||
|
or (result_ipaclient_join.already_joined is defined
|
||||||
|
and result_ipaclient_join.already_joined)))
|
||||||
|
|
||||||
when: not ansible_check_mode and not (result_ipaclient_test.client_already_configured and not ipaclient_allow_repair | bool and not ipaclient_force_join | bool)
|
when: not ansible_check_mode and
|
||||||
|
not (result_ipaclient_test.client_already_configured and
|
||||||
|
not ipaclient_allow_repair | bool and not ipaclient_force_join | bool)
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Cleanup leftover ccache
|
- name: Cleanup leftover ccache
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
- block:
|
- block:
|
||||||
- name: Verify Python3 import
|
- name: Verify Python3 import
|
||||||
script: py3test.py
|
script: py3test.py
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
# tasks to uninstall IPA client
|
# tasks to uninstall IPA client
|
||||||
|
|
||||||
#- name: Uninstall - Include Python2/3 import test
|
# - name: Uninstall - Include Python2/3 import test
|
||||||
# import_tasks: "{{ role_path }}/tasks/python_2_3_test.yml"
|
# import_tasks: "{{ role_path }}/tasks/python_2_3_test.yml"
|
||||||
|
|
||||||
- name: Uninstall - Uninstall IPA client
|
- name: Uninstall - Uninstall IPA client
|
||||||
command: >
|
command: >
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
failed_when: uninstall.rc != 0 and uninstall.rc != 2
|
failed_when: uninstall.rc != 0 and uninstall.rc != 2
|
||||||
changed_when: uninstall.rc == 0
|
changed_when: uninstall.rc == 0
|
||||||
|
|
||||||
#- name: Remove IPA client package
|
# - name: Remove IPA client package
|
||||||
# package:
|
# package:
|
||||||
# name: "{{ item }}"
|
# name: "{{ item }}"
|
||||||
# state: absent
|
# state: absent
|
||||||
# with_items: "{{ ipaclient_packages }}"
|
# with_items: "{{ ipaclient_packages }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user