---
# tasks file for molecule
- name: install requirements
  package:
    name: "{{ molecule_requirements }}"
    state: present
  register: molecule_install_requirements
  until: molecule_install_requirements is succeeded
  retries: 3

- name: register molecule state
  stat:
    path: /usr/local/bin/molecule
  register: register_molecule_state

- name: install molecule
  pip:
    name: "{{ molecule_packages }}"
    state: present
    extra_args: "{{ molecule_extra_args | default(omit) }}"
  register: molecule_install_molecule
  until: molecule_install_molecule is succeeded
  retries: 3
  when:
    - not register_molecule_state.stat.exists
