diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 82e7f00..0f29416 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -2,6 +2,29 @@ - name: Converge hosts: all + pre_tasks: + - name: Update apt cache + ansible.builtin.apt: + update_cache: true + cache_valid_time: 600 + + - name: Ensure required packages are installed + ansible.builtin.package: + name: "{{ dependency }}" + state: present + loop: "{{ nvm_dependencies }}" + loop_control: + loop_var: dependency + + - name: Create users for testing + ansible.builtin.user: + name: "{{ user.username }}" + shell: /bin/bash + state: present + with_items: "{{ users }}" + loop_control: + loop_var: user + roles: - role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" nvm_dependencies: diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index dc65279..678ba5b 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -31,7 +31,6 @@ provisioner: name: ansible playbooks: converge: ${MOLECULE_PLAYBOOK:-converge.yml} - prepare: prepare.yml verifier: name: ansible diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml deleted file mode 100644 index 8f525d7..0000000 --- a/molecule/default/prepare.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: Prepare - hosts: all - become: true - - tasks: - - name: Ensure required packages are installed - ansible.builtin.package: - name: "{{ dependency }}" - state: present - loop: "{{ nvm_dependencies }}" - loop_control: - loop_var: dependency - - - name: Create users for testing - ansible.builtin.user: - name: "{{ user.username }}" - shell: /bin/bash - state: present - with_items: "{{ users }}" - loop_control: - loop_var: user