-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ | |
- apps/aws-cli | ||
- apps/terraform | ||
- apps/terragrunt | ||
- apps/terraform-docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- name: Get latest version of terraform_docs | ||
shell: curl -Is https://github.com/terraform-docs/terraform-docs/releases/latest | grep -i 'location:' | cut -f2 -d'v' | cut -f1 -d'"' | ||
register: version | ||
changed_when: false | ||
|
||
- name: "Latest version of terraform_docs:" | ||
debug: | ||
var: version.stdout | ||
|
||
- name: "Set fact with latest version of terraform_docs" | ||
set_fact: | ||
terraform_docs_version: "{{ version.stdout }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- name: Directory for terraform_docs | ||
file: | ||
path: /tmp/terraform_docs | ||
state: directory | ||
|
||
- name: Download terraform_docs binary | ||
get_url: | ||
url: "https://github.com/terraform-docs/terraform-docs/releases/download/v{{ terraform_docs_version }}/terraform-docs-v{{ terraform_docs_version }}-linux-amd64.tar.gz" | ||
dest: /tmp/terraform_docs/terraform_docs.tar.gz | ||
|
||
- name: Unarchive a file that is already on the remote machine | ||
unarchive: | ||
src: /tmp/terraform_docs/terraform_docs.tar.gz | ||
dest: /tmp/terraform_docs | ||
remote_src: yes | ||
|
||
- name: Copy terraform_docs | ||
copy: | ||
src: "/tmp/terraform_docs/terraform-docs" | ||
dest: "/usr/local/bin/terraform-docs" | ||
remote_src: true | ||
mode: 0755 | ||
owner: root | ||
group: root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Get installed version | ||
become: true | ||
become_user: "{{ user_name }}" | ||
shell: terraform-docs version | awk '{print $3}' | cut -f2 -d'v' | ||
register: installed_terraform_docs_version | ||
changed_when: false | ||
ignore_errors: true | ||
|
||
- name: "Installed version of terraform_docs:" | ||
debug: | ||
var: installed_terraform_docs_version.stdout | ||
|
||
- include_tasks: get_latest_version.yml | ||
when: terraform_docs_version is not defined | ||
|
||
- include_tasks: install.yml | ||
when: installed_terraform_docs_version.stdout != terraform_docs_version |