Skip to content

Commit

Permalink
Local action tasks, fixes #13
Browse files Browse the repository at this point in the history
- Back to local_action for the download and unzip tasks
- Already using grep, so let's just awk for the SHA and then register it
- Add remote install capability (thanks @bilke)
  • Loading branch information
brianshumate committed Apr 25, 2017
1 parent 5c7ea4d commit 1d075cc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 28 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,9 @@
## v1.5.4

- Update documentation on new netaddr dependency :sweat:

## v1.5.5

- Back to local_action for the download and unzip tasks
- Already using grep, so let's just awk for the SHA and then register it
- Add remote install capability (thanks @bilke)
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Thank you to all these fine folks for helping with ansible-vault!

- [@pierrefh](https://github.com/pierrefh)
- [@arledesma](https://github.com/arledesma)
- [@bilke](https://github.com/bilke)
35 changes: 8 additions & 27 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,42 @@
tags: installation

- name: Check Vault package checksum file
local_action: stat path="{{ role_path }}/files/vault_{{ vault_version }}_SHA256SUMS"
become: no
connection: local
stat:
path: "{{ role_path }}/files/vault_{{ vault_version }}_SHA256SUMS"
run_once: true
register: vault_checksum

- name: Get Vault package checksum file
local_action: get_url url="{{ vault_checksum_file_url }}"
dest="{{ role_path }}/files/vault_{{ vault_version }}_SHA256SUMS"
become: no
connection: local
get_url:
url: "{{ vault_checksum_file_url }}"
dest: "{{ role_path }}/files/vault_{{ vault_version }}_SHA256SUMS"
run_once: true
tags: installation
when: vault_checksum.stat.exists == False

- name: Get Vault package checksum
local_action: shell grep "{{ vault_pkg }}" "{{ role_path }}/files/vault_{{ vault_version }}_SHA256SUMS" | awk '{print $1}'
become: no
connection: local
shell: "grep {{ vault_pkg }} {{ role_path }}/files/vault_{{ vault_version }}_SHA256SUMS"
run_once: true
register: vault_sha256
tags: installation

- name: Check Vault package file
local_action: stat path="{{ role_path }}/files/{{ vault_pkg }}"
become: no
connection: local
stat:
path: "{{ role_path }}/files/{{ vault_pkg }}"
run_once: true
register: vault_package

- name: Download Vault
local_action: get_url url="{{ vault_zip_url }}" dest="{{ role_path }}/files/{{ vault_pkg }}" checksum="sha256:{{ vault_sha256.stdout }}" timeout="42"
become: no
connection: local
get_url:
url: "{{ vault_zip_url }}"
dest: "{{ role_path }}/files/{{ vault_pkg }}"
checksum: "sha256:{{ vault_sha256.stdout.split(' ')|first }}"
timeout: "42"
run_once: true
tags: installation
when: vault_package.stat.exists == False

- name: Unarchive Vault
local_action: unarchive src="{{ role_path }}/files/{{ vault_pkg }}" dest="{{ role_path }}/files/" creates="{{ role_path }}/files/vault"
become: no
connection: local
unarchive:
src: "{{ role_path }}/files/{{ vault_pkg }}"
dest: "{{ role_path }}/files/"
creates: "{{ role_path }}/files/vault"
run_once: true
tags: installation

Expand All @@ -74,11 +58,8 @@
tags: installation

- name: Cleanup
local_action: file path="{{ item }}" state="absent"
become: no
connection: local
file:
path: "{{ item }}"
state: absent
with_fileglob: "{{ role_path }}/files/vault"
run_once: true
tags: installation
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.5.4
v1.5.5

0 comments on commit 1d075cc

Please sign in to comment.