--- - name: required debian packages apt: pkg: # required by ansible - unzip - name: get latest terraform release version uri: url: https://checkpoint-api.hashicorp.com/v1/check/terraform register: terraform_release_query # - name: check if terraform version matches # command: terraform --version # failed_when: False # changed_when: False # register: terraform_version_command - name: get terraform release checksums uri: url: "https://releases.hashicorp.com/terraform/{{ terraform_version }}/terraform_{{ terraform_version }}_SHA256SUMS" return_content: yes register: terraform_release_checksums_uri - name: download terraform release get_url: url: "{{ terraform_download_url }}" dest: "{{ terraform_download_dest }}" checksum: "{{ terraform_download_checksum }}" register: terraform_download - name: extract and install terraform unarchive: src: "{{terraform_download_dest}}" dest: /usr/local/bin copy: no