Add ansible playbook files for docker image creation, docker network creation/deletion, docker container creation/deletion
diff --git a/xos/synchronizer/steps/sync_instances.yaml b/xos/synchronizer/steps/sync_instances.yaml
new file mode 100644
index 0000000..a129d02
--- /dev/null
+++ b/xos/synchronizer/steps/sync_instances.yaml
@@ -0,0 +1,45 @@
+---
+- hosts: {{ swarm_manager_address }}
+ become: true
+ tasks:
+ {% if delete -%}
+
+ - name: delete swarm service '{{ swarm_service_name }}'
+ shell: docker service rm {{ swarm_service_name }}
+ - name: remove the directory {{ host_volume_path }}
+ file:
+ path={{ host_volume_path }}
+ state=absent
+
+ {% elif update -%}
+
+ - name: Create host volume directory to share to docker container
+ file:
+ path={{ host_volume_path }}
+ state=directory
+ - name: update swarm service '{{ swarm_service_name }}'
+ shell: docker service update --force {{ volume }} {{ swarm_service_name }}
+ - name: get status of '{{ swarm_service_name }}' service
+ shell: docker service ps {{ swarm_service_name }}
+
+ {% else -%}
+
+ - name: remove the directory {{ host_volume_path }}
+ file:
+ path={{ host_volume_path }}
+ state=absent
+ - name: Create host volume directory to share to docker container
+ file:
+ path={{ host_volume_path }}
+ state=directory
+ - name: start swarm service '{{ swarm_service_name }}'
+ shell: docker service create {{ network_name }} --name {{ swarm_service_name }} {{ replica }} {{ restart_condition }} {{ volume }} {{ swarm_manager_address }}:{{ docker_registry_port }}/{{ image_name }}:{{ image_tag }}
+
+ {% endif %}
+
+
+ {% if not delete -%}
+ - name: inspect '{{ swarm_service_name }}' service of swarm mode
+ shell: docker service inspect {{ swarm_service_name }}
+ {% endif %}
+