Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.15 KB | None | 0 0
  1. - name: Get list of components for each host
  2. uri: url="http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/{{ hostvars[item].ansible_host_fqdn }}"
  3. method=GET
  4. force_basic_auth=yes
  5. user=admin
  6. password=admin
  7. HEADER_X-Requested-By="ambari"
  8. status_code=200,201,202
  9. return_content=yes
  10. register: list_of_components
  11. with_items: "{{ groups['hadoop_cluster'] }}"
  12.  
  13. # - debug: msg="Components are {{ (list_of_components.results|from_json)|json_query('content.host_components[*].HostRoles.component_name') }}"
  14. #- debug: var=list_of_components
  15. # - debug: msg="Components are {{ list_of_components.results[0].item.content.host_components[*].HostRoles.component_name }}"
  16. - debug: msg="Components are {{ item }}"
  17. with_items: "{{ list_of_components.results|from_json }}"
  18.  
  19. ok: [localhost] => (item=slave2) => {
  20. "changed": false,
  21. "connection": "close",
  22. "content": "{n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster",n "Hosts" : {n "cluster_name" : "pstl-cluster",n "cpu_count" : 1,n "disk_info" : [n {n "available" : "36725348",n "device" : "/dev/mapper/centos-root",n "used" : "2540208",n "percent" : "7%",n "size" : "39265556",n "type" : "xfs",n "mountpoint" : "/"n },n {n "available" : "932372",n "device" : "devtmpfs",n "used" : "0",n "percent" : "0%",n "size" : "932372",n "type" : "devtmpfs",n "mountpoint" : "/dev"n },n {n "available" : "942088",n "device" : "tmpfs",n "used" : "0",n "percent" : "0%",n "size" : "942088",n "type" : "tmpfs",n "mountpoint" : "/dev/shm"n },n {n "available" : "933636",n "device" : "tmpfs",n "used" : "8452",n "percent" : "1%",n "size" : "942088",n "type" : "tmpfs",n "mountpoint" : "/run"n },n {n "available" : "341996",n "device" : "/dev/sda1",n "used" : "166592",n "percent" : "33%",n "size" : "508588",n "type" : "xfs",n "mountpoint" : "/boot"n },n {n "available" : "75495164",n "device" : "vagrant",n "used" : "168429828",n "percent" : "70%",n "size" : "243924992",n "type" : "vboxsf",n "mountpoint" : "/vagrant"n },n {n "available" : "75495164",n "device" : "vagrant_data",n "used" : "168429828",n "percent" : "70%",n "size" : "243924992",n "type" : "vboxsf",n "mountpoint" : "/vagrant_data"n }n ],n "host_health_report" : "",n "host_name" : "slave2.mycluster",n "host_state" : "HEALTHY",n "host_status" : "UNHEALTHY",n "ip" : "192.168.0.22",n "last_agent_env" : {n "stackFoldersAndFiles" : [ ],n "alternatives" : [ ],n "existingUsers" : [ ],n "existingRepos" : [ ],n "installedPackages" : [ ],n "hostHealth" : {n "activeJavaProcs" : [ ],n "agentTimeStampAtReporting" : 1481214773737,n "serverTimeStampAtReporting" : 1481214771036,n "liveServices" : [n {n "desc" : "● ntpd.service - Network Time Service\n Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)\n Active: inactive (dead)\n\nDec 07 20:16:57 slave2.mycluster systemd[1]: Stopped Network Time Service.\n",n "status" : "Unhealthy",n "name" : "ntpd"n }n ]n },n "umask" : 18,n "transparentHugePage" : "",n "firewallRunning" : false,n "firewallName" : "iptables",n "reverseLookup" : truen },n "last_heartbeat_time" : 1481214800798,n "last_registration_time" : 1481160539338,n "maintenance_state" : "OFF",n "os_arch" : "x86_64",n "os_family" : "redhat7",n "os_type" : "centos7",n "ph_cpu_count" : 1,n "public_host_name" : "slave2.mycluster",n "rack_info" : "/default-rack",n "recovery_report" : {n "summary" : "RECOVERABLE",n "component_reports" : [ ]n },n "recovery_summary" : "RECOVERABLE",n "total_mem" : 1884176,n "desired_configs" : {n "ams-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-grafana-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-grafana-ini" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-hbase-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-hbase-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-hbase-policy" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-hbase-security-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-hbase-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-ssl-client" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ams-ssl-server" : {n "default" : "TOPOLOGY_RESOLVED"n },n "capacity-scheduler" : {n "default" : "TOPOLOGY_RESOLVED"n },n "cluster-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "core-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "falcon-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "falcon-runtime.properties" : {n "default" : "TOPOLOGY_RESOLVED"n },n "falcon-startup.properties" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hadoop-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hadoop-policy" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hbase-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hbase-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hbase-policy" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hbase-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hcat-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hdfs-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hdfs-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hive-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hive-exec-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hive-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hive-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "hiveserver2-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "kafka-broker" : {n "default" : "TOPOLOGY_RESOLVED"n },n "kafka-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "kafka-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "mapred-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "mapred-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "oozie-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "oozie-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "oozie-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "pig-env" : {n "default" : "INITIAL"n },n "pig-log4j" : {n "default" : "INITIAL"n },n "pig-properties" : {n "default" : "INITIAL"n },n "ranger-hbase-audit" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hbase-plugin-properties" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hbase-policymgr-ssl" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hbase-security" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hdfs-audit" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hdfs-plugin-properties" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hdfs-policymgr-ssl" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hdfs-security" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hive-audit" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hive-plugin-properties" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hive-policymgr-ssl" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-hive-security" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-kafka-audit" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-kafka-plugin-properties" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-kafka-policymgr-ssl" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-kafka-security" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-yarn-audit" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-yarn-plugin-properties" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-yarn-policymgr-ssl" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ranger-yarn-security" : {n "default" : "TOPOLOGY_RESOLVED"n },n "slider-client" : {n "default" : "INITIAL"n },n "slider-env" : {n "default" : "INITIAL"n },n "slider-log4j" : {n "default" : "INITIAL"n },n "spark-defaults" : {n "default" : "INITIAL"n },n "spark-env" : {n "default" : "INITIAL"n },n "spark-hive-site-override" : {n "default" : "INITIAL"n },n "spark-log4j-properties" : {n "default" : "INITIAL"n },n "spark-metrics-properties" : {n "default" : "INITIAL"n },n "spark-thrift-fairscheduler" : {n "default" : "INITIAL"n },n "spark-thrift-sparkconf" : {n "default" : "INITIAL"n },n "ssl-client" : {n "default" : "TOPOLOGY_RESOLVED"n },n "ssl-server" : {n "default" : "TOPOLOGY_RESOLVED"n },n "tez-env" : {n "default" : "INITIAL"n },n "tez-site" : {n "default" : "INITIAL"n },n "webhcat-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "webhcat-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "webhcat-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "yarn-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "yarn-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n },n "yarn-site" : {n "default" : "TOPOLOGY_RESOLVED"n },n "zoo.cfg" : {n "default" : "TOPOLOGY_RESOLVED"n },n "zookeeper-env" : {n "default" : "TOPOLOGY_RESOLVED"n },n "zookeeper-log4j" : {n "default" : "TOPOLOGY_RESOLVED"n }n }n },n "alerts_summary" : {n "CRITICAL" : 3,n "MAINTENANCE" : 0,n "OK" : 2,n "UNKNOWN" : 0,n "WARNING" : 0n },n "kerberos_identities" : [n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/kerberos_identities/HTTP%2Fslave2.mycluster%40%24%7Bkerberos-env%2Frealm%7D",n "KerberosIdentity" : {n "cluster_name" : "pstl-cluster",n "host_name" : "slave2.mycluster",n "principal_name" : "HTTP/slave2.mycluster@${kerberos-env/realm}"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/kerberos_identities/ambari-qa-pstl-cluster%40%24%7Bkerberos-env%2Frealm%7D",n "KerberosIdentity" : {n "cluster_name" : "pstl-cluster",n "host_name" : "slave2.mycluster",n "principal_name" : "ambari-qa-pstl-cluster@${kerberos-env/realm}"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/kerberos_identities/kafka%2Fslave2.mycluster%40%24%7Bkerberos-env%2Frealm%7D",n "KerberosIdentity" : {n "cluster_name" : "pstl-cluster",n "host_name" : "slave2.mycluster",n "principal_name" : "kafka/slave2.mycluster@${kerberos-env/realm}"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/kerberos_identities/zookeeper%2Fslave2.mycluster%40%24%7Bkerberos-env%2Frealm%7D",n "KerberosIdentity" : {n "cluster_name" : "pstl-cluster",n "host_name" : "slave2.mycluster",n "principal_name" : "zookeeper/slave2.mycluster@${kerberos-env/realm}"n }n }n ],n "alerts" : [n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/alerts/1",n "Alert" : {n "cluster_name" : "pstl-cluster",n "definition_id" : 70,n "definition_name" : "ambari_agent_disk_usage",n "host_name" : "slave2.mycluster",n "id" : 1,n "service_name" : "AMBARI"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/alerts/6",n "Alert" : {n "cluster_name" : "pstl-cluster",n "definition_id" : 71,n "definition_name" : "ambari_server_agent_heartbeat",n "host_name" : "slave2.mycluster",n "id" : 6,n "service_name" : "AMBARI"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/alerts/8",n "Alert" : {n "cluster_name" : "pstl-cluster",n "definition_id" : 52,n "definition_name" : "ams_metrics_monitor_process",n "host_name" : "slave2.mycluster",n "id" : 8,n "service_name" : "AMBARI_METRICS"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/alerts/9",n "Alert" : {n "cluster_name" : "pstl-cluster",n "definition_id" : 63,n "definition_name" : "kafka_broker_process",n "host_name" : "slave2.mycluster",n "id" : 9,n "service_name" : "KAFKA"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/alerts/7",n "Alert" : {n "cluster_name" : "pstl-cluster",n "definition_id" : 69,n "definition_name" : "zookeeper_server_process",n "host_name" : "slave2.mycluster",n "id" : 7,n "service_name" : "ZOOKEEPER"n }n }n ],n "stack_versions" : [n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/stack_versions/1",n "HostStackVersions" : {n "cluster_name" : "pstl-cluster",n "host_name" : "slave2.mycluster",n "id" : 1,n "repository_version" : 1,n "stack" : "HDP",n "version" : "2.4"n }n }n ],n "host_components" : [n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/host_components/KAFKA_BROKER",n "HostRoles" : {n "cluster_name" : "pstl-cluster",n "component_name" : "KAFKA_BROKER",n "host_name" : "slave2.mycluster"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/host_components/METRICS_MONITOR",n "HostRoles" : {n "cluster_name" : "pstl-cluster",n "component_name" : "METRICS_MONITOR",n "host_name" : "slave2.mycluster"n }n },n {n "href" : "http://192.168.0.11:8080/api/v1/clusters/pstl-cluster/hosts/slave2.mycluster/host_components/ZOOKEEPER_SERVER",n "HostRoles" : {n "cluster_name" : "pstl-cluster",n "component_name" : "ZOOKEEPER_SERVER",n "host_name" : "slave2.mycluster"n }n }n ]n}",
  23. "content_type": "text/plain",
  24. "expires": "Thu, 01 Jan 1970 00:00:00 GMT",
  25. "invocation": {
  26. "module_args": {
  27. "HEADER_X-Requested-By": "ambari",
  28. "backup": null,
  29. "body": null,
  30. "body_format": "raw",
  31. "content": null,
  32. "creates": null,
  33. "delimiter": null,
  34. "dest": null,
  35. "directory_mode": null,
  36. "follow": false,
  37. "follow_redirects": "safe",
  38. "force": false,
  39. "force_basic_auth": true,
  40. "group": null,
  41. "headers": {
  42. "Authorization": "Basic YWRtaW46YWRtaW4=",
  43. "X-Requested-By": "ambari"
  44. },
  45. "http_agent": "ansible-httpget",
  46. "method": "GET",
  47. "mode": null,
  48. "owner": null,
  49. "password": "admin",
  50. "regexp": null,
  51. "remote_src": null,
  52. "removes": null,
  53. "return_content": true,
  54. "selevel": null,
  55. "serole": null,
  56. "setype": null,
  57. "seuser": null,
  58. "src": null,
  59. "status_code": [
  60. "200",
  61. "201",
  62. "202",
  63. "404"
  64. ],
  65. "timeout": 30,
  66. "unsafe_writes": null,
  67. "url": "<link_to_url>",
  68. "url_password": "admin",
  69. "url_username": "admin",
  70. "use_proxy": true,
  71. "user": "admin",
  72. "validate_certs": true
  73. },
  74. "module_name": "uri"
  75. },
  76. "item": "slave2",
  77. "msg": "OK (unknown bytes)",
  78. "redirected": false,
  79. "server": "Jetty(8.1.17.v20150415)",
  80. "set_cookie": "AMBARISESSIONID=1izzm1ej0m6baujfzms48zhau;Path=/;HttpOnly",
  81. "status": 200,
  82. "url": "<link_to_uri>",
  83. "user": "admin",
  84. "vary": "Accept-Encoding, User-Agent",
  85. "x_frame_options": "DENY",
  86. "x_xss_protection": "1; mode=block"
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement