Skip to content

Commit

Permalink
Merge pull request #191 from galaxyproject/create-extra-dirs
Browse files Browse the repository at this point in the history
Add variables for creating extra dirs
  • Loading branch information
hexylena authored Apr 13, 2023
2 parents 00c0fad + e540b09 commit 07b7bbe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
6 changes: 6 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,19 @@ galaxy_dirs:
- "{{ galaxy_tool_data_path }}"
- "{{ galaxy_log_dir }}"

# Additional directories to create as the Galaxy user, so you don't have to copy the default galaxy_dirs
galaxy_extra_dirs: []

# Directories to create as the privilege separated user if galaxy_manage_paths is enabled
galaxy_privsep_dirs:
- "{{ galaxy_venv_dir }}"
- "{{ galaxy_server_dir }}"
- "{{ galaxy_config_dir }}"
- "{{ galaxy_local_tools_dir }}"

# Additional directories to create as the privilege separated user, so you don't have to copy the default galaxy_dirs
galaxy_extra_privsep_dirs: []

# Local (relative to playbook) path to local tools
galaxy_local_tools_src_dir: files/galaxy/tools

Expand Down
21 changes: 7 additions & 14 deletions tasks/mutable_setup.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
---
# Instantiate mutable config files

- name: Mutable config directory setup
- name: Mutable config setup
block:
- name: Create directories for mutable config files

- name: Ensure Galaxy version is set
include_tasks: _inc_galaxy_version.yml
when: __galaxy_major_version is undefined

- name: Create directories for config files
ansible.builtin.file:
state: directory
path: "{{ item }}"
mode: "{{ __galaxy_dir_perms }}"
owner: "{{ __galaxy_user_name }}"
group: "{{ __galaxy_user_group }}"
loop: "{{ (galaxy_mutable_config_files + galaxy_mutable_config_templates) | map(attribute='dest') | map('dirname') | unique }}"

remote_user: "{{ galaxy_remote_users.privsep | default(__galaxy_remote_user) }}"
become: "{{ true if galaxy_become_users.privsep is defined else __galaxy_become }}"
become_user: "{{ galaxy_become_users.privsep | default(__galaxy_become_user) }}"

- name: Mutable config setup
block:

- name: Ensure Galaxy version is set
include_tasks: _inc_galaxy_version.yml
when: __galaxy_major_version is undefined

# force: no in the following 2 tasks will not overwrite existing configs
- name: Instantiate mutable configuration files
copy:
Expand Down
4 changes: 2 additions & 2 deletions tasks/paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
owner: "{{ __galaxy_privsep_user_name }}"
group: "{{ __galaxy_user_group }}" #This is set so that the galaxy_user can read the files in the priv_sep dirs. (As priv_sep dirs have defauly perms of 0640.)
mode: "{{ __galaxy_dir_perms }}"
with_items: "{{ galaxy_privsep_dirs }}"
loop: "{{ galaxy_privsep_dirs + galaxy_extra_privsep_dirs }}"
when: item | default(False)

- name: Create additional directories
Expand All @@ -30,7 +30,7 @@
owner: "{{ __galaxy_user_name }}"
group: "{{ __galaxy_user_group }}"
mode: "{{ __galaxy_dir_perms }}"
with_items: "{{ galaxy_dirs }}"
loop: "{{ galaxy_dirs + galaxy_extra_dirs }}"

# TODO: for root squashing it might be useful for this to be separate from other root tasks
remote_user: "{{ galaxy_remote_users.root | default(__galaxy_remote_user) }}"
Expand Down
8 changes: 0 additions & 8 deletions tasks/static_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
include_tasks: _inc_galaxy_version.yml
when: __galaxy_major_version is undefined

- name: Create directories for config files
ansible.builtin.file:
state: directory
path: "{{ item }}"
mode: "{{ __galaxy_dir_perms }}"
group: "{{ __galaxy_user_group }}"
loop: "{{ (galaxy_config_files + galaxy_config_templates) | map(attribute='dest') | map('dirname') | unique }}"

- name: Install additional Galaxy config files (static)
copy:
src: "{{ item.src }}"
Expand Down

0 comments on commit 07b7bbe

Please sign in to comment.