Skip to content

Commit

Permalink
Adds the checksum subscript var.
Browse files Browse the repository at this point in the history
Also reliably verifies that required vars are present and clears them after
the associated subscript is done.

References #206
  • Loading branch information
Steve Moyer committed Jul 7, 2020
1 parent d71f321 commit 038297f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
6 changes: 6 additions & 0 deletions clear_subscript_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

- name: "clear the project's subscript variables"
set_fact:
"{{ item.name }}":
with_items: "{{ subscript_vars }}"
6 changes: 6 additions & 0 deletions debug_subscript_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

- name: "debug the project's subscript variables"
debug:
var: "{{ item.name }}"
with_items: "{{ subscript_vars }}"
27 changes: 26 additions & 1 deletion install_from_archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# name of the directory (in /opt) where the application
# is finally installed.
#
# name: The application's formal name.
# title: The application's formal name.
#
# version: This value indicates what version should be downloaded
# and is generally set in the "workstation_versions.yml"
Expand All @@ -23,6 +23,9 @@
# Optional variables:
# -------- ---------
#
# checksum: The URL of the file containing a checksum for the archive
# which will be downloaded by this playbook.
#
# archive_path: If the archive includes a path prefix for each file, This
# value allows the archive to be "relocated" to a directory
# named by the version. If this variable is empty, the
Expand All @@ -34,6 +37,26 @@
# no templating is performed.
#

- name: "defines the github variables above"
set_fact:
subscript_vars:
- name: "archive_path"
required: false
- name: "checksum"
required: false
- name: "desktop_file"
required: false
- name: "key"
required: true
- name: "title"
required: true
- name: "url"
required: true
- name: "version"
required: true

- include: "./require_subscript_vars.yml"

- name: "calculate the installation and final directories for {{ title }}"
set_fact:
installation_directory: "/opt/{{ key }}"
Expand Down Expand Up @@ -72,3 +95,5 @@
src: "{{ desktop_file }}"
dest: "/usr/share/applications"
when: "desktop_file != ''"

- include: "./clear_subscript_vars.yml"
7 changes: 7 additions & 0 deletions require_subscript_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- name: "verifies that the required subscript variables are set"
assert:
that: "not {{ item.required }} or {{ item.name }} != ''"
quiet: true
with_items: "{{ subscript_vars }}"

0 comments on commit 038297f

Please sign in to comment.