Skip to content

Latest commit

 

History

History
215 lines (168 loc) · 12.2 KB

README.md

File metadata and controls

215 lines (168 loc) · 12.2 KB

Linode Ansible Collection

Ansible Galaxy Tests

The Ansible Linode Collection contains various plugins for managing Linode services.

Ansible version compatibility

This collection has been tested against following Ansible versions: >=2.9.10.

Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible.

Modules

Modules for managing Linode infrastructure.

Name Description
linode.cloud.api_request Make an arbitrary Linode API request.
linode.cloud.database_mysql Manage a Linode MySQL database.
linode.cloud.database_postgresql Manage a Linode PostgreSQL database.
linode.cloud.domain Manage Linode Domains.
linode.cloud.domain_record Manage Linode Domain Records.
linode.cloud.firewall Manage Linode Firewalls.
linode.cloud.firewall_device Manage Linode Firewall Devices.
linode.cloud.image Manage a Linode Image.
linode.cloud.instance Manage Linode Instances, Configs, and Disks.
linode.cloud.ip_assign Assign IPs to Linodes in a given Region.
linode.cloud.ip_rdns Manage a Linode IP address's rDNS.
linode.cloud.ip_share Manage the Linode shared IPs.
linode.cloud.lke_cluster Manage Linode LKE clusters.
linode.cloud.lke_node_pool Manage Linode LKE cluster node pools.
linode.cloud.nodebalancer Manage a Linode NodeBalancer.
linode.cloud.nodebalancer_node Manage Linode NodeBalancer Nodes.
linode.cloud.nodebalancer_stats Get info about a Linode Node Balancer Stats.
linode.cloud.object_keys Manage Linode Object Storage Keys.
linode.cloud.placement_group Manage a Linode Placement Group.
linode.cloud.placement_group_assign Manages a single assignment between a Linode and a Placement Group.
linode.cloud.ssh_key Manage a Linode SSH key.
linode.cloud.stackscript Manage a Linode StackScript.
linode.cloud.token Manage a Linode Token.
linode.cloud.user Manage a Linode User.
linode.cloud.volume Manage a Linode Volume.
linode.cloud.vpc Create, read, and update a Linode VPC.
linode.cloud.vpc_subnet Create, read, and update a Linode VPC Subnet.

Info Modules

Modules for retrieving information about existing Linode infrastructure.

Name Description
linode.cloud.account_availability_info Get info about a Linode Account Availability.
linode.cloud.account_info Get info about a Linode Account.
linode.cloud.child_account_info Get info about a Linode Child Account.
linode.cloud.database_mysql_info Get info about a Linode MySQL Managed Database.
linode.cloud.database_postgresql_info Get info about a Linode PostgreSQL Managed Database.
linode.cloud.domain_info Get info about a Linode Domain.
linode.cloud.domain_record_info Get info about a Linode Domain Records.
linode.cloud.firewall_info Get info about a Linode Firewall.
linode.cloud.image_info Get info about a Linode Image.
linode.cloud.instance_info Get info about a Linode Instance.
linode.cloud.ip_info Get info about a Linode IP.
linode.cloud.ipv6_range_info Get info about a Linode IPv6 range.
linode.cloud.lke_cluster_info Get info about a Linode LKE cluster.
linode.cloud.nodebalancer_info Get info about a Linode Node Balancer.
linode.cloud.object_cluster_info NOTE: This module has been deprecated because it relies on deprecated API endpoints. Going forward, region will be the preferred way to designate where Object Storage resources should be created.
linode.cloud.placement_group_info Get info about a Linode Placement Group.
linode.cloud.profile_info Get info about a Linode Profile.
linode.cloud.region_info Get info about a Linode Region.
linode.cloud.ssh_key_info Get info about a Linode SSH Key.
linode.cloud.stackscript_info Get info about a Linode StackScript.
linode.cloud.token_info Get info about a Linode Personal Access Token.
linode.cloud.type_info Get info about a Linode Type.
linode.cloud.user_info Get info about a Linode User.
linode.cloud.vlan_info Get info about a Linode VLAN.
linode.cloud.volume_info Get info about a Linode Volume.
linode.cloud.vpc_info Get info about a Linode VPC.
linode.cloud.vpc_subnet_info Get info about a Linode VPC Subnet.

