Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tun
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
tun
Commits
177f6500
Commit
177f6500
authored
Dec 21, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into babeld
parents
7ec7dee4
0f9425bc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/inventory.ts
src/inventory.ts
+3
-3
No files found.
src/inventory.ts
View file @
177f6500
...
...
@@ -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
hosts
=
Object
.
fromEntries
(
rawHosts
);
// console.log(hosts);
const
rawHostsForSwitch
=
rawHosts
.
map
(
rh
=>
{
/*
const rawHostsForSwitch = rawHosts.map(rh => {
const hostVars = JSON.parse(JSON.stringify(rh[1]));
hostVars.ansible_ssh_host = hostVars.address;
hostVars.ansible_ssh_port = this.hosts[rh[0]].sshSystem || 22;
return [`switch-${rh[0]}`, hostVars];
});
const
switchHosts
=
Object
.
fromEntries
(
rawHostsForSwitch
);
const switchHosts = Object.fromEntries(rawHostsForSwitch);
*/
const
result
=
YAML
.
stringify
({
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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment