Skip to content

Commit

Permalink
refactor task names for descriptive OS levels.
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwizard242 committed Jul 6, 2020
1 parent c3c4510 commit f0dfa7e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
19 changes: 12 additions & 7 deletions tasks/install_debian.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
---
# tasks file for packer
# tasks file for packer | Debian/Ubuntu Family

- name: "Downloading archive for {{ packer_app }} {{ packer_version }} temporarily to {{ packer_dl_loc }} on Debian based systems"
- name: Debian/Ubuntu Family | Downloading archive for {{ packer_app }} {{ packer_version }} temporarily to {{ packer_dl_loc }}
get_url:
url: "{{ packer_dl_url }}/{{ packer_app }}/{{ packer_version }}/{{ packer_app }}_{{ packer_version }}_{{ packer_osarch }}.zip"
dest: "{{ packer_dl_loc }}"

# - name: Install python3-apt on Debian based systems, required for package_facts.
# apt:
# name: python3-apt
# state: present
# force_apt_get: yes
# update_cache: yes
# - name: Gather package facts to verify if unzip is installed on Debian based systems
# - name: Gather package facts to verify if unzip is installed
# package_facts:
# manager: apt
- name: Install unzip if it is currently not in installed state on Debian based systems.

- name: Debian/Ubuntu Family | Install unzip if it is currently not in installed state
apt:
name: unzip
state: present
force_apt_get: yes
update_cache: yes
# when: packages['unzip'] is not defined
- name: "Unarchive {{ packer_app }} on Debian based systems."

- name: Debian/Ubuntu Family | Unarchive {{ packer_app }}
unarchive:
src: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_osarch }}.zip"
dest: "{{ packer_bin_path }}"
remote_src: true
# - name: Uninstalling unzip as it was originally not in installed state on Debian based systems.

# - name: Uninstalling unzip as it was originally not in installed state
# apt:
# name: unzip
# state: absent
# force_apt_get: yes
# update_cache: yes
# when: packages['unzip'] is not defined
- name: "Remove {{ packer_app }} archive file from Debian based systems."

- name: Debian/Ubuntu Family | Remove {{ packer_app }} archive file
file:
path: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_osarch }}.zip"
state: absent
17 changes: 11 additions & 6 deletions tasks/install_el.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
---
# tasks file for packer
# tasks file for packer | EL Family

- name: "Downloading archive for {{ packer_app }} {{ packer_version }} temporarily to {{ packer_dl_loc }} on EL based systems"
- name: EL Family | Downloading archive for {{ packer_app }} {{ packer_version }} temporarily to {{ packer_dl_loc }}
get_url:
url: "{{ packer_dl_url }}/{{ packer_app }}/{{ packer_version }}/{{ packer_app }}_{{ packer_version }}_{{ packer_osarch }}.zip"
dest: "{{ packer_dl_loc }}"

# - name: Gather package facts to verify if unzip is installed on EL based systems
# package_facts:
# manager: rpm
- name: Install unzip if it is currently not in installed state on EL based systems.

- name: EL Family | Install unzip if it is currently not in installed state
yum:
name: unzip
state: present
update_cache: yes
# when: packages['unzip'] is not defined
- name: "{{ packer_app }}_unarchive on EL based systems"

- name: EL Family | {{ packer_app }}_unarchive
unarchive:
src: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_osarch }}.zip"
dest: "{{ packer_bin_path }}"
remote_src: true
# - name: Uninstalling unzip from Debian based systems as it was originally not in installed state on EL based systems.

# - name: Uninstalling unzip from Debian based systems as it was originally not in installed state
# yum:
# name: unzip
# state: absent
# when: packages['unzip'] is not defined
- name: "Remove {{ packer_app }} archive from EL based systems"

- name: EL Family | Remove {{ packer_app }} archive
file:
path: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_osarch }}.zip"
state: absent

0 comments on commit f0dfa7e

Please sign in to comment.