Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/328_podman_minio_localstack_rewr…
Browse files Browse the repository at this point in the history
…ite' into 243_rocky_9
  • Loading branch information
Don Sizemore committed Dec 20, 2023
2 parents 552f66d + c9306cf commit ae63ab6
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 88 deletions.
71 changes: 0 additions & 71 deletions tasks/docker.yml

This file was deleted.

41 changes: 32 additions & 9 deletions tasks/localstack.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
---

- ansible.builtin.import_tasks: docker.yml
- ansible.builtin.import_tasks: podman.yml

- ansible.builtin.import_tasks: aws_cli.yml

- ansible.builtin.import_tasks: aws_config.yml
- name: create localstack user
ansible.builtin.user:
name: '{{ localstack.user }}'

- name: ensure dot dir exists
file:
path: '~{{ localstack.user }}/.aws'
state: directory
owner: '{{ localstack.user }}'
mode: '0700'

- name: place localstack aws credentials
template:
src: localstack_aws_credentials.j2
dest: '~{{ localstack.user }}/.aws/credentials'
owner: '{{ localstack.user }}'
mode: '0600'

- name: place localstack aws config
template:
src: localstack_aws_config.j2
dest: '~{{ localstack.user }}/.aws/config'
owner: '{{ localstack.user }}'
mode: '0600'

# so we can run localstack task stand-alone
- ansible.builtin.import_tasks: dataverse-fqdn.yml
Expand All @@ -17,19 +40,19 @@
- name: place docker-compose.yml template
ansible.builtin.template:
src: localstack-compose.yml.j2
dest: '~{{ dataverse.payara.user }}/localstack-compose.yml'
dest: '~{{ localstack.user }}/localstack-compose.yml'
owner: '{{ localstack.user }}'

- name: ensure DATA_DIR exists
ansible.builtin.file:
path: '{{ localstack.data_dir }}'
state: directory
owner: '{{ dataverse.payara.user }}'
group: '{{ dataverse.payara.group }}'
owner: '{{ localstack.user }}'
mode: 0755

- name: start s3-test container
ansible.builtin.shell: 'docker compose -f localstack-compose.yml up -d'
- name: start localstack s3 container
ansible.builtin.shell: 'podman-compose -f localstack-compose.yml up -d'
become: true
become_user: '{{ dataverse.payara.user }}'
become_user: '{{ localstack.user }}'
args:
chdir: '~{{ dataverse.payara.user }}'
chdir: '~{{ localstack.user }}'
4 changes: 2 additions & 2 deletions tasks/localstack_create_bucket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- name: create localstack bucket for testing
ansible.builtin.shell: "aws --endpoint={{ custom_endpoint_escaped }} s3 mb s3://{{ bucket_options.bucket_name }}"
become: yes
become_user: "{{ dataverse.payara.user }}"
become_user: "{{ localstack.user }}"
when: bucket_options.custom_endpoint_url | length > 0

- name: place CORS.json
Expand All @@ -21,7 +21,7 @@
- name: set CORS on bucket when upload_redirect is true
ansible.builtin.shell: 'aws --endpoint={{ custom_endpoint_escaped }} s3api put-bucket-cors --bucket {{ bucket_options.bucket_name }} --cors-configuration file:///tmp/cors.json'
become: yes
become_user: "{{ dataverse.payara.user }}"
become_user: "{{ localstack.user }}"
when: bucket_options.upload_redirect == true

- name: debug
Expand Down
12 changes: 7 additions & 5 deletions tasks/minio.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---

- ansible.builtin.import_tasks: docker.yml
- ansible.builtin.import_tasks: podman.yml

- name: ensure minio service account exists
ansible.builtin.user:
name: '{{ minio.user }}'

- name: STORAGE | Import assert.yml
ansible.builtin.import_tasks: minio_assert.yml
Expand Down Expand Up @@ -33,8 +37,7 @@
ansible.builtin.file:
path: "{{ minio.docker.project_location }}/data"
state: directory
owner: '{{ dataverse.payara.user }}'
group: '{{ dataverse.payara.group }}'
owner: '{{ minio.user }}'
mode: "0755"
recurse: true
when:
Expand All @@ -45,8 +48,7 @@
ansible.builtin.template:
src: minio_compose.j2
dest: "{{ minio.docker.project_location }}/minio_compose.yml"
owner: '{{ dataverse.payara.user }}'
group: '{{ dataverse.payara.group }}'
owner: '{{ minio.user }}'
mode: "0644"
lstrip_blocks: true
force: true
Expand Down
6 changes: 6 additions & 0 deletions tasks/podman.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

- name: install podman
ansible.builtin.package:
name: ['podman','podman-compose','podman-docker']
state: latest
2 changes: 2 additions & 0 deletions templates/localstack_aws_config.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default]
region = {{ localstack.region }}
3 changes: 3 additions & 0 deletions templates/localstack_aws_credentials.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default]
aws_access_key_id = {{ localstack.access_key }}
aws_secret_access_key = {{ localstack.secret_access_key }}
7 changes: 6 additions & 1 deletion tests/group_vars/jenkins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,15 @@ java:
localstack:
enabled: true
container_name: dev_localstack
access_key: 4cc355_k3y
secret_access_key: s3cr3t_4cc355_k3y
region: us-east-2
# set to /tmp/localstack/data to enable persistence
data_dir: /tmp/localstack/data
debug: true
hostname_external: localstack
port: 4566
user: localstack
web_ui: 8888
buckets:
- label: LocalStack
Expand Down Expand Up @@ -336,13 +340,14 @@ maven:

minio:
enabled: true
user: minio
docker:
version: "latest"
service_name: "minio"
network:
name: "minio"
external: false
project_location: "/home/dataverse/minio"
project_location: "/home/minio/minio"
timezone: "America/New_York"
user: dataverse
group: dataverse
Expand Down

0 comments on commit ae63ab6

Please sign in to comment.