+++ /dev/null
----
-
-- name: 'Adjust custom puppet facts for customer data.'
- hosts: '{{ target }}'
-
- tasks:
- - name: 'What is going to happen?'
- debug: "var={{ item }}"
- with_items:
- - target
- - project
- - customer_yaml_file
-
- - name: "Get file stats of {{ customer_yaml_file }} ..."
- stat:
- path: "{{ customer_yaml_file }}"
- ignore_errors: true
- changed_when: false
- register: customer_yfile_stat
-
- - name: "Get current configured customer in {{ customer_yaml_file }} ..."
- shell: "if test -f {{ customer_yaml_file }} ; then cat {{ customer_yaml_file }} | grep '^customer:' | sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'; fi"
- ignore_errors: true
- changed_when: false
- register: cur_customer
-
- - name: "Get current configured project in {{ customer_yaml_file }} ..."
- shell: "if test -f {{ customer_yaml_file }} ; then cat {{ customer_yaml_file }} | grep '^project:' | sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'; fi"
- ignore_errors: true
- changed_when: false
- register: cur_project
-
- - name: "Set project in in {{ customer_yaml_file }}, if necessary ..."
- block:
-
- - name: "Save project {{ cur_customer.stdout }} in {{ customer_yaml_file }} ..."
- shell: "echo -e \"---\ncustomer: {{ cur_customer.stdout }}\nproject: {{ cur_customer.stdout }}\" > {{ customer_yaml_file }}"
-
- when: cur_project.stdout == ''
-
- - name: "Set permissions of file {{ customer_yaml_file }} ..."
- file:
- path: "{{ customer_yaml_file }}"
- owner: 'root'
- group: 'root'
- mode: 0644
- when: customer_yfile_stat.stat.exists == true
-
+++ /dev/null
----
-- name: "Validate the LDAP server to take off replication"
- hosts: 127.0.0.1
- # vars_prompt:
-
- # - name: ldapserver_to_disable
- # prompt: 'On which LDAP server do you want to disable replication?'
- # private: false
-
- tasks:
-
- - name: Print a message
- ansible.builtin.debug:
- msg: "Replication should be disabled on the server '{{ ldapserver_to_disable }}'."
-
- - name: Setting status variable
- ansible.builtin.set_fact:
- found_ldapserver: false
-
- - name: "Searching for LDAP server '{{ ldapserver_to_disable }}' ..."
- ansible.builtin.set_fact:
- found_ldapserver: true
- when: "item == ldapserver_to_disable"
- ignore_errors: true
- with_inventory_hostnames:
- - ldap_servers
-
- - name: "Fail for non LDAP server."
- ansible.builtin.fail:
- msg: "The given host '{{ ldapserver_to_disable }}' is not a valid LDAP server."
- when: found_ldapserver == false
-
-- name: "Disable host '{{ ldapserver_to_disable }}' as a HAProxy backend server."
- hosts: haproxy_servers
-
- tasks:
-
- - name: "Setting backend server {{ haproxy_backend_name }}/{{ ldapserver_to_disable }} into maintenance."
- community.general.haproxy:
- state: disabled
- host: "{{ ldapserver_to_disable }}"
- socket: "{{ haproxy_admin_socket }}"
- backend: "{{ haproxy_backend_name }}"
- wait: true
- drain: true
- wait_interval: 2
- wait_retries: 60
-
-# vim: filetype=yaml
replication_manager_password_file: '/root/.private/dirserv-repl-mngr-pwd.txt'
replication_manager_idle_timeout: 0
haproxy_backend_name: 'be-stage-ldap'
+ haproxy_user_socket: '/run/haproxy/user.sock'
+ haproxy_admin_socket: '/run/haproxy/admin.sock'
--- /dev/null
+---
+
+- name: 'Adjust custom puppet facts for customer data.'
+ hosts: '{{ target }}'
+
+ tasks:
+ - name: 'What is going to happen?'
+ debug: "var={{ item }}"
+ with_items:
+ - target
+ - project
+ - customer_yaml_file
+
+ - name: "Get file stats of {{ customer_yaml_file }} ..."
+ stat:
+ path: "{{ customer_yaml_file }}"
+ ignore_errors: true
+ changed_when: false
+ register: customer_yfile_stat
+
+ - name: "Get current configured customer in {{ customer_yaml_file }} ..."
+ shell: "if test -f {{ customer_yaml_file }} ; then cat {{ customer_yaml_file }} | grep '^customer:' | sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'; fi"
+ ignore_errors: true
+ changed_when: false
+ register: cur_customer
+
+ - name: "Get current configured project in {{ customer_yaml_file }} ..."
+ shell: "if test -f {{ customer_yaml_file }} ; then cat {{ customer_yaml_file }} | grep '^project:' | sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'; fi"
+ ignore_errors: true
+ changed_when: false
+ register: cur_project
+
+ - name: "Set project in in {{ customer_yaml_file }}, if necessary ..."
+ block:
+
+ - name: "Save project {{ cur_customer.stdout }} in {{ customer_yaml_file }} ..."
+ shell: "echo -e \"---\ncustomer: {{ cur_customer.stdout }}\nproject: {{ cur_customer.stdout }}\" > {{ customer_yaml_file }}"
+
+ when: cur_project.stdout == ''
+
+ - name: "Set permissions of file {{ customer_yaml_file }} ..."
+ file:
+ path: "{{ customer_yaml_file }}"
+ owner: 'root'
+ group: 'root'
+ mode: 0644
+ when: customer_yfile_stat.stat.exists == true
+
--- /dev/null
+---
+- name: "Validate the LDAP server to take off replication"
+ hosts: localhost
+ gather_facts: false
+
+ tasks:
+
+ - name: Print a message
+ ansible.builtin.debug:
+ msg: "Replication should be disabled on the server '{{ ldapserver_to_disable }}'."
+
+ - name: Setting status variable
+ ansible.builtin.set_fact:
+ found_ldapserver: false
+
+ - name: "Searching for LDAP server '{{ ldapserver_to_disable }}' ..."
+ ansible.builtin.set_fact:
+ found_ldapserver: true
+ when: "item == ldapserver_to_disable"
+ ignore_errors: true
+ with_inventory_hostnames:
+ - ldap_servers
+
+ - name: "Fail for non LDAP server."
+ ansible.builtin.fail:
+ msg: "The given host '{{ ldapserver_to_disable }}' is not a valid LDAP server."
+ when: found_ldapserver == false
+
+- name: "Disable host '{{ ldapserver_to_disable }}' as a HAProxy backend server."
+ hosts: haproxy_servers
+
+ tasks:
+
+ - name: "Setting backend server {{ haproxy_backend_name }}/{{ ldapserver_to_disable }} into maintenance."
+ community.general.haproxy:
+ state: drain
+ host: "{{ ldapserver_to_disable }}"
+ socket: "{{ haproxy_admin_socket }}"
+ backend: "{{ haproxy_backend_name }}"
+ wait: true
+ wait_interval: 2
+ wait_retries: 60
+
+# vim: filetype=yaml