Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
molecule / data / validate-dockerfile.yml
Size: Mime:
#!/usr/bin/env ansible-playbook
---
- hosts: localhost
  vars:
    platforms:
      # platforms supported as being managed by molecule/ansible, this does
      # not mean molecule itself can run on them.
      - image: alpine:edge
      - image: centos:7
      - image: centos:8
      - image: ubuntu:latest
      - image: debian:latest
  tasks:

    - name: create temporary dockerfiles
      tempfile:
        prefix: "molecule-dockerfile-{{ item.image }}"
        suffix: build
      register: temp_dockerfiles
      with_items: "{{ platforms }}"
      loop_control:
        label: "{{ item.image }}"

    - name: expand Dockerfile templates
      template:
        src: Dockerfile.j2
        dest: "{{ temp_dockerfiles.results[index].path }}"
      register: result
      with_items: "{{ platforms }}"
      loop_control:
        index_var: index
        label: "{{ item.image }}"

    - name: Test Dockerfile template
      docker_image:
        name: "{{ item.item.image }}"
        build:
          path: "."
          dockerfile: "{{ item.dest }}"
          pull: true
          nocache: true
        source: build
        state: present
        debug: true
        force_source: true
      with_items: "{{ result.results }}"
      loop_control:
        label: "{{ item.item.image }}"
      register: result

    - name: Clean up temporary Dockerfile's
      file:
        path: "{{ item }}"
        state: absent
      loop: "{{ temp_dockerfiles.results | map(attribute='path') | list }}"

    - debug: var=result