Skip to content

Commit

Permalink
Set static source dir for subdomains based on server dir
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Jun 29, 2024
1 parent cc413b6 commit cc5e73e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,42 +303,42 @@ galaxy_app_config_default:
static_enabled: "{{ galaxy_manage_subdomain_static }}"
static_dir_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static/',
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_static_dir }}/',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/',
{% endfor %}
{% endif %} }
static_images_dir_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static/images',
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_static_dir }}/images',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/images',
{% endfor %}
{% endif %} }
static_welcome_html_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static/welcome.html',
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_static_dir }}/welcome.html',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html',
{% endfor %}
{% endif %} }
static_scripts_dir_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static/scripts',
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_static_dir }}/scripts',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/scripts',
{% endfor %}
{% endif %} }
static_favicon_dir_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static',
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_static_dir }}',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}',
{% endfor %}
{% endif %} }
static_robots_txt_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static',
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_static_dir }}',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}',
{% endfor %}
Expand Down
6 changes: 3 additions & 3 deletions tasks/static_subdomain_dirs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

- name: Register files in static/dist
ansible.builtin.find:
paths: "{{ galaxy_themes_static_path }}/static/dist"
paths: "{{ galaxy_static_dir }}/dist"
file_type: file
when: galaxy_themes_symlinks
register: dist_files
Expand All @@ -28,7 +28,7 @@

- name: "Symlink directory {{ item }} from static-{{ subdomain.name }}/{{ item }} to static/{{ item }}"
ansible.builtin.file:
src: "{{ galaxy_themes_static_path }}/static/{{ item }}"
src: "{{ galaxy_static_dir }}/{{ item }}"
dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/{{ item }}"
state: link
when: galaxy_themes_symlinks
Expand All @@ -42,7 +42,7 @@

- name: Synchronize contents from static to static-"{{ subdomain.name }}"
ansible.posix.synchronize:
src: "{{ galaxy_themes_static_path }}/static/"
src: "{{ galaxy_static_dir }}/"
dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}"
rsync_opts: ["--ignore-existing"]
delegate_to: "{{ inventory_hostname }}"
Expand Down

0 comments on commit cc5e73e

Please sign in to comment.