# vim: set filetype=yaml.ansible : --- - name: Check if terraform is already installed register: r_terraform_inst ansible.builtin.stat: path: "{{ terraform.bin }}" - 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 }}"