build
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
ladislav.dusa
2026-02-18 10:02:25 +01:00
parent b9a495539b
commit ea4f84e9fa

46
roles/terraform/tasks/main.yml Executable file
View File

@@ -0,0 +1,46 @@
- name: Install git
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
vars:
hashicorp_repo_url: "https://apt.releases.hashicorp.com"
hashicorp_keyring_path: "/usr/share/keyrings/hashicorp-archive-keyring.gpg"
block:
- name: Ensure required packages are installed
ansible.builtin.apt:
name:
- gnupg
- software-properties-common
state: present
update_cache: true
- name: Download HashiCorp GPG key
ansible.builtin.get_url:
url: "{{ hashicorp_repo_url }}/gpg"
dest: /tmp/hashicorp.gpg
mode: '0644'
- name: Convert GPG key to keyring format
ansible.builtin.command:
cmd: gpg --dearmor -o {{ hashicorp_keyring_path }} /tmp/hashicorp.gpg
args:
creates: "{{ hashicorp_keyring_path }}"
- name: Add HashiCorp APT repository
ansible.builtin.apt_repository:
repo: >
deb [arch={{ ansible_architecture | replace('x86_64','amd64') }}
signed-by={{ hashicorp_keyring_path }}]
{{ hashicorp_repo_url }}
{{ ansible_distribution_release }} main
filename: hashicorp
state: present
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
- name: Install Terraform
ansible.builtin.apt:
name: terraform
state: present