ansible-runner

Write Ansible playbooks using Python dictionary

蓝咒 提交于 2020-03-03 08:11:10
问题 I am trying execute the following playbook using python script. playbook = dict( name = "Enable Site", hosts = [host], gather_facts = 'no', tasks = [ dict(action=dict( module='find', args=dict(paths="/etc/apache2/sites-enabled")), register='files_found'), dict(action=dict( module='shell', args="cd /etc/apache2/sites-enabled && a2dissite *"), register='shell_out', when='files_found.matched > 0'), dict(action=dict(module='shell', args="a2ensite " + site_name), register='shell_out'), dict(action