Compare commits
4 Commits
a7e809a4df
...
208cde637d
Author | SHA1 | Date | |
---|---|---|---|
208cde637d | |||
b865b23baf | |||
7a81d01461 | |||
373adff418 |
@ -1,6 +1,6 @@
|
||||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- base_personal
|
||||
- base
|
||||
become: yes
|
||||
become_user: root
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- base_personal
|
||||
- base
|
||||
become: yes
|
||||
become_user: root
|
||||
|
@ -43,5 +43,5 @@ template:
|
||||
description: Password of the username in the cloud-init phase
|
||||
playbooks:
|
||||
type: String
|
||||
default: 'deploy.yml'
|
||||
description: "Ansible Playbooks to implement, separate by commas."
|
||||
default: ''
|
||||
description: "Additional playbooks to implement, separate by commas."
|
||||
|
@ -35,9 +35,9 @@ volume = lv.Volume("disk",
|
||||
|
||||
# Stream configuration files
|
||||
cloudinit = lv.CloudInitDisk("cloud-init",
|
||||
meta_data = Template(open("./cloud-init/meta-data.jinja", "r").read()).render(env),
|
||||
user_data = Template(open("./cloud-init/user-data.jinja", "r").read()).render(env),
|
||||
network_config = open("./cloud-init/network-config", "r").read()
|
||||
meta_data = Template(open("./templates/meta-data.jinja", "r").read()).render(env),
|
||||
user_data = Template(open("./templates/user-data.jinja", "r").read()).render(env),
|
||||
network_config = open("./templates/network-config", "r").read()
|
||||
)
|
||||
|
||||
vm = lv.Domain(config.get('hostname'),
|
||||
@ -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])
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- base_personal
|
||||
- base
|
||||
become: yes
|
||||
become_user: root
|
||||
|
Loading…
Reference in New Issue
Block a user