Skip to main content

Ansible playbook for Contrast agents

An Ansible playbook lets you use a repeatable process for deploying Contrast agents in your build systems. The Ansible playbook for Contrast automatically installs a Contrast agent in a specific directory under the ownership and permissions of a specified user.

You can use an Ansible playbook for any of the Contrast agents.

Resources

The Contrast Ansible role provides files that you can use to define the Ansible role and tasks for Contrast. The instance running this role needs Contrast login credentials and network access to Contrast.

  • The vagrantfile lets you configure the use of the Ansible playbook to deploy Contrast agents.

  • The defaults/main.yml file lets you define the Contrast role variables for the Ansible playbook:

    contrast_api_key: <apikey>
    contrast_service_key: <servicekey>
    contrast_username: <email@yourcompany.com>
    contrast_teamserver_url: <https://app.contrastsecurity.com>
    contrast_teamserver_organization: <organizationname>
    contrast_agent_type: java?jvm=1_6
    contrast_agent_path_group: vagrant
    contrast_agent_path_owner: vagrant
    contrast_agent_path: "/opt"
    • Replace <apikey> with the API key from the Contrast web interface

    • Replace <service key> with the service key from the Contrast web interface

    • Replace <email@yourcompany.com> with the Contrast username that you received when you activated your account.

    • Replace <organizationmame> with the name of your Contrast organization.

  • The tasks/main.yml file lets you define the tasks for the role.

Ansible Playbook example

This example shows how to apply the Contrast role to any server host that uses the playbook.

- hosts: servers
  roles:
     - { role: contrast }