-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathansible.ts
32 lines (27 loc) · 946 Bytes
/
ansible.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as pulumi from "@pulumi/pulumi";
import * as command from "@pulumi/command";
import * as k8s from "@pulumi/kubernetes";
const renderPlaybookCmd = new command.local.Command("renderPlaybookCmd", {
create:
"cd ./k3s-ansible && ansible-playbook site.yml -i inventory/turingev/hosts.ini",
});
const ansibleInventoryCmd = new command.local.Command("ansibleInventoryCmd", {
create:
"ansible-inventory -i ./k3s-ansible/inventory/turingev/hosts.ini --list",
});
export const ansibleInventory = ansibleInventoryCmd.stdout.apply((v) => inv);
const getKubeconfigCmd = new command.remote.Command(
"getKubeconfigCmd",
{
create: "cat /root/.kube/config",
connection: {
host: ansibleInventory.apply((v) => v.master.hosts[0]),
port: 22,
user: "root",
},
},
{ dependsOn: [renderPlaybookCmd] },
);
export const provider = new k8s.Provider("doK8sProvider", {
kubeconfig: getKubeconfigCmd.stdout,
});