0
0

Removed docker_dir variable

This commit is contained in:
Opnxng 2024-11-02 18:19:03 +08:00
parent 1cd5bfdc3a
commit ffa9777538
5 changed files with 29 additions and 36 deletions

View File

@ -22,7 +22,7 @@
- name: Set permissions of privatebin directory - name: Set permissions of privatebin directory
file: file:
path: "{{ docker_dir }}/privatebin/data" path: "/home/{{ ansible_user }}/Docker/privatebin/data"
state: directory state: directory
owner: 1000 owner: 1000
group: 1000 group: 1000
@ -33,12 +33,12 @@
- name: Compress privatebin directory - name: Compress privatebin directory
shell: "zip -r --password {{ backup_zip_password }} privatebin_{{ current_date.stdout }}.zip data" shell: "zip -r --password {{ backup_zip_password }} privatebin_{{ current_date.stdout }}.zip data"
args: args:
chdir: "{{ docker_dir }}/privatebin/" chdir: "/home/{{ ansible_user }}/Docker/privatebin/"
when: inventory_hostname == 'oracle1' when: inventory_hostname == 'oracle1'
- name: Set permissions of privatebin directory - name: Set permissions of privatebin directory
file: file:
path: "{{ docker_dir }}/privatebin/data" path: "/home/{{ ansible_user }}/Docker/privatebin/data"
state: directory state: directory
owner: 65534 owner: 65534
group: 82 group: 82
@ -62,14 +62,14 @@
- name: Remove privatebin.zip on remote server - name: Remove privatebin.zip on remote server
file: file:
path: "{{ docker_dir }}/privatebin/privatebin_{{ current_date.stdout }}.zip" path: "/home/{{ ansible_user }}/Docker/privatebin/privatebin_{{ current_date.stdout }}.zip"
state: absent state: absent
when: inventory_hostname == 'oracle1' when: inventory_hostname == 'oracle1'
# To Restore: # To Restore:
# cd ./Docker/privatebin # cd ./Docker/privatebin
# sudo unzip privatebin_2023-11-11.zip # sudo unzip privatebin_2023-11-11.zip
# sudo chown -R 65534:82 {{ docker_dir }}/privatebin/data # sudo chown -R 65534:82 /home/{{ ansible_user }}/Docker/privatebin/data
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@ -78,7 +78,7 @@
when: inventory_hostname == 'oracle3' when: inventory_hostname == 'oracle3'
- name: Prune Etherpaddb on remote server - name: Prune Etherpaddb on remote server
command: find {{ docker_dir }}/etherpad/backups -type f -mtime +2 -delete command: find /home/{{ ansible_user }}/Docker/etherpad/backups -type f -mtime +2 -delete
when: inventory_hostname == 'oracle3' when: inventory_hostname == 'oracle3'
- name: Copy Etherpaddb backups - name: Copy Etherpaddb backups
@ -103,8 +103,8 @@
- name: Compress gitea directory - name: Compress gitea directory
archive: archive:
path: "{{ docker_dir }}/gitea/data/" path: "/home/{{ ansible_user }}/Docker/gitea/data/"
dest: "{{ docker_dir }}/gitea/gitea_{{ current_date.stdout }}.tar" dest: "/home/{{ ansible_user }}/Docker/gitea/gitea_{{ current_date.stdout }}.tar"
format: tar format: tar
when: inventory_hostname == 'oracle3' when: inventory_hostname == 'oracle3'
@ -120,7 +120,7 @@
- name: Remove gitea.tar on remote server - name: Remove gitea.tar on remote server
file: file:
path: "{{ docker_dir }}/gitea/gitea_{{ current_date.stdout }}.tar" path: "/home/{{ ansible_user }}/Docker/gitea/gitea_{{ current_date.stdout }}.tar"
state: absent state: absent
when: inventory_hostname == 'oracle3' when: inventory_hostname == 'oracle3'
@ -140,8 +140,8 @@
# - name: Compress ntfy directory # - name: Compress ntfy directory
# archive: # archive:
# path: "{{ docker_dir }}/ntfy/" # path: "/home/{{ ansible_user }}/Docker/ntfy/"
# dest: "{{ docker_dir }}/ntfy.tar" # dest: "/home/{{ ansible_user }}/Docker/ntfy.tar"
# format: tar # format: tar
# become: true # become: true
# when: inventory_hostname == 'oracle3' # when: inventory_hostname == 'oracle3'
@ -158,7 +158,7 @@
# - name: Remove ntfy.tar # - name: Remove ntfy.tar
# file: # file:
# path: "{{ docker_dir }}/ntfy.tar" # path: "/home/{{ ansible_user }}/Docker/ntfy.tar"
# state: absent # state: absent
# when: inventory_hostname == 'oracle3' # when: inventory_hostname == 'oracle3'
@ -169,17 +169,17 @@
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
- name: Remove old weekly files from send - name: Remove old weekly files from send
command: find {{ docker_dir }}/send/uploads/ -name 7-\* -mmin +10130 -exec rm {} \; command: find /home/{{ ansible_user }}/Docker/send/uploads/ -name 7-\* -mmin +10130 -exec rm {} \;
when: inventory_hostname == 'oracle1' when: inventory_hostname == 'oracle1'
- name: Remove old daily files from send - name: Remove old daily files from send
command: find {{ docker_dir }}/send/uploads/ -name 1-\* -mmin +1500 -exec rm {} \; command: find /home/{{ ansible_user }}/Docker/send/uploads/ -name 1-\* -mmin +1500 -exec rm {} \;
when: inventory_hostname == 'oracle1' when: inventory_hostname == 'oracle1'
# - name: Compress send directory # - name: Compress send directory
# archive: # archive:
# path: "{{ docker_dir }}/send" # path: "/home/{{ ansible_user }}/Docker/send"
# dest: "{{ docker_dir }}/send.tar" # dest: "/home/{{ ansible_user }}/Docker/send.tar"
# format: tar # format: tar
# delegate_to: oracle1 # delegate_to: oracle1
# tags: never # tags: never
@ -198,7 +198,7 @@
# - name: Remove send.tar # - name: Remove send.tar
# file: # file:
# path: "{{ docker_dir }}/send.tar" # path: "/home/{{ ansible_user }}/Docker/send.tar"
# state: absent # state: absent
# tags: never # tags: never
# when: inventory_hostname == 'oracle1' # when: inventory_hostname == 'oracle1'

