finish adding terraform and vault archive

This commit is contained in:
Matthew Stobbs
2025-03-22 17:36:09 -06:00
parent ed3cc1d560
commit 63a83f2ec3
8 changed files with 139 additions and 22 deletions

View File

@@ -1,13 +1,38 @@
- name: Download terraform archive
ansible.builtin.get_url:
dest: "{{ d_tempdir.path }}/{{ terraform.file }}"
url: "{{ terraform.url }}/{{ terraform.file }}"
decompress: false
mode: '0644'
# vim: set filetype=yaml.ansible :
---
- name: Check if terraform is already installed
register: r_terraform_inst
ansible.builtin.stat:
path: "{{ terraform.bin }}"
- name: Extract terraform archive
become: "{{ ext_become }}"
ansible.builtin.unarchive:
dest: "{{ path.archive }}/terraform"
src: "{{ d_tempdir.path }}/{{ terraform.file }}"
remote_src: true
- name: Download and install terraform
when:
- not r_terraform_inst.stat.exists
block:
- name: Download terraform archive
ansible.builtin.get_url:
dest: "{{ d_tempdir.path }}/{{ terraform.archive }}"
url: "{{ terraform.url }}/{{ terraform.archive }}"
mode: '0644'
decompress: false
- name: Ensure vault archive dir exists
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
path: "{{ terraform.path }}"
mode: '0755'
- name: Extract terraform archive
become: "{{ ext_become }}"
ansible.builtin.unarchive:
dest: "{{ terraform.path }}"
src: "{{ d_tempdir.path }}/{{ terraform.archive }}"
remote_src: true
- name: Link terraform executable
become: "{{ ext_become }}"
ansible.builtin.file:
state: link
src: "{{ terraform.path }}/terraform"
path: "{{ terraform.bin }}"