This repository was archived by the owner on Oct 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +31
-1
lines changed Expand file tree Collapse file tree 4 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ These variables are defined in [defaults/main.yml](./defaults/main.yml):
21
21
22
22
terraform_binary_dir_path: "/usr/local/bin"
23
23
24
+ terraform_plugin_urls: []
25
+
24
26
Dependencies
25
27
------------
26
28
Original file line number Diff line number Diff line change @@ -5,3 +5,5 @@ terraform_architecture: 'amd64' # enum, one of 386|amd64|arm
5
5
terraform_version : ' 0.12.24'
6
6
7
7
terraform_binary_dir_path : " /usr/local/bin"
8
+
9
+ terraform_plugin_urls : []
Original file line number Diff line number Diff line change 9
9
vars :
10
10
terraform_version : " {{ version }}"
11
11
terraform_binary_dir_path : /usr/bin
12
+ terraform_plugin_urls :
13
+ - https://github.com/dmacvicar/terraform-provider-libvirt/releases/download/v0.6.11/terraform-provider-libvirt_0.6.11_linux_amd64.zip
12
14
13
15
post_tasks :
14
16
- name : terraform should be installed
Original file line number Diff line number Diff line change 17
17
18
18
# from https://terraform.io/downloads.html
19
19
- name : establish (download) binary
20
- when : v['stdout'] is not defined or terraform_version not in v.stdout
20
+ when : >-
21
+ v['stdout'] is not defined or
22
+ terraform_version not in v.stdout
21
23
become : true
22
24
unarchive :
23
25
src : https://releases.hashicorp.com/terraform/{{ terraform_version }}/terraform_{{ terraform_version }}_{{ ansible_system | lower }}_{{ terraform_architecture }}.zip # noqa 204
24
26
dest : " {{ terraform_binary_dir_path }}"
25
27
remote_src : true
26
28
creates : " {{ terraform_binary_dir_path }}/terraform"
27
29
tags : install
30
+
31
+ - name : establish plugins
32
+ when : terraform_plugin_urls | length > 0
33
+ tags : install
34
+ block :
35
+ - name : establish plugins directory
36
+ loop :
37
+ - .terraform.d/
38
+ - .terraform.d/plugins/
39
+ file :
40
+ path : " {{ ansible_env.HOME }}/{{ item }}"
41
+ state : directory
42
+ owner : " {{ ansible_env.USER | default(ansible_user_id) }}"
43
+ group : " {{ ansible_env.USER | default(ansible_user_id) }}"
44
+ mode : " u=rwx,go=rx"
45
+
46
+ - name : establish plugins
47
+ loop : " {{ terraform_plugin_urls }}"
48
+ unarchive :
49
+ src : " {{ item }}"
50
+ dest : " {{ ansible_env.HOME }}/.terraform.d/plugins/"
51
+ remote_src : true
You can’t perform that action at this time.
0 commit comments