diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index c971e7c..2021395 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -16,3 +16,4 @@ docker_extra_conf: {} # max-file: 5 docker_conf: "{{ docker_base_conf | combine(docker_extra_conf, recursive=True) }}" + diff --git a/roles/docker/meta/main.yml b/roles/docker/meta/main.yml index 694db0d..b7fa454 100644 --- a/roles/docker/meta/main.yml +++ b/roles/docker/meta/main.yml @@ -2,3 +2,4 @@ dependencies: - role: repo_docker + - role: docker_compose diff --git a/roles/docker/tasks/install_RedHat.yml b/roles/docker/tasks/install_RedHat.yml index 1cbc07d..3adc559 100644 --- a/roles/docker/tasks/install_RedHat.yml +++ b/roles/docker/tasks/install_RedHat.yml @@ -5,8 +5,15 @@ name: - docker-ce - docker-ce-cli - - docker-compose - device-mapper-persistent-data - lvm2 state: present tags: docker + +- name: Remove packaged docker-compose + yum: + name: + - docker-compose + state: absent + tags: docker + diff --git a/roles/docker_compose/defaults/main.yml b/roles/docker_compose/defaults/main.yml new file mode 100644 index 0000000..d71ec6c --- /dev/null +++ b/roles/docker_compose/defaults/main.yml @@ -0,0 +1,3 @@ +--- + +docker_compose_version: 1.25.5 diff --git a/roles/docker_compose/tasks/main.yml b/roles/docker_compose/tasks/main.yml new file mode 100644 index 0000000..bf981d0 --- /dev/null +++ b/roles/docker_compose/tasks/main.yml @@ -0,0 +1,10 @@ +--- + +- name: Install docker-compose + get_url: + url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64 + dest: /usr/local/bin/docker-compose + mode: 0755 + environment: + - https_proxy: "{{ system_proxy | default('') }}" + tags: docker diff --git a/roles/seafile/tasks/cleanup.yml b/roles/seafile/tasks/cleanup.yml index 1763f36..9bc3452 100644 --- a/roles/seafile/tasks/cleanup.yml +++ b/roles/seafile/tasks/cleanup.yml @@ -1,6 +1,6 @@ --- -- name: Remove tmp files +- name: Remove tmp and obsolete files file: path={{ item }} state=absent with_items: - "{{ seafile_root_dir }}/tmp/seafile-server_{{ seafile_version }}_x86-64.tar.gz" @@ -8,5 +8,6 @@ - "{{ seafile_root_dir }}/tmp/seafile-pro-server_{{ seafile_version }}_x86-64_CentOS.tar.gz" - "{{ seafile_root_dir }}/tmp/seafile-pro-server-{{ seafile_version }}" - /etc/cron.d/seafil_gc - - "{{ seafile_root_dir }}/db_dumps" + - "{{ seafile_data_dir }}/db_dumps" + - "{{ seafile_data_dir }}/backup" tags: seafile diff --git a/roles/seafile/tasks/directories.yml b/roles/seafile/tasks/directories.yml index 161db63..c21c233 100644 --- a/roles/seafile/tasks/directories.yml +++ b/roles/seafile/tasks/directories.yml @@ -29,7 +29,7 @@ owner: "{{ seafile_user }}" group: "{{ seafile_user }}" - dir: "{{ seafile_data_dir }}/pro" - - dir: "{{ seafile_data_dir }}/backup" + - dir: "{{ seafile_root_dir }}/backup" mode: 700 owner: root group: root diff --git a/roles/seafile/tasks/install.yml b/roles/seafile/tasks/install.yml index 35f8fe1..81ab0a9 100644 --- a/roles/seafile/tasks/install.yml +++ b/roles/seafile/tasks/install.yml @@ -101,7 +101,7 @@ tags: seafile - name: Chown seafile install dir - command: chown -R {{ seafile_user }}:{{ seafile_group }} {{ seafile_root_dir }}/seafile-server/* + shell: chown -R {{ seafile_user }}:{{ seafile_group }} {{ seafile_root_dir }}/seafile-server/* args: warn: False when: seafile_install_mode != 'none' diff --git a/roles/seafile/templates/seafile_dump_db.sh.j2 b/roles/seafile/templates/seafile_dump_db.sh.j2 index 0ddbd43..ce4c047 100644 --- a/roles/seafile/templates/seafile_dump_db.sh.j2 +++ b/roles/seafile/templates/seafile_dump_db.sh.j2 @@ -1,9 +1,12 @@ #!/bin/sh for DB in {{ seafile_db_ccnet }} {{ seafile_db_seafile }} {{ seafile_db_seahub }}; do - /usr/bin/mysqldump --user={{ seafile_db_user }} \ - --password={{ seafile_db_pass }} \ - --host={{ seafile_db_server }} \ - --quick --single-transaction \ - --add-drop-table $DB | zstd -T0 -c > {{ seafile_data_dir }}/backup/$DB.sql.zst + /usr/bin/mysqldump \ + --quick --single-transaction \ +{% if seafile_db_server not in ['127.0.0.1', 'localhost'] %} + --user='{{ seafile_db_user }}' \ + --password='{{ seafile_db_pass }}' \ + --host={{ seafile_db_server }} \ +{% endif %} + --add-drop-table $DB | zstd -T0 -c > {{ seafile_root_dir }}/backup/$DB.sql.zst done diff --git a/roles/seafile/templates/seafile_rm_dumps.sh.j2 b/roles/seafile/templates/seafile_rm_dumps.sh.j2 index f1e9ba9..0e2d693 100644 --- a/roles/seafile/templates/seafile_rm_dumps.sh.j2 +++ b/roles/seafile/templates/seafile_rm_dumps.sh.j2 @@ -1,3 +1,3 @@ #!/bin/sh -rm -f {{ seafile_data_dir }}/backup/* +rm -f {{ seafile_root_dir }}/backup/*