Skip to content
Snippets Groups Projects
Commit 6b763397 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

roles: Fix use of ansible.builtin.fail free-form message.

ansible-lint warns to avoid using free-form when calling module actions
and ansible-freeipa roles used this form with 'ansible.builtin.fail'.
parent 9a32359a
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,8 @@
label: ""
- name: Fail on missing ipabackup_item
ansible.builtin.fail: msg="Failed to get ipabackup_item"
ansible.builtin.fail:
msg: "Failed to get ipabackup_item"
when: ipabackup_item is not defined
- name: Copy backup to controller
......
---
- name: Fail on invalid ipabackup_item
ansible.builtin.fail: msg="ipabackup_item {{ ipabackup_item }} is not valid"
ansible.builtin.fail:
msg: "ipabackup_item {{ ipabackup_item }} is not valid"
when: ipabackup_item is not defined or
ipabackup_item | length < 1 or
(ipabackup_item.find("ipa-full-") == -1 and
......@@ -19,7 +20,8 @@
register: result_backup_stat
- name: Fail on missing backup directory
ansible.builtin.fail: msg="Unable to find backup {{ ipabackup_item }}"
ansible.builtin.fail:
msg: "Unable to find backup {{ ipabackup_item }}"
when: result_backup_stat.stat.isdir is not defined
- name: Get backup files to copy for "{{ ipabackup_item }}"
......
---
- name: Fail on invalid ipabackup_name
ansible.builtin.fail: msg="ipabackup_name {{ ipabackup_name }} is not valid"
ansible.builtin.fail:
msg: "ipabackup_name {{ ipabackup_name }} is not valid"
when: ipabackup_name is not defined or
ipabackup_name | length < 1 or
(ipabackup_name.find("ipa-full-") == -1 and
......@@ -30,7 +31,8 @@
become: no
- name: Fail on missing backup to copy
ansible.builtin.fail: msg="Unable to find backup {{ ipabackup_name }}"
ansible.builtin.fail:
msg: "Unable to find backup {{ ipabackup_name }}"
when: result_backup_stat.stat.isdir is not defined
- name: Copy backup files to server for "{{ ipabackup_item }}"
......
......@@ -2,7 +2,8 @@
# tasks file for ipabackup
- name: Check for empty vars
ansible.builtin.fail: msg="Variable {{ item }} is empty"
ansible.builtin.fail:
msg: "Variable {{ item }} is empty"
when: "item in vars and not vars[item]"
with_items: "{{ ipabackup_empty_var_checks }}"
vars:
......@@ -23,11 +24,13 @@
when: ipabackup_online | bool and not ipabackup_data | bool
- name: Fail if ipabackup_from_controller and ipabackup_to_controller are set
ansible.builtin.fail: msg="ipabackup_from_controller and ipabackup_to_controller are set"
ansible.builtin.fail:
msg: "ipabackup_from_controller and ipabackup_to_controller are set"
when: ipabackup_from_controller | bool and ipabackup_to_controller | bool
- name: Fail for given ipabackup_name if state is not copied, restored or absent
ansible.builtin.fail: msg="ipabackup_name is given and state is not copied, restored or absent"
ansible.builtin.fail:
msg: "ipabackup_name is given and state is not copied, restored or absent"
when: state is not defined or
(state != "copied" and state != "restored" and state != "absent") and
ipabackup_name is defined
......@@ -40,7 +43,8 @@
when: state|default("present") == "present"
- name: Fail on missing ipabackup_name
ansible.builtin.fail: msg="ipabackup_name is not set"
ansible.builtin.fail:
msg: "ipabackup_name is not set"
when: (ipabackup_name is not defined or not ipabackup_name) and
state is defined and
(state == "copied" or state == "restored" or state == "absent")
......@@ -66,7 +70,8 @@
- name: Set ipabackup_names from ipabackup_name
block:
- name: Fail on ipabackup_name all
ansible.builtin.fail: msg="ipabackup_name can not be all in this case"
ansible.builtin.fail:
msg: "ipabackup_name can not be all in this case"
when: ipabackup_name is defined and ipabackup_name == "all"
- name: Set ipabackup_names from ipabackup_name string
......@@ -114,7 +119,8 @@
# restore.
- name: Fail to copy or restore more than one backup on the server
ansible.builtin.fail: msg="Only one backup can be copied to the server or restored"
ansible.builtin.fail:
msg: "Only one backup can be copied to the server or restored"
when: state is defined and (state == "copied" or state == "restored") and
ipabackup_from_controller | bool and ipabackup_names | length != 1
......
......@@ -26,7 +26,8 @@
register: result_backup_stat
- name: Fail on missing backup directory
ansible.builtin.fail: msg="Unable to find backup {{ ipabackup_item }}"
ansible.builtin.fail:
msg: "Unable to find backup {{ ipabackup_item }}"
when: result_backup_stat.stat.isdir is not defined
- name: Stat header file in backup "{{ ipabackup_item }}"
......@@ -35,7 +36,8 @@
register: result_backup_header_stat
- name: Fail on missing header file in backup
ansible.builtin.fail: msg="Unable to find backup {{ ipabackup_item }} header file"
ansible.builtin.fail:
msg: "Unable to find backup {{ ipabackup_item }} header file"
when: result_backup_header_stat.stat.isreg is not defined
- name: Get services from backup
......
......@@ -19,7 +19,8 @@
ipaclient_servers is not defined
- name: Install - Check that either password or keytab is set
ansible.builtin.fail: msg="ipaadmin_password and ipaadmin_keytab cannot be used together"
ansible.builtin.fail:
msg: "ipaadmin_password and ipaadmin_keytab cannot be used together"
when: ipaadmin_keytab is defined and ipaadmin_password is defined
- name: Install - Set default principal if no keytab is given
......@@ -31,11 +32,13 @@
block:
- name: Install - Fail on missing ipaclient_domain and ipaserver_domain
ansible.builtin.fail: msg="ipaclient_domain or ipaserver_domain is required for ipaclient_configure_dns_resolver"
ansible.builtin.fail:
msg: "ipaclient_domain or ipaserver_domain is required for ipaclient_configure_dns_resolver"
when: ipaserver_domain is not defined and ipaclient_domain is not defined
- name: Install - Fail on missing ipaclient_servers
ansible.builtin.fail: msg="ipaclient_dns_servers is required for ipaclient_configure_dns_resolver"
ansible.builtin.fail:
msg: "ipaclient_dns_servers is required for ipaclient_configure_dns_resolver"
when: ipaclient_dns_servers is not defined
- name: Install - Configure DNS resolver
......@@ -130,7 +133,7 @@
block:
- name: Install - Keytab or password is required for getting otp
ansible.builtin.fail:
msg: Keytab or password is required for getting otp
msg: "Keytab or password is required for getting otp"
when: ipaadmin_keytab is undefined and ipaadmin_password is undefined
- name: Install - Create temporary file for keytab
......@@ -194,11 +197,13 @@
block:
- name: Install - Check if principal and keytab are set
ansible.builtin.fail: msg="Admin principal and client keytab cannot be used together"
ansible.builtin.fail:
msg: "Admin principal and client keytab cannot be used together"
when: ipaadmin_principal is defined and ipaclient_keytab is defined
- name: Install - Check if one of password or keytabs are set
ansible.builtin.fail: msg="At least one of password or keytabs must be specified"
ansible.builtin.fail:
msg: "At least one of password or keytabs must be specified"
when: not result_ipaclient_test_keytab.krb5_keytab_ok
and ipaadmin_password is undefined
and ipaadmin_keytab is undefined
......
......@@ -2,7 +2,8 @@
# tasks file for ipasmartcard_client role
- name: Uninstall smartcard client
ansible.builtin.fail: msg="Uninstalling smartcard for IPA is not supported"
ansible.builtin.fail:
msg: "Uninstalling smartcard for IPA is not supported"
when: state|default('present') == 'absent'
- name: Import variables specific to distribution
......@@ -36,7 +37,8 @@
# Fail on empty "ipasmartcard_client_ca_certs"
- name: Fail on empty "ipasmartcard_client_ca_certs"
ansible.builtin.fail: msg="No CA certs given in 'ipasmartcard_client_ca_certs'"
ansible.builtin.fail:
msg: "No CA certs given in 'ipasmartcard_client_ca_certs'"
when: ipasmartcard_client_ca_certs is not defined or
ipasmartcard_client_ca_certs | length < 1
......
......@@ -2,7 +2,8 @@
# tasks file for ipasmartcard_server role
- name: Uninstall smartcard server
ansible.builtin.fail: msg="Uninstalling smartcard for IPA is not supported"
ansible.builtin.fail:
msg: "Uninstalling smartcard for IPA is not supported"
when: state|default('present') == 'absent'
- name: Import variables specific to distribution
......@@ -27,7 +28,8 @@
# Fail on empty "ipasmartcard_server_ca_certs"
- name: Fail on empty "ipasmartcard_server_ca_certs"
ansible.builtin.fail: msg="No CA certs given in 'ipasmartcard_server_ca_certs'"
ansible.builtin.fail:
msg: "No CA certs given in 'ipasmartcard_server_ca_certs'"
when: ipasmartcard_server_ca_certs is not defined or
ipasmartcard_server_ca_certs | length < 1
......@@ -70,7 +72,8 @@
register: result_ipa_server_show
- name: Fail if not an IPA server
ansible.builtin.fail: msg="Not an IPA server"
ansible.builtin.fail:
msg: "Not an IPA server"
when: result_ipa_server_show.failed
- name: Get Domain from server-find server name
......@@ -83,7 +86,8 @@
register: result_get_ipaca_records
- name: Fail if ipa-ca records are not resolvable
ansible.builtin.fail: msg="ipa-ca records are not resolvable"
ansible.builtin.fail:
msg: "ipa-ca records are not resolvable"
when: result_get_ipaca_records.failed or
result_get_ipaca_records.stdout | length == 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment