diff --git a/vm-ansible/__main__.py b/vm-ansible/__main__.py index e829261..ea7ccb7 100644 --- a/vm-ansible/__main__.py +++ b/vm-ansible/__main__.py @@ -75,12 +75,18 @@ inventory = command.local.Command("a-inventory", opts = pulumi.ResourceOptions(depends_on = [ wait_time ]) ) -# Applying the command -for playbook in config.get('playbooks').split(','): - execute_ansible = command.local.Command(f"a-{playbook.split('.')[0]}", +deploy = command.local.Command('ap deploy', + create = 'ansible-playbook deploy.yml', + delete = 'rm -f ./ansible.log', + opts = pulumi.ResourceOptions(depends_on = [ inventory ]) +) + +# Running additional playbooks +for playbook in sorted(config.get('playbooks').split(',')): + execute_ansible = command.local.Command(f"ap {playbook.split('.')[0]}", create = f"ansible-playbook {playbook}", delete = "rm -f ./ansible.log", - opts = pulumi.ResourceOptions(depends_on = [ inventory ]) + opts = pulumi.ResourceOptions(depends_on = [ deploy ]) ) pulumi.export("ip", vm.network_interfaces[0]['addresses'][0])