Support Questions
Find answers, ask questions, and share your expertise

How to automate configuration changes to non default Ambari config group?

/var/lib/ambari-server/resources/scripts/configs.sh is a great way to automate config changes, but seems it only supports the 'Default' config group. Is there a clean way to make changes to other config groups via API?

1 ACCEPTED SOLUTION

Yes you can use APIs. Sample:

A PUT call at http://ambari.host:8080/api/v1/clusters/c1/config_groups/2

with payload:

[{"ConfigGroup":{"id":2,"cluster_name":"c1","group_name":"A config group","tag":"HDFS","description":"A config group","hosts":[{"host_name":"host1"}],"service_config_version_note":"change","desired_configs":[{"type":"hdfs-site","tag":"version1443587493807","properties":{"dfs.replication":"2","dfs.datanode.du.reserved":"1073741822"}}]}}] 

will modify the config group. A POST to http://ambari.host:8080/api/v1/clusters/c1/config_groups would have created a new config group.

View solution in original post

3 REPLIES 3

Yes you can use APIs. Sample:

A PUT call at http://ambari.host:8080/api/v1/clusters/c1/config_groups/2

with payload:

[{"ConfigGroup":{"id":2,"cluster_name":"c1","group_name":"A config group","tag":"HDFS","description":"A config group","hosts":[{"host_name":"host1"}],"service_config_version_note":"change","desired_configs":[{"type":"hdfs-site","tag":"version1443587493807","properties":{"dfs.replication":"2","dfs.datanode.du.reserved":"1073741822"}}]}}] 

will modify the config group. A POST to http://ambari.host:8080/api/v1/clusters/c1/config_groups would have created a new config group.

Thanks @smohanty@hortonworks.com. Is it correct to say that we need to pass in previously configured properties as well as new properties together to the POST? (to avoid removal of existing properties)

New Contributor

how do add new host on existing config_groups through ambari api

; ;