cloudera/cloudera-playbook

scm roles set_fact issue related to cms template to submit

Closed this issue · 2 comments

I have an issue related to set_fact on cms tasks:

TASK [scm : set_fact] **************************************************************************************************************************************************************************************************************
fatal: [admin-cdh-dev.intra.local]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute u'admin-cdh-dev.intra.local'\n\nThe error appears to be in '/home/ansible/playbooks/oat/roles/scm/tasks/cms.yml': line 9, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- set_fact:\n  ^ here\n"}
PLAY RECAP *************************************************************************************************************************************************************************************************************************
admin-cdh-dev.intra.local  : ok=67   changed=5    unreachable=0    failed=1    skipped=24   rescued=0    ignored=0
edge01-cdh-dev.intra.local : ok=42   changed=3    unreachable=0    failed=0    skipped=14   rescued=0    ignored=0
master01-cdh-dev.intra.local : ok=42   changed=3    unreachable=0    failed=0    skipped=14   rescued=0    ignored=0
master02-cdh-dev.intra.local : ok=42   changed=3 

All nodes are registred to cloudera servers:

 Connexion : vendredi 22 janvier 2021 à 22:23:47 CET de master01-cdh-dev.intra.local sur pts/7
[ansible@master01-cdh-dev ~]$ curl -s -H "Accept: application/json" -H "Content-Type: application/json" --user "admin:admin" http://admin-cdh-dev.intra.local:7180/api/v33/hosts
{
  "items" : [ {
    "maintenanceOwners" : [ ],
    "hostId" : "1b7229a2-5ec3-4b65-990f-8011bbd079cf",
    "ipAddress" : "10.181.24.153",
    "hostname" : "admin-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/1b7229a2-5ec3-4b65-990f-8011bbd079cf",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 2,
    "numPhysicalCores" : 2,
    "totalPhysMemBytes" : 8201801728
  }, {
    "maintenanceOwners" : [ ],
    "hostId" : "b76b87ef-dfe2-488c-8305-3bc7d17658d1",
    "ipAddress" : "10.181.24.151",
    "hostname" : "edge01-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/b76b87ef-dfe2-488c-8305-3bc7d17658d1",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 8,
    "numPhysicalCores" : 8,
    "totalPhysMemBytes" : 33566892032
  }, {
    "maintenanceOwners" : [ ],
    "hostId" : "1a573cd3-e32a-4339-b588-956927be2d50",
    "ipAddress" : "10.181.24.145",
    "hostname" : "master01-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/1a573cd3-e32a-4339-b588-956927be2d50",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 4,
    "numPhysicalCores" : 4,
    "totalPhysMemBytes" : 16657203200
  }, {
    "maintenanceOwners" : [ ],
    "hostId" : "3fb6cb06-a560-4401-a854-0a82ab349cf8",
    "ipAddress" : "10.181.24.146",
    "hostname" : "master02-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/3fb6cb06-a560-4401-a854-0a82ab349cf8",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 4,
    "numPhysicalCores" : 4,
    "totalPhysMemBytes" : 16657203200
  }, {
    "maintenanceOwners" : [ ],
    "hostId" : "2805e250-f367-4a83-a003-201d850f0780",
    "ipAddress" : "10.181.24.147",
    "hostname" : "master03-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/2805e250-f367-4a83-a003-201d850f0780",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 4,
    "numPhysicalCores" : 4,
    "totalPhysMemBytes" : 16657203200
  }, {
    "maintenanceOwners" : [ ],
    "hostId" : "a397854a-9024-4cc2-9c8d-4574301622cc",
    "ipAddress" : "10.181.24.152",
    "hostname" : "utility-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/a397854a-9024-4cc2-9c8d-4574301622cc",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 8,
    "numPhysicalCores" : 8,
    "totalPhysMemBytes" : 33566892032
  }, {
    "maintenanceOwners" : [ ],
    "hostId" : "8009ebf7-5482-4ed3-8ab8-bd941d0033aa",
    "ipAddress" : "10.181.24.148",
    "hostname" : "worker01-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/8009ebf7-5482-4ed3-8ab8-bd941d0033aa",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 8,
    "numPhysicalCores" : 8,
    "totalPhysMemBytes" : 33566892032
  }, {
    "maintenanceOwners" : [ ],
    "hostId" : "01f4a1c0-e4ca-47c1-aafc-0825d69cfe94",
    "ipAddress" : "10.181.24.149",
    "hostname" : "worker02-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/01f4a1c0-e4ca-47c1-aafc-0825d69cfe94",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 8,
    "numPhysicalCores" : 8,
    "totalPhysMemBytes" : 33566892032
  }, {
    "maintenanceOwners" : [ ],
    "hostId" : "eb80d0f6-6a52-4eaa-a52c-31b71c34d84f",
    "ipAddress" : "10.181.24.150",
    "hostname" : "worker03-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/eb80d0f6-6a52-4eaa-a52c-31b71c34d84f",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 8,
    "numPhysicalCores" : 8,
    "totalPhysMemBytes" : 33566892032
  } ]

Trying to figure out any logical explanation on this however i am struggling to understand why it's blocking on cms template creation.

By the way my current setup is to set krb5_kdc_type to none and removing krb5_server from the hosts, however that lead me to an issue issue#70 and to solve it i only ended up adding krb5_server to host while keeping the krb5_kdc_type: 'none'

Using FQDN in inventory file solved the problem for me.

@smoltis
In my side it was little different and tricker really, for some reason when ansible call uri model to hit the cloudera manager api and list all existing hosts, the reply included masked hostname due to similarity between the hostname and default cloudera password:

 {
    "maintenanceOwners" : [ ],
    "hostId" : "1b7229a2-5ec3-4b65-990f-8011bbd079cf",
    "ipAddress" : "10.181.24.153",
    "hostname" : **"********-cdh-dev.intra.local",
    "rackId" : "/default",
    "hostUrl" : "http://admin-cdh-dev.intra.local:7180/cmf/hostRedirect/1b7229a2-5ec3-4b65-990f-8011bbd079cf",
    "maintenanceMode" : false,
    "commissionState" : "COMMISSIONED",
    "numCores" : 2,
    "numPhysicalCores" : 2,
    "totalPhysMemBytes" : 8201801728
  }

Honestly, i am not sure where the error resides as everything works fine from my end right now and i didn't spend time to debug the uri module request.