Files
trivy/pkg/iac/scanners/ansible/parser/module.go
Nikita Pivkin 9275e1532b feat(misconf): initial ansible scanning support (#9332)
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
Co-authored-by: Simar <simar@linux.com>
Co-authored-by: simar7 <1254783+simar7@users.noreply.github.com>
2025-12-05 06:20:37 +00:00

31 lines
711 B
Go

package parser
// Module represents a logical module in a playbook or task.
// It wraps a Node and provides module-specific utility methods.
//
// All the data and metadata for the module is stored in the embedded Node.
type Module struct {
*Node
Name string
}
// IsFreeForm returns true if the module is a free-form Ansible module.
// In Ansible, a free-form module is called using a single scalar value
// instead of a key-value mapping.
//
// Example:
//
// # Free-form
// - command: echo "Hello"
// # IsFreeForm() -> true
//
// # Structured
// - ansible.builtin.yum:
// name: vim
// state: present
// # IsFreeForm() -> false
func (m *Module) IsFreeForm() bool {
return m.Node.IsString()
}