Skip to content

Commit

Permalink
Merge pull request #1369 from steiler/fix_ansible_inventory_no-host-v…
Browse files Browse the repository at this point in the history
…ariable

fixing ansible inventory no-host-var bug
  • Loading branch information
hellt committed May 9, 2023
2 parents 076187b + 315c139 commit 96d92d8
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 96d92d8

Please sign in to comment.