List Modules

Modules for retrieving and filtering on multiple Linode resources.

Name Description
linode.cloud.account_availability_list List and filter on Account Availabilities.
linode.cloud.child_account_list List and filter on Child Account.
linode.cloud.database_engine_list List and filter on Managed Database engine types.
linode.cloud.database_list List and filter on Linode Managed Databases.
linode.cloud.domain_list List and filter on Domains.
linode.cloud.event_list List and filter on Events.
linode.cloud.firewall_list List and filter on Firewalls.
linode.cloud.image_list List and filter on Images.
linode.cloud.instance_list List and filter on Instances.
linode.cloud.instance_type_list NOTE: This module has been deprecated in favor of type_list.
linode.cloud.lke_type_list List and filter on LKE Types.
linode.cloud.lke_version_list List and filter on LKE Versions.
linode.cloud.network_transfer_prices_list List and filter on Network Transfer Prices.
linode.cloud.nodebalancer_list List and filter on Node Balancers.
linode.cloud.nodebalancer_type_list List and filter on Node Balancer Types.
linode.cloud.object_cluster_list NOTE: This module has been deprecated because it relies on deprecated API endpoints. Going forward, region will be the preferred way to designate where Object Storage resources should be created.
linode.cloud.placement_group_list List and filter on Placement Groups.
linode.cloud.region_list List and filter on Regions.
linode.cloud.ssh_key_list List and filter on SSH Keys.
linode.cloud.stackscript_list List and filter on StackScripts.
linode.cloud.token_list List and filter on Tokens.
linode.cloud.type_list List and filter on Types.
linode.cloud.user_list List and filter on Users.
linode.cloud.vlan_list List and filter on VLANs.
linode.cloud.volume_list List and filter on Linode Volumes.
linode.cloud.volume_type_list List and filter on Volume Types.
linode.cloud.vpc_ip_list List and filter on VPC IP Addresses.
linode.cloud.vpc_list List and filter on VPCs.
linode.cloud.vpc_subnet_list List and filter on VPC Subnets.
linode.cloud.vpcs_ip_list List and filter on all VPC IP Addresses.

Inventory Plugins

Dynamically add Linode infrastructure to an Ansible inventory.

Name
linode.cloud.instance

Installation

You can install the Linode collection with the Ansible Galaxy CLI:

ansible-galaxy collection install linode.cloud

The Python module dependencies are not installed by ansible-galaxy. They can be manually installed using pip:

pip install --upgrade -r https://raw.githubusercontent.com/linode/ansible_linode/main/requirements.txt

⚠️ NOTE: Python dependencies should always be reinstalled when upgrading collection versions

Usage

Once the Linode Ansible collection is installed, it can be referenced by its Fully Qualified Collection Namespace (FQCN): linode.cloud.module_name.

In order to use this collection, the LINODE_API_TOKEN environment variable must be set to a valid Linode API v4 token. Alternatively, you can pass your Linode API v4 token into the api_token option for each Linode module you reference.

The LINODE_UA_PREFIX environment variable or the ua_prefix module option can be used to specify a custom User-Agent prefix.

The LINODE_API_URL environment variable pr the api_url module option can be used to specify a custom API base url.

Example Playbook

---
- name: create linode instance
  hosts: localhost
  tasks:
    - name: Create a Linode instance    
      linode.cloud.instance:
        label: my-linode
        type: g6-nanode-1
        region: us-east
        image: linode/ubuntu22.04
        root_pass: verysecurepassword!!!
        state: present

For more information on Ansible collection usage, see Ansible's official usage guide.

Examples

Use-case examples for this collection can be found here.

Development

The following section outlines various information relating to the development of this collection.

Attaching a Debugger

To quickly and easily attach a debugger to a running module in this collection, you can use the madbg package:

  1. Install madbg in your local Python environment:
pip install madbg
  1. Call madbg.set_trace(...) at the location you would like to create a breakpoint at:
import madbg; madbg.set_trace()
  1. Run the module in either a playbook or a test.
  2. In a separate shell, run madbg connect.
  3. You should now be able to remotely debug the module as soon as the breakpoint is triggered.

Licensing

GNU General Public License v3.0.

See COPYING to see the full text.