diodonfrost.terraform

ansible-role-terraform

molecule Ansible Galaxy

This role helps you install Terraform on your target machine.

Requirements

This role is made for Ansible version 2.5 and higher. It may not work with earlier versions. To install the role, run ansible-galaxy install diodonfrost.terraform.

  • Ansible >= 2.8
  • Python >= 2.7

Role Variables

This role has several variables. Here are the default values:

---
# Default settings for ansible-role-terraform

# Specify the Terraform version to install
# Check available versions: https://releases.hashicorp.com/terraform/index.json
# Default: latest
terraform_version: latest

# Specify the URL to download the Terraform package
# Default: use a local path defined in Ansible vars/*.yml
terraform_pkg_url: "{{ __terraform_pkg_url }}"

# Specify where to install the Terraform binary
# Default: use a local path defined in Ansible vars/*.yml
terraform_path: "{{ __terraform_default_path }}"

Dependencies

None

Example Playbook

Here’s a sample playbook to deploy the Terraform role on your localhost and install the latest Terraform version.

---
- hosts: localhost
  become: true
  roles:
    - role: diodonfrost.terraform

You can also specify a particular version of Terraform to install.

---
- hosts: localhost
  become: true
  roles:
    - role: ansible-role-terraform
      vars:
        terraform_version: 0.12.0-rc1

To install Terraform 0.11.14, you would use:

---
- hosts: localhost
  become: true
  roles:
    - role: ansible-role-terraform
      vars:
        terraform_version: 0.11.14

Local Testing

This project uses Molecule for development and testing.

To test or develop this project, you need:

Testing with Docker

# Install requirements
pip install -r requirements-dev.txt

# Test the Ansible role using Ubuntu 22.04
molecule test

# Test the Ansible role using Ubuntu 20.04
image=ansible-ubuntu:20.04 molecule test

# Test the Ansible role using the latest Alpine
image=ansible-alpine:latest molecule test

# Create a CentOS 7 instance
image=ansible-centos:7 molecule create

# Apply the role on the CentOS 7 instance
image=ansible-centos:7 molecule converge

# Run tests on the CentOS 7 instance
image=ansible-centos:7 molecule verify

Testing with Vagrant and Libvirt

# Test the Ansible role with FreeBSD
molecule test -s freebsd

# Test the Ansible role with OpenBSD
molecule test -s openbsd

# Test the Ansible role with Windows
molecule test -s windows

License

Apache 2

Author Information

This role was created by diodonfrost in 2019.

Informazioni sul progetto

Ansible role for install the latest version of Terraform

Installa
ansible-galaxy install diodonfrost.terraform
Licenza
apache-2.0
Download
76k
Proprietario