You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB
YAML

- name: Create a directory if it does not exist
ansible.builtin.file:
path: "{{docker_compose_directory}}/{{item.name}}"
state: directory
mode: '0755'
with_items: "{{services}}"
- name: Copy Docker Compose Files
copy:
src: "{{item.name}}/docker-compose.yml"
dest: "{{docker_compose_directory}}/{{item.name}}/docker-compose.yml"
with_items: "{{services}}"
- name: Install python dependencies (requests)
ansible.builtin.pip:
name: requests
- name: Install python dependencies (boto3)
ansible.builtin.pip:
name: boto3
- name: Find relevant volume(s) in S3
amazon.aws.aws_s3:
bucket: "{{aws_s3.bucket}}"
mode: list
region: "{{aws_s3.region}}"
s3_url: "{{aws_s3.s3_url}}"
prefix: "mealie"
aws_access_key: "{{aws_s3.aws_access_key}}"
aws_secret_key: "{{aws_s3_secrets.aws_secret_key}}"
register: s3_list_output
- debug: msg="{{s3_list_output.s3_keys}}"
- name: Download volume(s) from S3
amazon.aws.aws_s3:
bucket: "{{aws_s3.bucket}}"
object: "{{item}}"
dest: "/tmp/{{item}}"
mode: get
region: "{{aws_s3.region}}"
s3_url: "{{aws_s3.s3_url}}"
aws_access_key: "{{aws_s3.aws_access_key}}"
aws_secret_key: "{{aws_s3_secrets.aws_secret_key}}"
with_items: "{{s3_list_output.s3_keys}}"
- name: Create required docker networks
docker_network:
name: "{{item}}"
with_items: "{{ docker_networks }}"
- name: Update Portainer Stack
portainer:
username: admin
password: "{{portainer.password}}"
docker_compose_file_path: "{{docker_compose_directory}}/{{ item.name }}/docker-compose.yml"
stack_name: "{{ item.name }}"
with_items: "{{services}}"