-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathstatic_subdomain_dirs.yml
85 lines (76 loc) · 2.88 KB
/
static_subdomain_dirs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
- name: Create subdomain static dirs
ansible.builtin.file:
state: directory
mode: '0755'
owner: "{{ __galaxy_privsep_user_name }}"
group: "{{ __galaxy_privsep_user_group }}"
path: "{{ galaxy_themes_static_path }}/{{ item }}"
with_items:
- "static-{{ subdomain.name }}"
- "static-{{ subdomain.name }}/dist"
- name: Register files in static/dist
ansible.builtin.find:
paths: "{{ galaxy_static_dir }}/dist"
file_type: file
when: galaxy_themes_symlinks
register: dist_files
- name: "Symlink files static-{{ subdomain.name }}/dist to static/dist"
ansible.builtin.file:
src: "{{ item.path }}"
dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/dist/{{ item.path | basename }}"
state: link
when: galaxy_themes_symlinks
no_log: "{{ galaxy_themes_symlinks_no_log }}"
with_items: "{{ dist_files.files }}"
- name: "Symlink directory {{ item }} from static-{{ subdomain.name }}/{{ item }} to static/{{ item }}"
ansible.builtin.file:
src: "{{ galaxy_static_dir }}/{{ item }}"
dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/{{ item }}"
state: link
when: galaxy_themes_symlinks
ignore_errors: true
with_items:
- "plugins"
- "patmat"
- "toolshed"
- "wymeditor"
- "style"
- name: Synchronize contents from static to static-"{{ subdomain.name }}"
ansible.posix.synchronize:
src: "{{ galaxy_static_dir }}/"
dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}"
rsync_opts: "{{ ['--ignore-existing'] if __galaxy_client_build_version ==
__galaxy_current_commit_id else omit }}"
delegate_to: "{{ inventory_hostname }}"
- name: Check if welcome.html is present in files
ansible.builtin.stat:
path: "{{ galaxy_themes_ansible_file_path }}/{{ subdomain.name }}/static/welcome.html"
register: custom_welcome
- name: Create welcome.html directory
ansible.builtin.file:
state: directory
mode: '0755'
owner: "{{ __galaxy_privsep_user_name }}"
group: "{{ __galaxy_privsep_user_group }}"
path: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html"
- name: Check if iframe for subdomain exists
ansible.builtin.uri:
url: "{{ galaxy_themes_welcome_url_prefix }}{{ subdomain.name }}.html"
return_content: true
register: galaxy_themes_use_iframe
failed_when: false
when: not custom_welcome.stat.exists
- name: Template welcome.html for subdomains
ansible.builtin.template:
src: welcome.html.j2
dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html/index.html"
owner: "{{ __galaxy_privsep_user_name }}"
group: "{{ __galaxy_privsep_user_group }}"
mode: '0644'
when: not custom_welcome.stat.exists
- name: Include copy_static_files.yml
ansible.builtin.include_tasks: copy_static_files.yml
loop: "{{ galaxy_themes_static_keys | dict2items }}"
loop_control:
loop_var: object