Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ansible_httpapi_use_proxy: false to ansible inventory #1571

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions clab/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func (c *CLab) GenerateInventories() error {
// generateAnsibleInventory generates and writes ansible inventory file to w.
func (c *CLab) generateAnsibleInventory(w io.Writer) error {
invT := `all:
vars:
# The generated inventory is assumed to be used from the clab host.
# Hence no http proxy should be used. Therefore we make sure the http
# module does not attempt using any global http proxy.
ansible_httpapi_use_proxy: false
children:
{{- range $kind, $nodes := .Nodes}}
{{$kind}}:
Expand Down
10 changes: 10 additions & 0 deletions clab/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ func TestGenerateAnsibleInventory(t *testing.T) {
"case1": {
got: "test_data/topo1.yml",
want: `all:
vars:
# The generated inventory is assumed to be used from the clab host.
# Hence no http proxy should be used. Therefore we make sure the http
# module does not attempt using any global http proxy.
ansible_httpapi_use_proxy: false
children:
srl:
hosts:
Expand All @@ -31,6 +36,11 @@ func TestGenerateAnsibleInventory(t *testing.T) {
"case2": {
got: "test_data/topo8_ansible_groups.yml",
want: `all:
vars:
# The generated inventory is assumed to be used from the clab host.
# Hence no http proxy should be used. Therefore we make sure the http
# module does not attempt using any global http proxy.
ansible_httpapi_use_proxy: false
children:
linux:
hosts:
Expand Down