Skip to content

Commit

Permalink
fix: update molecule, add sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyjs committed Nov 18, 2024
1 parent c53d3e2 commit 8407bf0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
8 changes: 0 additions & 8 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,5 @@
- name: Converge
hosts: all
become: true

pre_tasks:
- name: Update apt cache.
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
when: ansible_os_family == 'Debian'

roles:
- role: jeffreyjs.packer
10 changes: 10 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Prepare
hosts: all
become: true
tasks:
- name: Update apt cache.
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
when: ansible_os_family == 'Debian'
8 changes: 8 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Verify
hosts: all
tasks:
- name: Check that packer is installed
ansible.builtin.stat:
path: "{{ packer_bin_path }}/packer"
register: packer_installed_result
4 changes: 4 additions & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
- name: Install unzip.
become: true
become_method: ansible.builtin.sudo
ansible.builtin.package:
name: unzip
state: present
Expand Down Expand Up @@ -61,6 +63,8 @@
when: packer_version_match.rc != 0 or installed_result.rc == 0

- name: Unarchive Packer.
become: true
become_method: ansible.builtin.sudo
ansible.builtin.unarchive:
src: "{{ packer_archive_path }}"
dest: "{{ packer_bin_path }}"
Expand Down
2 changes: 2 additions & 0 deletions tasks/uninstall.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
- name: Remove Packer.
become: true
become_method: ansible.builtin.sudo
ansible.builtin.file:
dest: "{{ packer_bin_path }}/packer"
state: absent
Expand Down

0 comments on commit 8407bf0

Please sign in to comment.