Skip to content

Instantly share code, notes, and snippets.

@natefoo
Last active July 17, 2022 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natefoo/176f5dda9cf2f98f8a83df013294624c to your computer and use it in GitHub Desktop.
Save natefoo/176f5dda9cf2f98f8a83df013294624c to your computer and use it in GitHub Desktop.
---
# Manage static Galaxy configuration files
- name: Static config setup
block:
- name: Ensure Galaxy version is set
include_tasks: _inc_galaxy_version.yml
when: __galaxy_major_version is undefined
- name: Install additional Galaxy config files (static)
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
backup: "{{ galaxy_backup_configfiles }}"
with_items: "{{ galaxy_config_files }}"
notify:
- "{{ galaxy_restart_handler_name }}"
- name: Install additional Galaxy config files (template)
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
backup: "{{ galaxy_backup_configfiles }}"
with_items: "{{ galaxy_config_templates }}"
notify:
- "{{ galaxy_restart_handler_name }}"
- name: Install local tools
copy:
src: "{{ galaxy_local_tools_src_dir }}/{{ item }}"
dest: "{{ galaxy_local_tools_dir }}/{{ item }}"
with_items: "{{ galaxy_local_tools | default([]) }}"
when: galaxy_local_tools is defined
- name: Install local_tool_conf.xml
template:
src: local_tool_conf.xml.j2
dest: "{{ galaxy_config_dir }}/local_tool_conf.xml"
when: galaxy_local_tools is defined
- name: Append local_tool_conf.xml to tool_config_file Galaxy config option
set_fact:
galaxy_tool_config_files: "{{ galaxy_tool_config_files + [galaxy_config_dir ~ '/local_tool_conf.xml'] }}"
when: galaxy_local_tools is defined
- name: Append shed_tool_conf.xml to tool_config_file Galaxy config option
set_fact:
galaxy_tool_config_files: "{{ galaxy_tool_config_files + [galaxy_shed_tool_config_file] }}"
when: __galaxy_major_version is version('19.09', '<') and galaxy_shed_tool_config_file not in galaxy_tool_config_files
- name: Ensure dynamic job rules paths exists
file:
path: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}"
state: directory
loop_control:
label: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}"
with_items: "{{ galaxy_dynamic_job_rules }}"
- name: Install dynamic job rules
copy:
src: "{{ galaxy_dynamic_job_rules_src_dir }}/{{ item }}"
dest: "{{ galaxy_dynamic_job_rules_dir }}/{{ item }}"
with_items: "{{ galaxy_dynamic_job_rules }}"
- name: Ensure dynamic rule __init__.py's exist
copy:
content: ""
dest: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}/__init__.py"
force: no
loop_control:
label: "{{ galaxy_dynamic_job_rules_dir }}/{{ ((item | dirname) != '') | ternary ((item | dirname) ~ '/', '') }}__init__.py"
with_items: "{{ galaxy_dynamic_job_rules }}"
- name: Create Galaxy job metrics configuration file
copy:
dest: "{{ galaxy_config_merged[galaxy_app_config_section].job_metrics_config_file }}"
content: |
---
## This file is managed by Ansible. ALL CHANGES WILL BE OVERWRITTEN.
{{ galaxy_job_metrics_plugins | to_nice_yaml }}
mode: "0644"
when: galaxy_job_metrics_plugins is defined
- name: Create Galaxy dependency resolvers configuration file
copy:
dest: "{{ galaxy_config_merged[galaxy_app_config_section].dependency_resolvers_config_file }}"
content: |
---
## This file is managed by Ansible. ALL CHANGES WILL BE OVERWRITTEN.
{{ galaxy_dependency_resolvers | to_nice_yaml }}
mode: "0644"
when: galaxy_dependency_resolvers is defined
- name: Create Galaxy container resolvers configuration file
copy:
dest: "{{ galaxy_config_merged[galaxy_app_config_section].containers_resolvers_config_file }}"
content: |
---
## This file is managed by Ansible. ALL CHANGES WILL BE OVERWRITTEN.
{{ galaxy_container_resolvers | to_nice_yaml }}
mode: "0644"
when: galaxy_container_resolvers is defined
- name: Create Galaxy configuration file
template:
src: "{{ galaxy_config_file_template }}"
dest: "{{ galaxy_config_file }}"
backup: "{{ galaxy_backup_configfiles }}"
notify:
- "{{ galaxy_restart_handler_name }}"
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) }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment