I wanto to nest playbooks on best practice as a following python code.
Have any idea?
#!/usr/bin/env python
import os
configure web servers
os.system(‘ansible-playbooks -i webservers web_configure.yml’)
db_configs = [
{‘foo’:1, ‘bar’:2, ‘baz’:3}
{‘foo’:2, ‘bar’:4, ‘baz’:2}
{‘foo’:3, ‘bar’:6, ‘baz’:1}
]
for db_configs as db_config:
configure db servers
os.system(“ansible -i dbservers all -m ‘FOO=%(foo) BAR=%(bar) BAZ =%(baz)’” % db_config)
benchmark test (atacking from erb servers to db servers)
os.system(“ansible-playbooks -i webservers db_attack.yml” % db_config)