-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [SAS-5484] Started working, but moving to our ansible host. * #32 - Concept working. * #32 - Forgot the playbook itself.
- Loading branch information
1 parent
2147fb8
commit 6aac108
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dependencies: | ||
- role: docker_login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
- name: docker image inspect - all nodes | ||
command: | ||
cmd: "docker image inspect {{ repository_deploy_image }}" | ||
become: "{{ docker_become_user is defined }}" | ||
become_user: "{{ docker_become_user|default(omit) }}" | ||
loop: "{{ groups['docker_swarm_nodes'] }}" | ||
loop_control: | ||
loop_var: docker_swarm_node | ||
label: "{{ docker_swarm_node }}" | ||
delegate_to: "{{ docker_swarm_node }}" | ||
register: image_inspect_result | ||
failed_when: false | ||
|
||
- name: look for any successful image_inspect_result | ||
set_fact: | ||
image_inspect_results_successful_node: "{{ item.docker_swarm_node }}" | ||
loop: "{{ image_inspect_result.results }}" | ||
loop_control: | ||
label: "{{ item.docker_swarm_node }}" | ||
when: item.rc == 0 | ||
|
||
- name: ensure a successful node was found | ||
assert: | ||
that: | ||
- image_inspect_results_successful_node is defined | ||
|
||
# the docker_image builtin provided by ansible is tricky to coerce into pushing when no other changes are necessary | ||
# in image_push we untag the image, then tag/push at the same time | ||
# since this role is intended to be run against a production service, we don't want to untag images in it | ||
# so we just use the command module instead | ||
- name: docker image push - found node | ||
command: | ||
cmd: "docker image push {{ repository_deploy_image }}" | ||
become: "{{ docker_become_user is defined }}" | ||
become_user: "{{ docker_become_user|default(omit) }}" | ||
delegate_to: "{{ image_inspect_results_successful_node }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- hosts: docker_services | ||
# nothing here should rely on gathered facts | ||
gather_facts: no | ||
roles: | ||
- role: docker_service_image_push |