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

Can't scan the output of the ansible-inventory command (pipe method) #4846

Open
misterpantz opened this issue Nov 12, 2024 · 0 comments
Open

Comments

@misterpantz
Copy link
Contributor

Describe the bug
(Originally reported as a docs issue by @atomic111)

ansible-inventory -i hosts.ini --list | cnspec scan --inventory-format-ansible scans notebook but not the target that is defined in the inventory

shell is zsh

ansible-inventory -i inventory-test.yml --list | cnspec scan --inventory-format-ansible
→ no provider specified, defaulting to local. Use --help to see all providers.
→ loaded configuration from /Users/user/.config/mondoo/mondoo.yml using source default
→ using service account credentials
→ discover related assets for 1 asset(s)

 notebook 
────────────────────────────────   0%
→ synchronize assets

inventory file:

all:
  vars:
    ansible_connection: ssh
    ansible_port: 22
  hosts:
    debian12:
      ansible_host: 1.176.111.111
      ansible_user: admin
      ansible_ssh_private_key_file: ~/.ssh/key-rsa

To Reproduce
Steps to reproduce the behavior:

Run ansible-inventory -i hosts.ini --list | cnspec scan --inventory-format-ansible on an inventory file like the one above.

Expected behavior
cnspec scans inventory file

Screenshots or CLI Output

ansible-inventory -i inventory-test.yml --list | cnspec scan --inventory-format-ansible
→ no provider specified, defaulting to local. Use --help to see all providers.
→ loaded configuration from /Users/user/.config/mondoo/mondoo.yml using source default
→ using service account credentials
→ discover related assets for 1 asset(s)

 notebook 
────────────────────────────────   0%
→ synchronize assets

Desktop (please complete the following information):

using zsh

Additional context
Scanning Ansible inventory hosts.json does work fine. It's only the pipe method that isn't working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant