Permalink
Browse files

Production ready

If testing in molecule, user will be ubuntu
Install docker swarm so stacks can be deployed in a test env
This task lives in it's own file vagrant_swarm.yml

Generate the docker-stack.yml file from a template
debug ADMINPASSWORD to output

Deploy the stack
Init some basic tests
  • Loading branch information...
jahrik committed May 12, 2018
1 parent b43cae0 commit a301afe8d29db6cbb3f786b00c3c6bae9d371b45
Showing with 50 additions and 2 deletions.
  1. +50 −2 ark/tasks/main.yml
@@ -1,8 +1,15 @@
---
# tasks file for ark
# If built in molecule, user will be 'ubuntu'
# install docker swarm first
- include_tasks: vagrant_swarm.yml
when:
- ansible_user_id == 'ubuntu'
# ark will run with user:group 1000:1000 in the docker container itself,
# so I'm using that user:group for the volume as well.
- name: Create directories for docker volumes
become: true
file:
@@ -14,7 +21,7 @@
tags:
- ark
- name: Generate "{{ item }}"
- name: Generate config files
template:
src: "{{ item }}.j2"
dest: "{{ ark_dir }}/{{ item }}"
@@ -24,5 +31,46 @@
- GameUserSettings.ini
- Game.ini
- crontab
- docker-stack.yml
tags:
- ark
- name: lookup ADMINPASSWORD
debug:
msg: "{{ lookup('env','ADMINPASSWORD') }}"
- name: deploy the ark stack to docker swarm
become: true
command: docker stack deploy -c docker-stack.yml ark
args:
chdir: "{{ ark_dir }}"
# Test stuff
- name: Test for server creating log file
wait_for:
path: "{{ ark_dir }}/log/arkserver.log"
state: present
timeout: 30
msg: Timed out waiting for ark server log file
- debug:
msg: "IPs {{ ansible_all_ipv4_addresses }}"
# - name: Wait 30 seconds for port 7778
# wait_for:
# host: "{{ item }}"
# port: 7778
# timeout: 10
# # delay: 10
# with_items: "{{ ansible_all_ipv4_addresses }}"
- name: docker stack ps ark
become: true
shell: >
docker stack ps ark
register: docker_stack
- debug:
msg: "Network {{ docker_stack.stdout_lines }}"

0 comments on commit a301afe

Please sign in to comment.