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

⭐️ ansible provider #4118

Merged
merged 2 commits into from
Jun 3, 2024
Merged

⭐️ ansible provider #4118

merged 2 commits into from
Jun 3, 2024

Conversation

chris-rock
Copy link
Member

This PR adds a new ansible provider to query ansible playbook files:

~/go/src/go.mondoo.com/cnquery ±> cnquery shell ansible providers/ansible/play/testdata/play_default.yml 
→ connected to Ansible Playbook
  ___ _ __   __ _ _   _  ___ _ __ _   _ 
 / __| '_ \ / _` | | | |/ _ \ '__| | | |
| (__| | | | (_| | |_| |  __/ |  | |_| |
 \___|_| |_|\__, |\__,_|\___|_|   \__, |
  mondoo™      |_|                |___/  interactive shell

cnquery> ansible.plays { tasks }
ansible.plays: [
  0: {
    tasks: [
      0: ansible.task name="ensure apache is at the latest version"
      1: ansible.task name="write the apache config file"
      2: ansible.task name="ensure apache is running"
    ]
  }
]
cnquery> 

A simple policy that uses this provider would look like:

policies:
  - uid: ansible-best-practices
    name: Ansible Best Practices
    version: 1.0.0
    authors:
      - name: Mondoo, Inc
        email: [email protected]
    groups:
      - filters:
        - mql: asset.platform == "ansible"
        checks:
          - uid: mondoo-ansible-block-error-handling
queries:
  - uid: mondoo-ansible-block-error-handling
    title: Ensure Tasks are wrapped in block error handling
    mql: ansible.plays.all(tasks.none(block == empty))

Copy link
Contributor

github-actions bot commented May 29, 2024

Test Results

3 047 tests   3 046 ✅  1m 30s ⏱️
  354 suites      1 💤
   26 files        0 ❌

Results for commit 086f27f.

♻️ This comment has been updated with latest results.

@vjeffrey
Copy link
Contributor

vjeffrey commented Jun 3, 2024

working nicely for me! 🚀

@chris-rock chris-rock merged commit 39bb10f into main Jun 3, 2024
16 checks passed
@chris-rock chris-rock deleted the chris-rock/ansible branch June 3, 2024 19:18
@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants