cloudera-labs / cloudera.cluster

An Ansible collection for lifecycle and management of Cloudera CDP Private Cloud resources on bare metal, IaaS, and PaaS.
Apache License 2.0
32 stars 46 forks source link

Notifying Handlers in Autotls Role is not working correctly #215

Open hadoopch opened 3 months ago

hadoopch commented 3 months ago

Hi,

in roles/cloudera_manager/autotls/tasks/main.yml of the autotls role the fiollowing code is used if we have configured key authentication in autotls.

- name: Enable Auto-TLS
  cm_api:
    endpoint: "/cm/commands/generateCmca"
    method: POST
    body: "{{ lookup('template', 'auto-tls-key.json') }}"
  ignore_errors: true
  when: not use_password
  notify:
    - restart cloudera-scm-server
    - restart cloudera management service
    - restart cloudera-scm-agent

3 Handlers should be notified if something changed.

I debugged the role and saw that there is no status change (changed: false) even if TLS settings were changed.

So the 3 handlers are not notified.

ok: [cm001.cdp.lan] => {
    "cache_control": "no-cache, no-store, max-age=0, must-revalidate",
    "changed": false,
    "connection": "close",
    "content": "{\n  \"id\" : 1546344839,\n  \"name\" : \"GenerateCMCACommand\",\n  \"startTime\" : \"2024-03-19T09:02:10.735Z\",\n  \"endTime\" : \"2024-03-19T09:02:28.496Z\",\n  \"active\" : false,\n  \"success\" : true,\n  \"resultMessage\" : \"Successfully generated CMCA and enabled Auto-TLS\",\n  \"children\" : {\n    \"items\" : [ ]\n  }\n}",

Furthermore there is no notification at all in the code if autotls is configured by user and password

- name: Enable Auto-TLS
  cm_api:
    endpoint: "/cm/commands/generateCmca"
    method: POST
    body: "{{ lookup('template', 'auto-tls.json') }}"
    timeout: 360
  ignore_errors: true
  when: use_password

Regards

Uli