Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the acf domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6121

Deprecated: Creation of dynamic property ACF::$fields is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields.php on line 138

Deprecated: Creation of dynamic property acf_loop::$loops is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php on line 28

Deprecated: Creation of dynamic property ACF::$loop is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php on line 269

Deprecated: Creation of dynamic property ACF::$revisions is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/revisions.php on line 397

Deprecated: Creation of dynamic property acf_validation::$errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php on line 28

Deprecated: Creation of dynamic property ACF::$validation is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php on line 214

Deprecated: Creation of dynamic property acf_form_customizer::$preview_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 28

Deprecated: Creation of dynamic property acf_form_customizer::$preview_fields is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 29

Deprecated: Creation of dynamic property acf_form_customizer::$preview_errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 30

Deprecated: Creation of dynamic property ACF::$form_front is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php on line 598

Deprecated: Creation of dynamic property acf_form_widget::$preview_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 34

Deprecated: Creation of dynamic property acf_form_widget::$preview_reference is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 35

Deprecated: Creation of dynamic property acf_form_widget::$preview_errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 36

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the all-in-one-wp-migration domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6121

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 54

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 828

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rocket domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6121

Deprecated: Creation of dynamic property acf_field_oembed::$width is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php on line 31

Deprecated: Creation of dynamic property acf_field_oembed::$height is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php on line 32

Deprecated: Creation of dynamic property acf_field_google_map::$default_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-google-map.php on line 33

Deprecated: Creation of dynamic property acf_field__group::$have_rows is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php on line 31

Deprecated: Creation of dynamic property acf_field_clone::$cloning is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-clone.php on line 34

Deprecated: Creation of dynamic property acf_field_clone::$have_rows is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-clone.php on line 35

Deprecated: Creation of dynamic property jh_acf_field_table::$settings is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-table-field/class-jh-acf-field-table.php on line 23
UpCloud

UpCloud Ansible Collection

benefit-7

Ansible is a popular configuration management tool for provisioning anything from individual cloud servers to entire cloud infrastructures. It executes the requested operation by following user-defined playbooks, lists of customisable actions written in YAML, on specified cloud servers.

Using Ansible, you can automate all bootstrapping operations, like installing and updating software, creating and removing users, and configuring system services. And to expand on those features, the UpCloud Ansible Collection adds a whole lot of newly available configuration options.

UpCloud Ansible Collection

The collection of Ansible options for UpCloud integrates our services with the management tool. It really makes Ansible a great addition to your development resources. It extends the available configuration options on Ansible, giving you greater control of your new deployments. Simply by installing the module, you can use the additional inventory definitions in your Ansible playbooks.

Playbooks in Ansible are basic text language configuration files designed to be human-readable. At a basic level, playbooks can be used to manage the configuration and deployment of any remote machines. Furthermore, at an advanced level, playbooks can sequence multi-tier rollouts, delegate actions to entire clusters, and integrate with monitoring services and load balancers.

Below is an example of the available inventory definitions.

plugin: community.upcloud.upcloud
zones:
  - fi-hel2
tags:
  - app
  - db
states:
  - started
network: 035a0a8a-7704-4da5-820d-129fc8232714

The inventory file allows you to manage multiple Cloud Servers easily and provision each according to your needs. You can filter servers based on their zone, tags, state, or the network they belong to.

Ansible and Terraform

Ansible is a great tool for making the configurations on your Cloud Servers once deployed. However, you first need to get the servers up and running. For this purpose, look no further than Terraform.

Terraform is a popular open-source infrastructure-as-code software tool that allows you to define infrastructure as code. It uses simple, human-readable language to safely and predictably manage cloud infrastructure by codifying APIs into declarative configuration files. Once the infrastructure has been deployed, Terraform is able to call on Ansible to do its thing to bootstrap the new Cloud Servers as required.

Running Ansible together with Terraform enables you to provision Cloud Servers directly after deployment. It allows you to make resources usable predictably, repeatably and much faster than configuring anything manually. It also enables easier maintenance and troubleshooting, thanks to the identical deployment steps which can eliminate human error.

Underneath is an example of how to integrate Ansible with your Terraform deployments.

# SSH connection and authentication
connection {
  host        = self.network_interface[0].ip_address
  type        = "ssh"
  user        = "root"
  private_key = file("/path/to/ssh-private-key")
}

# Wait until the Cloud Server is availble
provisioner "remote-exec" {
  inline = ["echo 'Cloud Server ready!'"]
}

# Provision the Cloud Server using Ansible
provisioner "local-exec" {
  command = <<-EOT
     ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook \
     -u root \
     -i '${self.network_interface[0].ip_address},' \
     --private-key '/path/to/ssh-private-key' \
     your-playbook.yml
  EOT
}

The above example includes three sections:

  1. Connection details use the public IP address of the Cloud Server, username, and the private SSH key counterpart of a public key the Cloud Server was deployed with to authenticate the connection.
  2. A remote execution provisioner is used to wait until the Cloud Server is reachable over SSH.
  3. The local execution provisioner then calls Ansible to run the requested playbook.
Get started

 

Ansible is quick to install and easy to run so head over to our Ansible collection GitHub repository to get started!

You might also be interested in learning more about Terraform. Check out our beginners tutorial and start codifying your cloud infrastructure.