Skip to content

Commit

Permalink
#164 clean up initial run
Browse files Browse the repository at this point in the history
  • Loading branch information
don.sizemore committed Apr 7, 2020
1 parent 139552c commit 1e64b74
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
36 changes: 19 additions & 17 deletions tasks/localstack.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
---

- name: install docker-ce repo
- name: we need yum-utils
yum:
name: '{{ localstack.docker.repo }}'
name: yum-utils
state: latest

- name: to install the docker-ce repo
shell: 'yum-config-manager --add-repo {{ localstack.docker.repo }}'

- name: install docker-ce
yum:
name: ['docker-ce','docker-ce-cli','containerd.io','docker-compose']
name: ['docker-ce','docker-ce-cli','containerd.io','docker-compose','python-docker-py']

- name: ensure /etc/docker exists
file:
path: /etc/docker
state: directory
owner: root
group: root
mode: 0755

- name: configure cidr range
template:
Expand All @@ -16,6 +27,7 @@
owner: root
group: root
mode: 0644
when: localstack.docker.cidr is undefined

- name: add ansible_user to docker group
user:
Expand All @@ -30,30 +42,20 @@
daemon_reload: yes
state: started

- name: ensure python3
yum:
name: ['python3','python3-pip']
state: latest

- name: install localstack
pip:
name: localstack
executable: pip3

# so we can run localstack task stand-alone
- include: dataverse-fqdn.yml

- name: is hostname_external set
set_fact:
hostname_external: '{{ public_hostname }}'
when: localstack.hostname_external | length == 0
when: localstack.hostname_external is undefined

- name: place docker-compose.yml template
template:
src: localstack-compose.yml.j2
dest: '{{ ansible_env.HOME }}/localstack-compose.yml'

- name: start s3-test container
docker-compose:
files: '{{ ansible_env.HOME }}/localstack-compose.yml'
state: present
shell: 'docker-compose -f localstack-compose.yml up -d'
args:
chdir: '{{ ansible_env.HOME }}'
4 changes: 2 additions & 2 deletions templates/localstack-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ services:
- "{{ localstack.web_ui }}-{{ localstack.web_ui }}:{{ localstack.web_ui }}-{{ localstack.web_ui }}"
environment:
- SERVICES=s3
- DEBUG={{ localstack.debug }}'
- DEBUG={{ localstack.debug }}
- DATA_DIR={{ localstack.data_dir }}
- PORT_WEB_UI={{ localstack.web_ui }}
- LOCALSTACK_HOSTNAME={{ localstack.hostname_external }}
- LAMBDA_EXECUTOR=local
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
- "/tmp/localstack}:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"

0 comments on commit 1e64b74

Please sign in to comment.