Skip to content
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
41 changes: 41 additions & 0 deletions docs-chef-io/content/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
+++
title = "About the Chef InSpec Podman resource pack"
draft = false
linkTitle = "Podman resource pack"
summary = "Chef InSpec resources for auditing Podman."

[cascade]
[cascade.params]
platform = "podman"

[menu.podman]
title = "About Podman resources"
identifier = "inspec/resources/podman/about"
parent = "inspec/resources/podman"
weight = 10
+++

The InSpec Podman resources allow you to test and validate the state of Podman containers, images, pods, networks, and volumes.

## Support

The InSpec Podman resources were part of InSpec core through InSpec 6.
Starting in InSpec 7, they're released separately as a Ruby gem.

## Usage

To add this resource pack to an InSpec profile, add the `inspec-podman-resources` gem as a dependency in your `inspec.yml` file:

```yaml
depends:
- name: inspec-podman-resources
gem: inspec-podman-resources
```

## Podman resources

{{< inspec_resources_filter >}}

The following Chef InSpec Podman resources are available in this resource pack.

{{< inspec_resources section="podman" platform="podman" >}}
50 changes: 12 additions & 38 deletions docs/resources/podman.md → docs-chef-io/content/podman.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
+++
title = "podman resource"
draft = false
gh_repo = "inspec"
platform = "unix"

[menu]
[menu.inspec]

[menu.podman]
title = "podman"
identifier = "inspec/resources/os/podman.md podman resource"
parent = "inspec/resources/os"
+++

Use the `podman` Chef InSpec audit resource to test the configuration of Podman resources.

## Availability

### Install

This resource is distributed with Chef InSpec and is automatically available for use.

## Syntax

Use the `podman` Chef InSpec audit resource to test multiple Podman containers.
Expand Down Expand Up @@ -110,7 +102,7 @@ where:

The following examples show how to use this Chef InSpec audit resource.

### Returns all running containers
Return all running containers:

```ruby
podman.containers.running?.ids.each do |id|
Expand All @@ -120,11 +112,7 @@ podman.containers.running?.ids.each do |id|
end
```

## Resource Parameter Examples

### containers

