Skip to content

Commit

Permalink
docker/create.yml: create network before building local image
Browse files Browse the repository at this point in the history
Else the build will attempt to use a network that hasn't been created
yet. This is essentially a resurrection of ehartmann's PR against
molecule-docker before its death.

Closes: ansible-community#24
Signed-off-by: Jake Helmert <jhelmert@pacificbiosciences.com>
  • Loading branch information
pbjhelmert committed Nov 13, 2023
1 parent 92f6bb3 commit 6a94454
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/molecule_plugins/docker/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@
- not item.pre_build_image | default(false)
register: docker_images

- name: Create docker network(s)
ansible.builtin.include_tasks: tasks/create_network.yml
with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks(molecule_labels) }}"
loop_control:
label: "{{ item.name }}"
no_log: false

- name: Build an Ansible compatible image (new) # noqa: no-handler
when:
- platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0
Expand Down Expand Up @@ -113,13 +120,6 @@
retries: 3
delay: 30

- name: Create docker network(s)
ansible.builtin.include_tasks: tasks/create_network.yml
with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks(molecule_labels) }}"
loop_control:
label: "{{ item.name }}"
no_log: false

- name: Determine the CMD directives
ansible.builtin.set_fact:
command_directives_dict: >-
Expand Down

0 comments on commit 6a94454

Please sign in to comment.