希望你们一切都好!
我正在通过Salt-Stack Salt-Cloud python API.在AWS EC2中自动部署MongoDB复本集
我想使用单个脚本来配置服务器:
client=salt.cloud.CloutClient(path'/etc/salt/cloud')
client.profile('db_node_profile',names=['host1','host2','host3'])但是,我希望使用不同的云配置文件创建第一个服务器,比如db_master_profile。“profile”客户端有一个vm_overrides选项(参见上面链接的文档),但我找不到它应该如何工作的更多细节。
如果这是一种可能的解决方案,或者是一种使用低开销单一脚本基于盐云配置文件配置实例的替代方式,那么是否有人可以阐明vm_overrides是如何工作的?
发布于 2016-12-19 23:14:51
vm_overrides选项用于在配置时更改minion的配置。它可以覆盖配置文件中设置的任何配置,但不能修改您正在使用的配置文件。
对于您的场景,您可以做两件事:
vm_overrides更改您想要的所有配置。这并不实用,因为您已经有了特定的配置文件。示例:
client=salt.cloud.CloutClient(path'/etc/salt/cloud')
client.profile('db_node_profile',names=['host1','host2','host3'])
{
'host1': {'backups_active': 'False',
'created_at': '2014-09-04T18:10:15Z',
'droplet': {'event_id': 31000502,
'id': 2530006,
'image_id': 5140006,
'name': u'minion01',
'size_id': 66},
'id': '2530006',
'image_id': '5140006',
'ip_address': '107.XXX.XXX.XXX',
'locked': 'True',
'name': 'minion01',
'private_ip_address': None,
'region_id': '4',
'size_id': '66',
'status': 'new'}
}client.profile两次,一次用于具有不同配置文件的第一个服务器,另一次用于具有默认配置文件的其余服务器。示例:
client=salt.cloud.CloutClient(path'/etc/salt/cloud')
client.profile('db_node_profile_0',names=['host1'])
client.profile('db_node_profile_1',names=['host2','host3'])https://stackoverflow.com/questions/41131142
复制相似问题