GoogleCloudPlatform.google_cloud_ops_agents

Ansible Role for Cloud Operations

This Ansible role installs the Cloud Operations agents.

How to Install the Role

  • Recommended: Use Ansible Galaxy for managing dependencies. Run this command to install:

    ansible-galaxy install googlecloudplatform.google_cloud_ops_agents
    
  • Alternatively, use GitHub submodules. Clone this repository into your roles directory (normally next to your playbook) using the name googlecloudplatform.google_cloud_ops_agents:

    git clone <this-git-repo> roles/googlecloudplatform.google_cloud_ops_agents
    

You can also check out a detailed tutorial.

Requirements

You need permission to access the Google Cloud API. If you are using an older Compute Engine instance or one created without the default credentials, follow these steps: https://cloud.google.com/monitoring/agent/authorization#before_you_begin.

Role Variables

  • The agent_type variable is required to select which agent to configure. Available options are monitoring, logging, and ops-agent.

  • Use the package_state variable to specify if the agent should be present (default) or absent.

  • The version variable allows you to specify which agent version to install. Possible values include latest (default), MAJOR_VERSION.*.*, and MAJOR_VERSION.MINOR_VERSION.PATCH_VERSION.

    • Using version=latest keeps your agent updated but may introduce breaking changes with new major releases. For production, use version=MAJOR_VERSION.*.* for safer updates.

    • Setting version=MAJOR_VERSION.*.* ensures you only get updates from the specified major version, reducing the risk of issues.

    • version=MAJOR_VERSION.MINOR_VERSION.PATCH_VERSION is not recommended, as it prevents receiving important updates and bug fixes.

  • The main_config_file variable allows you to specify a custom configuration file path. This will replace the default configuration on the target VM.

For more configuration details, refer to:

By default, the agent tracks system resources like CPU and memory. For third-party application monitoring, use the additional_config_dir variable to specify a directory containing plugin configuration files. All .conf files in this directory will be added to the agent's plugin directory on the target VM. The main config file should include this directory. Note that this variable can only be used for monitoring or logging agents.

To learn more about monitoring third-party applications, visit: Monitoring third-party applications.

Example Playbooks

Here are some examples of how to use the role:

# Installing the Monitoring and Logging agents
- hosts: all
  become: true
  roles:
    - role: googlecloudplatform.google_cloud_ops_agents
      vars:
        agent_type: monitoring

    - role: googlecloudplatform.google_cloud_ops_agents
      vars:
        agent_type: logging
# Installing the Monitoring and Logging agents with custom configurations
- hosts: all
  become: true
  roles:
    - role: googlecloudplatform.google_cloud_ops_agents
      vars:
        agent_type: monitoring
        version: latest
        main_config_file: monitoring_agent.conf
        additional_config_dir: monitoring_agent_dir/

    - role: googlecloudplatform.google_cloud_ops_agents
      vars:
        agent_type: logging
        version: 1.*.*
        main_config_file: logging_agent.conf
        additional_config_dir: logging_agent_dir/
# Installing the Ops-Agent
- hosts: all
  become: true
  roles:
    - role: googlecloudplatform.google_cloud_ops_agents
      vars:
        agent_type: ops-agent
# Installing the Ops-Agent with custom configuration
- hosts: all
  become: true
  roles:
    - role: googlecloudplatform.google_cloud_ops_agents
      vars:
        agent_type: ops-agent
        version: 1.0.1
        main_config_file: ops_agent.yaml

Compatibility

Here’s a compatibility matrix for the Ansible role versions and supported agent versions.

Ansible Role Version Compatible Ops Agent Versions Compatible Logging Agent Versions Compatible Monitoring Agent Versions
1.x.x 2.x.x 1.x.x 6.x.x

Bug Reports and Feature Requests

For official help, file a case via https://cloud.google.com/support-hub.

License

Copyright 2020 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may not use
this file except in compliance with the License. You can find the License at:

    http://www.apache.org/licenses/LICENSE-2.0

Software distributed under the License is distributed "AS IS", WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND. See the License for more information on permissions and limitations.
Informazioni sul progetto

Install the Google Cloud Ops Agents

Installa
ansible-galaxy install GoogleCloudPlatform.google_cloud_ops_agents
Licenza
apache-2.0
Download
112k
Proprietario