Get started with the UpCloud Ansible Inventory Collection

Contributed by: Toni Kangas

Installation

  1. Install UpCloud API’s Python bindings:

    pip3 install upcloud-api>=2.5.0
  2. Install the UpCloud Ansible Collection:

    ansible-galaxy collection install https://github.com/UpCloudLtd/upcloud-ansible-collection/releases/download/v0.6.0/community-upcloud-0.6.0.tar.gz

Getting Started

  1. Create an upcloud.yml inventory file:

    plugin: community.upcloud.upcloud
  2. Set API credentials:

    export UPCLOUD_USERNAME="your-username"
    export UPCLOUD_PASSWORD="your-password"
  3. View inventory:

    ansible-inventory -i upcloud.yml --graph --vars

Further examples

You can filter resources based on multiple criterias:

plugin: community.upcloud.upcloud
zones:
  - fi-hel2
labels:
  - role=prod
  - foo
states:
  - started
connect_with: private_ipv4
network: 035a0a8a-7704-4da5-820d-129fc8232714
server_group: Group name or UUID

Next steps

Check out how to use the Ansible Collection in tandem with UpCloud’s Terraform Provider to do a rolling update on a group of target servers.