Commit 177f6500 authored by nanahira's avatar nanahira

Merge branch 'master' into babeld

parents 7ec7dee4 0f9425bc
...@@ -100,16 +100,16 @@ class InventoryBuilder { ...@@ -100,16 +100,16 @@ class InventoryBuilder {
const rawHosts = await Promise.all(Object.values(this.hosts).map(async (h) => [h.name, await this.host_vars(h)])); const rawHosts = await Promise.all(Object.values(this.hosts).map(async (h) => [h.name, await this.host_vars(h)]));
const hosts = Object.fromEntries(rawHosts); const hosts = Object.fromEntries(rawHosts);
// console.log(hosts); // console.log(hosts);
const rawHostsForSwitch = rawHosts.map(rh => { /* const rawHostsForSwitch = rawHosts.map(rh => {
const hostVars = JSON.parse(JSON.stringify(rh[1])); const hostVars = JSON.parse(JSON.stringify(rh[1]));
hostVars.ansible_ssh_host = hostVars.address; hostVars.ansible_ssh_host = hostVars.address;
hostVars.ansible_ssh_port = this.hosts[rh[0]].sshSystem || 22; hostVars.ansible_ssh_port = this.hosts[rh[0]].sshSystem || 22;
return [`switch-${rh[0]}`, hostVars]; return [`switch-${rh[0]}`, hostVars];
}); });
const switchHosts = Object.fromEntries(rawHostsForSwitch); const switchHosts = Object.fromEntries(rawHostsForSwitch); */
const result = YAML.stringify({ const result = YAML.stringify({
wg: { hosts, vars: this.vars }, wg: { hosts, vars: this.vars },
switch: { hosts: switchHosts, vars: JSON.parse(JSON.stringify(this.vars)) } //switch: { hosts: switchHosts, vars: JSON.parse(JSON.stringify(this.vars)) }
}); });
return fs.promises.writeFile('result/inventory.yaml', result); return fs.promises.writeFile('result/inventory.yaml', result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment