Skip to content

Commit 5054732

Browse files
committed
ipaserver: Don't run ipa-server-install if packages are not installed
When running ipaserver role with 'state: absent' and packages are not installed, uninstallation fails trying to execute 'ipa-server-install --uninstall' as the command is not available. As the user is trying to remove a server that does not exist, no error should be raised, as the state is already satisfied. Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
1 parent 89cfb5f commit 5054732

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

roles/ipaserver/tasks/uninstall.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
when: ipaserver_remove_on_server is defined or
4343
result_get_connected_server.server is defined
4444

45+
- name: Uninstall - Check if ipa-server-install is present
46+
ansible.builtin.stat:
47+
path: /usr/sbin/ipa-server-install
48+
register: ipa_server_install_available
49+
4550
- name: Uninstall - Uninstall IPA server
4651
ansible.builtin.command: >
4752
/usr/sbin/ipa-server-install
@@ -54,3 +59,4 @@
5459
# 1 means that uninstall failed because IPA server was not configured
5560
failed_when: uninstall.rc != 0 and uninstall.rc != 1
5661
changed_when: uninstall.rc == 0
62+
when: ipa_server_install_available.stat.exists

0 commit comments

Comments
 (0)