`containers` returns information about containers as returned by [podman ps -a](https://docs.podman.io/en/latest/markdown/podman.1.html).
Return information about containers as returned by [podman ps -a](https://docs.podman.io/en/latest/markdown/podman.1.html):

```ruby
describe podman.containers do
Expand All @@ -135,9 +123,7 @@ describe podman.containers do
end
```

### images

`images` returns information about a Podman image as returned by [podman images -a](https://docs.podman.io/en/latest/markdown/podman-images.1.html).
Return information about a Podman image as returned by [podman images -a](https://docs.podman.io/en/latest/markdown/podman-images.1.html):

```ruby
describe podman.images do
Expand All @@ -147,9 +133,7 @@ describe podman.images do
end
```

### pods

`pods` returns information about pods as returned by [podman pod ps](https://docs.podman.io/en/latest/markdown/podman-pod-ps.1.html).
Return information about pods as returned by [podman pod ps](https://docs.podman.io/en/latest/markdown/podman-pod-ps.1.html).

```ruby
describe podman.pods do
Expand All @@ -159,9 +143,7 @@ describe podman.pods do
end
```

### networks

`networks` returns information about a Podman network as returned by [podman network ls](https://docs.podman.io/en/latest/markdown/podman-network-ls.1.html).
Return information about a Podman network as returned by [podman network ls](https://docs.podman.io/en/latest/markdown/podman-network-ls.1.html):

```ruby
describe podman.networks do
Expand All @@ -171,9 +153,7 @@ describe podman.networks do
end
```

### volumes

`volumes` returns information about a Podman volume as returned by [podman volume ls](https://docs.podman.io/en/latest/markdown/podman-volume-ls.1.html).
Return information about a Podman volume as returned by [podman volume ls](https://docs.podman.io/en/latest/markdown/podman-volume-ls.1.html):

```ruby
describe podman.volumes do
Expand All @@ -182,19 +162,15 @@ describe podman.volumes do
end
```

### info

`info` returns the parsed result of [podman info](https://docs.podman.io/en/latest/markdown/podman-info.1.html).
Return the parsed result of [podman info](https://docs.podman.io/en/latest/markdown/podman-info.1.html).

```ruby
describe podman.info do
its("host.os") { should eq "linux" }
end
```

### version

`version` returns the parsed result of [podman version](https://docs.podman.io/en/latest/markdown/podman-version.1.html)
Return the parsed result of [podman version](https://docs.podman.io/en/latest/markdown/podman-version.1.html):

```ruby
describe podman.version do
Expand All @@ -203,9 +179,7 @@ describe podman.version do
end
```

### object('id')

`object` returns low-level information about Podman objects as returned by [podman inspect](https://docs.podman.io/en/latest/markdown/podman-inspect.1.html).
Return low-level information about Podman objects as returned by [podman inspect](https://docs.podman.io/en/latest/markdown/podman-inspect.1.html):

```ruby
describe podman.object(id) do
Expand All @@ -215,4 +189,4 @@ end

## Matchers

{{< readfile file="content/inspec/reusable/md/inspec_matchers_link.md" >}}
{{< readfile file="content/reusable/md/inspec_matchers_link.md" >}}
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
+++
title = "podman_container resource"
draft = false
gh_repo = "inspec"
platform = "unix"

[menu]
[menu.inspec]

[menu.podman]
title = "podman_container"
identifier = "inspec/resources/os/podman_container.md podman_container resource"
parent = "inspec/resources/os"
+++

Use the `podman_container` Chef InSpec audit resource to test the configuration of Podman containers.

## Availability

### Install

This resource is distributed with Chef InSpec and is automatically available for use.

## Syntax

Use the `podman_container` Chef InSpec audit resource to test the properties of a Podman container.
Expand Down Expand Up @@ -106,8 +98,9 @@ its('command') { should eq 'nc -ll -p 1234 -e /bin/cat' }

## Matchers

{{< readfile file="content/inspec/reusable/md/inspec_matchers_link.md" >}}
The specific matchers of this resource are: `exist` and `be_running`.
{{< readfile file="content/reusable/md/inspec_matchers_link.md" >}}

The specific matchers of this resource are: `exist` and `be_running`.

### exist

Expand All @@ -129,19 +122,15 @@ it { should be_running }

The following examples show how to use this Chef InSpec audit resource.

### Ensures container exists

The below test passes if the container `sweet_mendeleev` exists as part of the Podman instances.
Ensure the container `sweet_mendeleev` exists as part of the Podman instances:

```ruby
describe podman_container('sweet_mendeleev') do
it { should exist }
end
```

### Ensures container is in running status

The below test passes if the container `sweet_mendeleev` exists as part of the Podman instances and the status is running.
Ensure the container `sweet_mendeleev` exists as part of the Podman instances and the status is running:

```ruby
describe podman_container('sweet_mendeleev') do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
+++
title = "podman_image resource"
draft = false
gh_repo = "inspec"
platform = "unix"

[menu]
[menu.inspec]

[menu.podman]
title = "podman_image"
identifier = "inspec/resources/os/podman_image.md podman_image resource"
parent = "inspec/resources/os"
+++

Use the `podman_image` Chef InSpec audit resource to test the properties of a container image on Podman.

## Availability

### Install

This resource is distributed with Chef InSpec and is automatically available for use.

## Syntax

Use the `podman_image` Chef InSpec audit resource to test the properties of a container image on Podman.
Expand Down Expand Up @@ -156,7 +148,7 @@ its("virtual_size") { should eq 1636053 }

## Matchers

{{< readfile file="content/inspec/reusable/md/inspec_matchers_link.md" >}}
{{< readfile file="content/reusable/md/inspec_matchers_link.md" >}}

This resource has the following special matchers.

Expand All @@ -170,7 +162,7 @@ it { should exist }

## Examples

### Test if an image exists on Podman and verify the various image properties
Test if an image exists on Podman and verify the various image properties:

```ruby
describe podman_image("docker.io/library/busybox") do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
+++
title = "podman_network resource"
draft = false
gh_repo = "inspec"
platform = "unix"

[menu]
[menu.inspec]

[menu.podman]
title = "podman_network"
identifier = "inspec/resources/os/podman_network.md podman_network resource"
parent = "inspec/resources/os"
+++

Use the `podman_network` Chef InSpec audit resource to test the properties of existing Podman networks.

## Availability

### Install

This resource is distributed with Chef InSpec and is automatically available for use.

## Syntax

Use the `podman_network` Chef InSpec audit resource to test the properties of a Podman network.
Expand Down Expand Up @@ -156,7 +148,7 @@ its("options") { should eq nil }

## Matchers

{{< readfile file="content/inspec/reusable/md/inspec_matchers_link.md" >}}
{{< readfile file="content/reusable/md/inspec_matchers_link.md" >}}

This resource has the following special matchers.

Expand All @@ -170,7 +162,7 @@ it { should exist }

## Examples

### Tests if a given Podman network exists and verifies the various network properties
Test if a given Podman network exists and verifies the various network properties:

```ruby
describe podman_network("minikube") do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
+++
title = "podman_pod resource"
draft = false
gh_repo = "inspec"
platform = "unix"

[menu]
[menu.inspec]

[menu.podman]
title = "podman_pod"
identifier = "inspec/resources/os/podman_pod.md podman_pod resource"
parent = "inspec/resources/os"
+++

Use the `podman_pod` Chef InSpec audit resource to test the properties of a pod on Podman.

## Availability

### Install

This resource is distributed with Chef InSpec and is automatically available for use.

## Syntax

Use the `podman_pod` Chef InSpec audit resource to test the properties of a pod on Podman.
Expand Down Expand Up @@ -166,7 +158,7 @@ its("containers") { should_not be nil }

## Matchers

{{< readfile file="content/inspec/reusable/md/inspec_matchers_link.md" >}}
{{< readfile file="content/reusable/md/inspec_matchers_link.md" >}}

This resource has the following special matchers.

Expand All @@ -180,7 +172,7 @@ it { should exist }

## Examples

### Test if a pod exists on Podman and verifies pod properties
Test if a pod exists on Podman and verifies pod properties:

```ruby
describe podman_pod("nginx-frontend") do
Expand All @@ -203,7 +195,7 @@ describe podman_pod("nginx-frontend") do
end
```

### Test if a pod does not exist on Podman
Test if a pod doesn't exist on Podman:

```ruby
describe podman_pod("non_existing_pod") do
Expand Down
Loading