[ipa/server] Ask for confirmation for all hosts
Ansible `pause` module is only running once per playbook. This is a hacky way to make it run for each host. Signed-off-by: Michal Konecny <mkonecny@redhat.com>
This commit is contained in:
parent
2f550bde13
commit
883cff055f
1 changed files with 16 additions and 5 deletions
|
@ -99,20 +99,31 @@
|
||||||
- name: Check if /var/log/ipainstall.log is available
|
- name: Check if /var/log/ipainstall.log is available
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: /var/log/ipainstall.log
|
path: /var/log/ipainstall.log
|
||||||
register: replica_check
|
register: replica_log
|
||||||
tags:
|
tags:
|
||||||
- ipa/server
|
- ipa/server
|
||||||
- config
|
- config
|
||||||
|
|
||||||
|
- name: Saving /var/log/ipainstall.log check
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
replica_check: replica_log
|
||||||
|
|
||||||
- name: ask admin if they are ok reinstalling this ipa server replica
|
- name: ask admin if they are ok reinstalling this ipa server replica
|
||||||
ansible.builtin.pause:
|
ansible.builtin.pause:
|
||||||
prompt: "Looks like this replica should be reinstalled, are you sure you want to do that? (yes/no)"
|
prompt: "Looks like replica for {{ item }} should be reinstalled, are you sure you want to do that? (yes/no)"
|
||||||
when: not ipa_initial and (not replica_check.stat.exists)
|
when: "not ipa_initial and (not {{ hostvars[item]['replica_check'].stat.exists }})"
|
||||||
register: confirm_replica
|
register: input
|
||||||
|
with_items: "{{ play_hosts }}"
|
||||||
tags:
|
tags:
|
||||||
- ipa/server
|
- ipa/server
|
||||||
- config
|
- config
|
||||||
|
|
||||||
|
- name: Save the user input
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
confirm_replica: "{{ item.user_input }}"
|
||||||
|
with_items: "{{ hostvars[play_hosts.0].input.results }}"
|
||||||
|
when: item.item == inventory_hostname
|
||||||
|
|
||||||
- name: configure replication
|
- name: configure replication
|
||||||
block:
|
block:
|
||||||
# The ipa-client-install makes the ipa-replica-install fail
|
# The ipa-client-install makes the ipa-replica-install fail
|
||||||
|
@ -142,7 +153,7 @@
|
||||||
--server={{ipa_server}}
|
--server={{ipa_server}}
|
||||||
--dirsrv-config-file=/root/ldif/replica-install.ldif
|
--dirsrv-config-file=/root/ldif/replica-install.ldif
|
||||||
when: ansible_distribution_major_version|int >= 8
|
when: ansible_distribution_major_version|int >= 8
|
||||||
when: not ipa_initial and (confirm_replica is defined) and (confirm_replica.user_input | bool)
|
when: not ipa_initial and (confirm_replica | default('no') | bool)
|
||||||
tags:
|
tags:
|
||||||
- ipa/server
|
- ipa/server
|
||||||
- config
|
- config
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue