Sha256: b6f3d2637b58812deaa3cef4cc0b66fb934f5ce267a96c204d06b505b4252670

Contents?: true

Size: 1.72 KB

Versions: 20

Compression:

Stored size: 1.72 KB

Contents

---
title: About the apt Resource
platform: linux
---

# 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>

## Availability

### Installation

This resource is distributed along with InSpec itself. You can use it automatically.

### Version

This resource first became available in v1.0.0 of InSpec.

## 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

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

20 entries across 20 versions & 2 rubygems

Version Path
inspec-core-2.3.10 docs/resources/apt.md.erb
inspec-2.3.10 docs/resources/apt.md.erb
inspec-core-2.3.5 docs/resources/apt.md.erb
inspec-2.3.5 docs/resources/apt.md.erb
inspec-core-2.3.4 docs/resources/apt.md.erb
inspec-2.3.4 docs/resources/apt.md.erb
inspec-core-2.2.112 docs/resources/apt.md.erb
inspec-2.2.112 docs/resources/apt.md.erb
inspec-core-2.2.102 docs/resources/apt.md.erb
inspec-2.2.102 docs/resources/apt.md.erb
inspec-core-2.2.101 docs/resources/apt.md.erb
inspec-2.2.101 docs/resources/apt.md.erb
inspec-core-2.2.78 docs/resources/apt.md.erb
inspec-2.2.78 docs/resources/apt.md.erb
inspec-core-2.2.70 docs/resources/apt.md.erb
inspec-2.2.70 docs/resources/apt.md.erb
inspec-core-2.2.64 docs/resources/apt.md.erb
inspec-2.2.64 docs/resources/apt.md.erb
inspec-core-2.2.61 docs/resources/apt.md.erb
inspec-2.2.61 docs/resources/apt.md.erb