Skip to content

Commit

Permalink
Only gather facts once. Use "image" instead of "inventory_hostname" t…
Browse files Browse the repository at this point in the history
…o set the image name.
  • Loading branch information
micahkemp-splunk committed Dec 4, 2019
1 parent 19cc0cc commit 3c17565
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# gather facts via setup in the role, which is after delegation
# we want to enable inventory configurations to make use of collected facts (like ansible_date_time)
# because this is set to run once, it only makes sense to call this role with delegation
- name: run setup to gather facts
setup:
run_once: true
4 changes: 2 additions & 2 deletions roles/docker_service_build/tasks/docker_build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: remove old docker image
docker_image:
name: "{{ inventory_hostname }}{% if not production_image %}_dev{% endif %}"
name: "{{ image }}{% if not production_image %}_dev{% endif %}"
tag: "{{ tags.build }}"
state: absent
become: yes
Expand All @@ -11,7 +11,7 @@
DOCKER_BUILDKIT: "1"
docker_image:
path: "{{ docker_build_directory.path }}"
name: "{{ inventory_hostname }}{% if not production_image %}_dev{% endif %}"
name: "{{ image }}{% if not production_image %}_dev{% endif %}"
tag: "{{ tags.build }}"
push: no
become: yes
Expand Down

0 comments on commit 3c17565

Please sign in to comment.