Sha256: 47f487994219387d7bf15d2995a7a9016f49a768b5b04b73a2ab7f066fb98810

Contents?: true

Size: 1.57 KB

Versions: 13

Compression:

Stored size: 1.57 KB

Contents

---
title: About the apt Resource
---

# apt

Use the `apt` InSpec audit resource to verify Apt repositories on the Debian and Ubuntu platforms, and also PPA repositories on the Ubuntu platform.

<br>

## Syntax

An `apt` resource block tests the contents of Apt and PPA repositories:

    describe apt('path') do
      it { should exist }
      it { should be_enabled }
    end

where

* `apt('path')` must specify an Apt or PPA repository
* `('path')` may be an `http://` address, a `ppa:` address, or a short `repo-name/ppa` address
* `exist` and `be_enabled` are a valid matchers for this resource

<br>

## Examples

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

### Test if apt repository exists and is enabled

    describe apt('http://ppa.launchpad.net/juju/stable/ubuntu') do
      it { should exist }
      it { should be_enabled }
    end

### Verify that a PPA repository exists and is enabled

    describe apt('ppa:nginx/stable') do
      it { should exist }
      it { should be_enabled }
    end

### Verify that a repository is not present

    describe apt('ubuntu-wine/ppa') do
      it { should_not exist }
      it { should_not be_enabled }
    end

<br>

## Matchers

This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).


### be_enabled

The `be_enabled` matcher tests if a package exists in the repository:

    it { should be_enabled }

### exist

The `exist` matcher tests if a package exists on the system:

    it { should exist }

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
inspec-1.51.0 docs/resources/apt.md.erb
inspec-1.50.1 docs/resources/apt.md.erb
inspec-1.49.2 docs/resources/apt.md.erb
inspec-1.48.0 docs/resources/apt.md.erb
inspec-1.47.0 docs/resources/apt.md.erb
inspec-1.46.2 docs/resources/apt.md.erb
inspec-1.45.13 docs/resources/apt.md.erb
inspec-1.45.9 docs/resources/apt.md.erb
inspec-1.44.8 docs/resources/apt.md.erb
inspec-1.43.8 docs/resources/apt.md.erb
inspec-1.43.5 docs/resources/apt.md.erb
inspec-1.42.3 docs/resources/apt.md.erb
inspec-1.41.0 docs/resources/apt.md.erb