Skip to content

Commit

Permalink
fixing ansible inventory no-host-var bug
Browse files Browse the repository at this point in the history
  • Loading branch information
steiler committed May 9, 2023
1 parent ccd6e3b commit 315c139
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions clab/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ func (c *CLab) generateAnsibleInventory(w io.Writer) error {
hosts:
{{- range $nodes}}
{{.LongName}}:
{{- if (eq (index .Labels "ansible-no-host-var") "") }}
{{- if not (eq (index .Labels "ansible-no-host-var") "true") }}
ansible_host: {{.MgmtIPv4Address}}
{{- end -}}
{{- end}}
{{- end}}
{{- range $name, $nodes := .Groups}}
{{$name}}:
hosts:
{{- range $nodes}}
{{- range $nodes}}
{{.LongName}}:
{{- if not (eq (index .Labels "ansible-no-host-var") "true") }}
ansible_host: {{.MgmtIPv4Address}}
{{- end}}
{{- end -}}
{{- end}}
{{- end}}
`

Expand Down

0 comments on commit 315c139

Please sign in to comment.