#How to change Active IQ passwords from clusters in Active IQ with a Ansible playbook

1 messages · Page 1 of 1 (latest)

lavish cosmos
#

How to change datasource clusters passwords in ActiveIQ with rest api in Ansible, does anyone have a ansible playbook example ?

Thanks

magic river
#

I built that with the standard URI module. The playbook loops over all clusters and sets the same credentials. Also the mTLS certificates are renewed.
I had to to break it into two posts, file upload is blocked for me.

#

`- hosts: localhost
become: false
connection: local
name: Change ActiveIQ Unified Manager datasource passwords
vars:
um_host: "aiqum.local"
um_api_base_url: "https://{{ um_host }}/api"
um_login_username: "admin"
um_login_password: "pass"
um_datasource_username: "admin"
um_datasource_password: "pass"

tasks:
- name: Get Datasources from Unified Manager
ansible.builtin.uri:
url: "{{ um_api_base_url }}/admin/datasources/clusters"
url_username: "{{ um_login_username }}"
url_password: "{{ um_login_password }}"
method: GET
force_basic_auth: true
register: clusters

- name: Regenerate user MTLS certifcate
  ansible.builtin.uri:
    url: "{{ um_api_base_url }}/private/admin/regenerate-mtls-certificate"
    url_username: "{{ um_login_username }}"
    url_password: "{{ um_login_password }}"
    method: POST
    force_basic_auth: true
    body:
      address: "{{ item.address }}"
      user_name: "{{ um_datasource_username }}"
    body_format: json
  loop: "{{ clusters.json.records }}"
  loop_control:
    label: "{{ item.name }}"

- name: Save new certificate
  ansible.builtin.uri:
    url: "{{ um_api_base_url }}/management-server/admin/cluster-certificates"
    url_username: "{{ um_login_username }}"
    url_password: "{{ um_login_password }}"
    method: POST
    force_basic_auth: true
    body:
      address: "{{ item.address }}"
      port: "{{ item.port }}"
    body_format: json
  loop: "{{ clusters.json.records }}"
  loop_control:
    label: "{{ item.name }}"`