Skip to content
Snippets Groups Projects
main.yml 1.17 KiB
---

- include_tasks: ../functions/get_secret.yml
  with_items:
    - { path: "/srv/shared/noreply_email_pass", length: -1 } 
    - { path: "{{ basedir }}/mysql_root_pass",  length: 24 }
    - { path: "{{ basedir }}/mysql_user_pass",  length: 12 }

- name: create folder struct for wordpress
  file:
    path: "{{ item }}"
    state: "directory"
    owner: www-data
    group: www-data
  with_items:
    - "{{ basedir }}/"
    - "{{ basedir }}/db/"
    - "{{ basedir }}/config"
    - "{{ basedir }}/data/"
    - "{{ basedir }}/data/wp-content/"
    - "{{ basedir }}/data/wp-content/plugins/"
    - "{{ basedir }}/data/wp-content/plugins/wz-status/"

- name: create config file
  template:
    src: "{{ item }}"
    dest: "{{ basedir }}/{{ item }}"
  with_items:
    - Dockerfile
    - docker-compose.yml
    - config/uploads.ini
    - data/wp-content/plugins/wz-status/wz-status.php
  register: config_files

- name: "stop {{ servicename }} docker"
  community.docker.docker_compose_v2:
    project_src: "{{ basedir }}"
    state: absent
  when: config_files.changed 

- name: "start {{ servicename }} docker"
  community.docker.docker_compose_v2:
    project_src: "{{ basedir }}"
    state: present