--- /dev/null
+---
+
+- name: "Removing replication agreements on {{ ansible_nodename }}."
+ when: ldapserver_to_disable != ansible_nodename
+ block:
+
+ - name: "Removing replication agreements to {{ target }}."
+ when: ldapserver_to_disable == target
+ block:
+
+ - name: "Set fact agreement_name."
+ set_fact:
+ agreement_name: "{{ slapd_instance }} to {{ target }} agreement"
+
+ - name: "Show replication agreement name for suffix '{{ suffix }}'."
+ debug:
+ var: agreement_name
+ verbosity: 0
+
+ - name: "Removing replication agreement '{{ agreement_name }}' for suffix '{{ suffix }}'."
+ ansible.builtin.shell: "dsconf '{{ slapd_instance }}' repl-agmt delete --suffix '{{ suffix }}' '{{ agreement_name }}'"
+ ignore_errors: true
+
+- name: "Removing replication agreements on {{ ldapserver_to_disable }}."
+ when: ldapserver_to_disable == ansible_nodename
+ block:
+
+ - name: "Set fact agreement_name."
+ set_fact:
+ agreement_name: "{{ slapd_instance }} to {{ target }} agreement"
+
+ - name: "Show replication agreement name for suffix '{{ suffix }}'."
+ debug:
+ var: agreement_name
+ verbosity: 0
+
+ - name: "Removing replication agreement '{{ agreement_name }}' for suffix '{{ suffix }}'."
+ ansible.builtin.shell: "dsconf '{{ slapd_instance }}' repl-agmt delete --suffix '{{ suffix }}' '{{ agreement_name }}'"
+ ignore_errors: true
+
+
+# vim: filetype=yaml
---
-# - name: "Set fact backend_name."
-# # no_log: true
-# set_fact:
-# backend_name: "{{ lookup('vars', ansible_loop_var) }}.value"
-
- name: "Get current Readonly status of Backend '{{ backend.value }}' ..."
ansible.builtin.shell: "dsconf '{{ slapd_instance }}' backend suffix get '{{ backend.value }}' | grep -i '^nsslapd-readonly:' | sed -e 's/^nsslapd-readonly:[ ]*//i'"
check_mode: false
+ changed_when: false
register: backend_get_ro_status
- name: "Show current backend_get_ro_status"
ansible.builtin.shell: date +%Y-%m-%d_%H-%M-%S
register: tstamp
check_mode: false
+ changed_when: false
when: ldapserver_to_disable == ansible_nodename
- name: "Show current timestamp"
- name: "Retrieve all backends from '{{ ldapserver_to_disable }}'."
ansible.builtin.shell: "dsconf '{{ slapd_instance }}' backend suffix list"
register: backend_suffix_list
+ changed_when: false
check_mode: false
- when: ldapserver_to_disable == ansible_nodename
- name: "Show current backend_suffix_list"
debug:
var: backend_suffix_list
verbosity: 2
- when: ldapserver_to_disable == ansible_nodename
- name: "Set backend variable"
no_log: true
set_fact:
suffix_names: "{{ backend_suffix_list.stdout_lines | map('regex_replace', '\\s+\\(.+\\)\\s*$', '') | list }}"
backend_names: "{{ backend_suffix_list.stdout_lines | map('regex_replace', '^.*\\((.+)\\)\\s*$', '\\1') | list }}"
- when: ldapserver_to_disable == ansible_nodename
- name: "Set suffixes dict"
no_log: true
set_fact:
suffixes: "{{ dict( suffix_names | zip(backend_names) ) }}"
- when: ldapserver_to_disable == ansible_nodename
- name: "Show current suffixes"
debug:
var: suffixes
verbosity: 0
- when: ldapserver_to_disable == ansible_nodename
- name: "Setting all backends to readonly."
when: ldapserver_to_disable == ansible_nodename
loop_var: backend
include_tasks: '../includes/set-389ds-backend-readonly.yaml'
+ - name: "Removing replication agreements"
+ include_tasks: '../includes/del-389ds-backend-repl-agmts.yaml'
+ vars:
+ suffix: "{{ item[0].key }}"
+ target: "{{ item[1] }}"
+ loop: "{{ suffixes | dict2items | product( ansible_play_batch ) | list }}"
+
+
+# vim: filetype=yaml
+
# vim: filetype=yaml