Skip to content

Commit 761758d

Browse files
improve task output ansible python
1 parent 5a40272 commit 761758d

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

pkg/modules/ansible_python.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ func (o AnsiblePythonOutput) String() string {
135135
} else if o.WasChanged {
136136
status = "changed"
137137
}
138+
// When Results are available, expose flattened facts similarly to AsFacts
139+
if len(o.Results) > 0 {
140+
facts := o.AsFacts()
141+
142+
var b strings.Builder
143+
b.WriteString(fmt.Sprintf(" status: %s\n", status))
144+
if len(facts) > 0 {
145+
for k, v := range facts {
146+
b.WriteString(fmt.Sprintf(" %s: %v\n", k, v))
147+
}
148+
}
149+
return b.String()
150+
}
138151
return fmt.Sprintf(" status: %s\n msg: %q\n changed: %v\n", status, o.Msg, o.WasChanged)
139152
}
140153

pkg/runtime/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewCommandOptions(cfg *config.Config) *CommandOptions {
4242
UseShell: false,
4343
Interactive: false,
4444
UseSudo: false,
45-
InteractiveSudo: cfg.PrivilegeEscalation.UseInteractive,
45+
InteractiveSudo: false,
4646
BecomeFlags: cfg.PrivilegeEscalation.BecomeFlags,
4747
}
4848
}

0 commit comments

Comments
 (0)