View File

@ -1,7 +0,0 @@
- name: Copy firefox directory
copy:
src: "firefox/"
dest: "{{ docker_dir }}/firefox"
owner: 1000
group: 1000
mode: 0755

View File

@ -2,7 +2,8 @@
set_fact: set_fact:
gnupg_folder: "/home/{{ control_user }}/.gnupg" gnupg_folder: "/home/{{ control_user }}/.gnupg"
# ---------------------------------------------------------------------------------------------------- # --------------------------------------------------
# Store git credentials with GPG and .netrc because SSH is too complicated for Gitea on Docker # Store git credentials with GPG and .netrc because SSH is too complicated for Gitea on Docker
- name: Remove existing .netrc - name: Remove existing .netrc
@ -17,11 +18,11 @@
state: absent state: absent
delegate_to: "{{ control_host }}" delegate_to: "{{ control_host }}"
# ---------------------------------------------------------------------------------------------------- # --------------------------------------------------
- name: Reminder to generate GPG key by hand - name: Reminder to generate GPG key by hand
pause: pause:
prompt: "Generate GPG key using gpg --gen-key --homedir /home/{{ user }}/.gnupg --pinentry-mode loopback" prompt: "Generate GPG key using gpg --gen-key --homedir /home/{{ control_user }}/.gnupg --pinentry-mode loopback"
delegate_to: "{{ control_host }}" delegate_to: "{{ control_host }}"
- name: Set up .netrc - name: Set up .netrc

View File

@ -6,18 +6,18 @@
- vars/secrets.yaml - vars/secrets.yaml
- vars/services.yaml - vars/services.yaml
tasks: tasks:
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
- name: Docker Compose down - name: Docker Compose down
command: "docker-compose -f {{ docker_dir }}/{{ item }}/docker-compose.yaml down" command: "docker-compose -f /home/{{ ansible_user }}/Docker/{{ item }}/docker-compose.yaml down"
loop: "{{ down[inventory_hostname] }}" loop: "{{ down[inventory_hostname] }}"
when: down is defined and inventory_hostname in down when: down is defined and inventory_hostname in down
ignore_errors: yes ignore_errors: yes
- name: Remove project directory - name: Remove project directory
file: file:
path: "{{ docker_dir }}/{{ item }}" path: "/home/{{ ansible_user }}/Docker/{{ item }}"
state: absent state: absent
become: true become: true
loop: "{{ remove[inventory_hostname] }}" loop: "{{ remove[inventory_hostname] }}"
@ -28,7 +28,7 @@
- name: Create project directory - name: Create project directory
file: file:
path: "{{ docker_dir }}/{{ item }}" path: "/home/{{ ansible_user }}/Docker/{{ item }}"
state: directory state: directory
owner: 1000 owner: 1000
group: 1000 group: 1000
@ -45,7 +45,7 @@
- name: Copy Docker Compose - name: Copy Docker Compose
template: template:
src: "compose/{{ item }}.yaml.j2" src: "compose/{{ item }}.yaml.j2"
dest: "{{ docker_dir }}/{{ item }}/docker-compose.yaml" dest: "/home/{{ ansible_user }}/Docker/{{ item }}/docker-compose.yaml"
owner: 1000 owner: 1000
group: 1000 group: 1000
mode: 0755 mode: 0755
@ -55,11 +55,11 @@
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
- name: Docker Compose pull - name: Docker Compose pull
command: "docker-compose -f {{ docker_dir }}/{{ item }}/docker-compose.yaml pull" command: "docker-compose -f /home/{{ ansible_user }}/Docker/{{ item }}/docker-compose.yaml pull"
loop: "{{ compose[inventory_hostname] }}" loop: "{{ compose[inventory_hostname] }}"
when: compose is defined and inventory_hostname in compose when: compose is defined and inventory_hostname in compose
- name: Docker Compose up - name: Docker Compose up
command: "docker-compose -f {{ docker_dir }}/{{ item }}/docker-compose.yaml up --remove-orphans --force-recreate -d" command: "docker-compose -f /home/{{ ansible_user }}/Docker/{{ item }}/docker-compose.yaml up --remove-orphans --force-recreate -d"
loop: "{{ compose[inventory_hostname] }}" loop: "{{ compose[inventory_hostname] }}"
when: compose is defined and inventory_hostname in compose when: compose is defined and inventory_hostname in compose

View File

@ -1,4 +1,3 @@
docker_dir:
control_user: control_user:
control_host: control_host: