X Tutup
Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 4b1572a

Browse files
committed
Settings: Updated new variables globally. [ansible]
1 parent 91da506 commit 4b1572a

File tree

134 files changed

+593
-590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+593
-590
lines changed

defaults/backup_config.yml.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
local:
33
enable: yes
4-
destination: /home/{{ user }}/Backups/Cloudbox
4+
destination: /mnt/local/Backups/Cloudbox
55
rclone:
66
enable: yes
77
destination: google:/Backups/Cloudbox

roles/airdcpp/tasks/main.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
state: absent
2323

2424
- name: Create airdcpp directories
25-
file: "path={{ item }} state=directory mode=0775 owner={{ user }} group={{ user }}"
25+
file: "path={{ item }} state=directory mode=0775 owner={{ user.name }} group={{ user.name }}"
2626
with_items:
2727
- /opt/airdcpp
2828
- /mnt/local/downloads/airdcpp
@@ -46,8 +46,8 @@
4646
copy:
4747
src: WebServer.xml
4848
dest: /opt/airdcpp/WebServer.xml
49-
owner: "{{ user }}"
50-
group: "{{ user }}"
49+
owner: "{{ user.name }}"
50+
group: "{{ user.name }}"
5151
mode: 0775
5252
force: yes
5353
when: not webserver_xml.stat.exists
@@ -56,8 +56,8 @@
5656
copy:
5757
src: DCPlusPlus.xml
5858
dest: /opt/airdcpp/DCPlusPlus.xml
59-
owner: "{{ user }}"
60-
group: "{{ user }}"
59+
owner: "{{ user.name }}"
60+
group: "{{ user.name }}"
6161
mode: 0775
6262
force: yes
6363
when: not dcplusplus_xml.stat.exists
@@ -75,10 +75,10 @@
7575
- "21249:21249"
7676
user: "{{ uid }}:{{ gid }}"
7777
env:
78-
VIRTUAL_HOST: "airdcpp.{{ domain }}"
78+
VIRTUAL_HOST: "airdcpp.{{ user.domain }}"
7979
VIRTUAL_PORT: 5600
80-
LETSENCRYPT_HOST: "airdcpp.{{ domain }}"
81-
LETSENCRYPT_EMAIL: "{{ email }}"
80+
LETSENCRYPT_HOST: "airdcpp.{{ user.domain }}"
81+
LETSENCRYPT_EMAIL: "{{ user.email }}"
8282
volumes:
8383
- "/etc/localtime:/etc/localtime:ro"
8484
- "/opt/airdcpp:/.airdcpp"

roles/aliases/tasks/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#########################################################################
1010
---
1111
- name: Create aliases directories
12-
file: "path={{ item }} state=directory mode=0775 owner={{ user }} group={{ user }} recurse=yes"
12+
file: "path={{ item }} state=directory mode=0775 owner={{ user.name }} group={{ user.name }} recurse=yes"
1313
with_items:
1414
- /opt/aliases
1515

@@ -20,28 +20,28 @@
2020
version: HEAD
2121
force: yes
2222
become: yes
23-
become_user: "{{ user }}"
23+
become_user: "{{ user.name }}"
2424

2525
- name: Ensure bash_profile exists
2626
file:
27-
path: "/home/{{ user }}/.bash_profile"
27+
path: "/home/{{ user.name }}/.bash_profile"
2828
state: touch
2929

3030
- name: Ensure zshenv exists
3131
file:
32-
path: "/home/{{ user }}/.zshenv"
32+
path: "/home/{{ user.name }}/.zshenv"
3333
state: touch
3434

3535
- name: Add aliases to bash_profile
3636
lineinfile:
37-
dest: "/home/{{ user }}/.bash_profile"
37+
dest: "/home/{{ user.name }}/.bash_profile"
3838
regexp: "aliases"
3939
line: "eval \"$(find /opt/aliases -type f -path '*bash/*.sh' | while read af; do echo \"source $af\"; done)\""
4040
state: present
4141

4242
- name: Add aliases to zshenv
4343
lineinfile:
44-
dest: "/home/{{ user }}/.zshenv"
44+
dest: "/home/{{ user.name }}/.zshenv"
4545
regexp: "aliases"
4646
line: "eval \"$(find /opt/aliases -type f -path '*zsh/*.sh' | while read af; do echo \"source $af\"; done)\""
4747
state: present

roles/backup/tasks/cron.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
cron:
2222
name: "Cloudbox Backup"
2323
special_time: "{{ cron.cron_time }}"
24-
job: "sudo PATH='/usr/bin:/bin:/usr/local/bin' env ANSIBLE_CONFIG='{{ playbook_dir }}/ansible.cfg' '{{ playbook_binary.stdout }}' '{{ playbook_dir }}/backup.yml' >> '/home/{{ user }}/logs/cloudbox_backup.log' 2>&1"
24+
job: "sudo PATH='/usr/bin:/bin:/usr/local/bin' env ANSIBLE_CONFIG='{{ playbook_dir }}/ansible.cfg' '{{ playbook_binary.stdout }}' '{{ playbook_dir }}/backup.yml' >> '/home/{{ user.name }}/logs/cloudbox_backup.log' 2>&1"
2525
state: "{{ cron.cron_state }}"
26-
user: "{{ user }}"
26+
user: "{{ user.name }}"

roles/backup/tasks/main.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
file:
4646
path: "{{ playbook_dir }}/backup.lock"
4747
state: touch
48-
owner: "{{ user }}"
49-
group: "{{ user }}"
48+
owner: "{{ user.name }}"
49+
group: "{{ user.name }}"
5050
mode: 0775
5151

5252
- name: Check if previous backup exists locally
@@ -67,14 +67,14 @@
6767
- name: "Moving '{{ local.destination }}' to '{{ local.destination }}.old'"
6868
shell: "mv '{{ local.destination }}' '{{ local.destination }}.old'"
6969
become: yes
70-
become_user: "{{ user }}"
70+
become_user: "{{ user.name }}"
7171
when: dir_files.matched|int != 0
7272

7373
- name: "Create backup folders."
74-
file: "path={{ item }} state=directory mode=0775 owner={{ user }} group={{ user }} recurse=yes"
74+
file: "path={{ item }} state=directory mode=0775 owner={{ user.name }} group={{ user.name }} recurse=yes"
7575
with_items:
76-
- "/home/{{ user }}/logs"
77-
- "/home/{{ user }}/logs/backup"
76+
- "/home/{{ user.name }}/logs"
77+
- "/home/{{ user.name }}/logs/backup"
7878
- "{{ local.destination }}"
7979
- "{{ local.destination }}/opt"
8080
- "/opt/systemd-backup"
@@ -85,8 +85,8 @@
8585
copy:
8686
src: "{{ item }}"
8787
dest: "{{ local.destination }}"
88-
owner: "{{ user }}"
89-
group: "{{ user }}"
88+
owner: "{{ user.name }}"
89+
group: "{{ user.name }}"
9090
mode: 0775
9191
force: yes
9292
with_items:
@@ -95,7 +95,7 @@
9595
- "{{ playbook_dir }}/settings.yml"
9696
- "{{ playbook_dir }}/adv_settings.yml"
9797
- "{{ playbook_dir }}/backup_config.yml"
98-
- "/home/{{ user }}/.config/rclone/rclone.conf"
98+
- "/home/{{ user.name }}/.config/rclone/rclone.conf"
9999
ignore_errors: yes
100100

101101
# Backup the excludes list if it exists
@@ -108,8 +108,8 @@
108108
copy:
109109
src: "{{ playbook_dir }}/backup_excludes_list.txt"
110110
dest: "{{ local.destination }}"
111-
owner: "{{ user }}"
112-
group: "{{ user }}"
111+
owner: "{{ user.name }}"
112+
group: "{{ user.name }}"
113113
mode: 0775
114114
force: yes
115115
when: (backup_excludes_list.stat.exists)
@@ -151,7 +151,7 @@
151151
ignore_errors: yes
152152

153153
- name: "Reset permissions of folders"
154-
file: "path={{ item }} state=directory mode=0775 owner={{ user }} group={{ user }} recurse=yes"
154+
file: "path={{ item }} state=directory mode=0775 owner={{ user.name }} group={{ user.name }} recurse=yes"
155155
with_items:
156156
- "/opt/systemd-backup"
157157
- "/opt/crontab-backup"
@@ -345,7 +345,7 @@
345345
path: "{{ local.destination }}.old"
346346
state: absent
347347
become: yes
348-
become_user: "{{ user }}"
348+
become_user: "{{ user.name }}"
349349
when: (dir_files2.matched|int != 0)
350350

351351
- name: "Get size of '{{ local.destination }}'"
@@ -403,15 +403,15 @@
403403
timeout: 10
404404

405405
- name: "Reset folder ownership of '{{ local.destination }}/'"
406-
shell: "chown -R {{ user }}:{{ user }} {{ local.destination }}/"
406+
shell: "chown -R {{ user.name }}:{{ user.name }} {{ local.destination }}/"
407407
args:
408408
warn: no
409409

410410
# Reset mod dates to avoid conflicts during rclone backup. Ansible module doesn't touch folder contents via wildcard.
411411
- name: "Reset permissions and mod dates to files in '{{ local.destination }}/'"
412412
shell: find '{{ local.destination }}' -type f -exec touch {} +
413413
become: yes
414-
become_user: "{{ user }}"
414+
become_user: "{{ user.name }}"
415415
args:
416416
executable: /bin/bash
417417
warn: no
@@ -424,7 +424,7 @@
424424
--user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36' \
425425
| sed -e 's/^[ \t]*//' | cut -d ' ' -f 2,3 | cut -d '.' -f 1 | sed s/' '/_/g | sed s/':'/./g
426426
become: yes
427-
become_user: "{{ user }}"
427+
become_user: "{{ user.name }}"
428428
register: rclone_timestamp
429429
ignore_errors: yes
430430
when: (rclone.enable)
@@ -437,7 +437,7 @@
437437
'{{ rclone.destination }}/{{ item }}' '{{ rclone.destination }}/archived/{{ (rclone_timestamp.stdout) if (rclone_timestamp is defined) else 'old' }}/{{ item }}' \
438438
2>/dev/null
439439
become: yes
440-
become_user: "{{ user }}"
440+
become_user: "{{ user.name }}"
441441
register: rclone_move
442442
failed_when: rclone_move.rc > 3
443443
ignore_errors: yes
@@ -465,10 +465,10 @@
465465
--drive-chunk-size=128M \
466466
--stats=30s \
467467
-v \
468-
--log-file='/home/{{ user }}/logs/backup/cloudbox_backup_rclone.log' \
468+
--log-file='/home/{{ user.name }}/logs/backup/cloudbox_backup_rclone.log' \
469469
'{{ local.destination }}' '{{ rclone.destination }}'
470470
become: yes
471-
become_user: "{{ user }}"
471+
become_user: "{{ user.name }}"
472472
when: (rclone.enable)
473473

474474
- name: "Pushover Message: Rclone uploaded backup to '{{ rclone.destination }}'"
@@ -485,7 +485,7 @@
485485
set_remote_user: yes
486486
compress: no
487487
become: yes
488-
become_user: "{{ user }}"
488+
become_user: "{{ user.name }}"
489489
when: (rsync.enable)
490490

491491
- name: "Pushover Message: Rsync uploaded backup to '{{ rsync.destination }}'"
@@ -535,7 +535,7 @@
535535
when: (use_snapshot) and (snapshot_type == 'btrfs')
536536

537537
- name: "Reset folder ownership of '{{ local.destination }}/'"
538-
shell: "chown -R {{ user }}:{{ user }} {{ local.destination }}/"
538+
shell: "chown -R {{ user.name }}:{{ user.name }} {{ local.destination }}/"
539539
args:
540540
warn: no
541541

@@ -588,6 +588,6 @@
588588
state: absent
589589

590590
- name: "Reset logs folder ownership."
591-
shell: "chown -R {{ user }}:{{ user }} '/home/{{ user }}/logs/'"
591+
shell: "chown -R {{ user.name }}:{{ user.name }} '/home/{{ user.name }}/logs/'"
592592
args:
593593
warn: no

roles/backup/tasks/restore_service.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@
2020
file: "path='/tmp/restore_service' state=absent"
2121

2222
- name: Restore Service | Create '/tmp/restore_service' path
23-
file: "path='/tmp/restore_service' state=directory mode=0775 owner={{ user }} group={{ user }}"
23+
file: "path='/tmp/restore_service' state=directory mode=0775 owner={{ user.name }} group={{ user.name }}"
2424

2525
- name: Restore Service | Encrypt config file(s)
2626
shell: "openssl enc -aes-256-cbc -salt -md md5 -in {{ item }} -out /tmp/restore_service/{{ item | basename }}.enc -k '{{ restore_service_password }}'"
2727
args:
2828
warn: no
2929
become: yes
30-
become_user: "{{ user }}"
30+
become_user: "{{ user.name }}"
3131
ignore_errors: yes
3232
with_items:
3333
- "{{ playbook_dir }}/ansible.cfg"
3434
- "{{ playbook_dir }}/accounts.yml"
3535
- "{{ playbook_dir }}/settings.yml"
3636
- "{{ playbook_dir }}/adv_settings.yml"
3737
- "{{ playbook_dir }}/backup_config.yml"
38-
- "/home/{{ user }}/.config/rclone/rclone.conf"
38+
- "/home/{{ user.name }}/.config/rclone/rclone.conf"
3939

4040
- name: "Restore Service | Validate config file(s) for encryption."
4141
shell: "head -c 10 {{ item }} | grep -q Salted"

roles/backup/tasks/snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
when: (btrfs_snapshot_mounted.stat.isdir is defined) and (btrfs_snapshot_mounted.stat.isdir)
4242

4343
- name: Snapshot | Create brfs snapshot directory
44-
file: "path={{ item }} state=directory mode=0775 owner={{ user }} group={{ user }}"
44+
file: "path={{ item }} state=directory mode=0775 owner={{ user.name }} group={{ user.name }}"
4545
with_items:
4646
- /btrfs/snapshots
4747

roles/backup/tasks/variables.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
# GNU General Public License v3.0 #
99
#########################################################################
1010
---
11-
# Set 'user' variable
12-
- name: "Get 'cloudbox.yml' info."
13-
stat:
14-
path: "{{ playbook_dir }}/backup.yml"
15-
register: backup_yml
16-
17-
- name: Set 'user' variable
18-
set_fact:
19-
user: "{{ backup_yml.stat.pw_name }}"
20-
2111
# Remove trailing forward slashes from backup paths
2212
- name: Remove trailing forward slashes from backup paths
2313
set_fact:

roles/bazarr/tasks/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import_tasks: "subtasks/suitarr_migration.yml"
2626

2727
- name: Create bazarr directories
28-
file: "path={{ item }} state=directory mode=0775 owner={{ user }} group={{ user }}"
28+
file: "path={{ item }} state=directory mode=0775 owner={{ user.name }} group={{ user.name }}"
2929
with_items:
3030
- /opt/bazarr
3131

@@ -42,10 +42,10 @@
4242
PUID: "{{ uid }}"
4343
PGID: "{{ gid }}"
4444
UMASK: 002
45-
VIRTUAL_HOST: "bazarr.{{ domain }}"
45+
VIRTUAL_HOST: "bazarr.{{ user.domain }}"
4646
VIRTUAL_PORT: 6767
47-
LETSENCRYPT_HOST: "bazarr.{{ domain }}"
48-
LETSENCRYPT_EMAIL: "{{ email }}"
47+
LETSENCRYPT_HOST: "bazarr.{{ user.domain }}"
48+
LETSENCRYPT_EMAIL: "{{ user.email }}"
4949
TZ: "{{ tz }}"
5050
volumes:
5151
- "/opt/bazarr:/config"

roles/bazarr/tasks/subtasks/suitarr_migration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
mkdir /opt/bazarr
3030
mv /tmp/app /opt/bazarr/
3131
find /opt/bazarr/* -type d -empty -delete
32-
chown -R {{ user }}:{{ user }} /opt/bazarr
32+
chown -R {{ user.name }}:{{ user.name }} /opt/bazarr
3333
when: (folder.stat.exists) and not (subfolder1.stat.exists or subfolder2.stat.exists)
3434

3535
- name: Suitarr Migration | Move 'Bazarr' subfolder to 'app' subfolder
3636
shell: |
3737
mv /opt/bazarr/Bazarr /opt/bazarr/app
38-
chown -R {{ user }}:{{ user }} /opt/bazarr
38+
chown -R {{ user.name }}:{{ user.name }} /opt/bazarr
3939
when: (folder.stat.exists) and (subfolder1.stat.exists) and (not subfolder2.stat.exists)

0 commit comments

Comments
 (0)
X Tutup