Skip to content

Commit

Permalink
Component: install ibridges before running module
Browse files Browse the repository at this point in the history
  • Loading branch information
dometto committed May 21, 2024
1 parent 85b1b30 commit 0a039b1
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,41 @@
vars:
_ibridges_user: "{{ ibridges_user | default(ibridges_target_path | regex_search('^\/home\/(.*)\/.*', '\\1') | default([], true) | first ) }}"
_ibridges_group: "{{ ibridges_group | default(ibridges_target_path | regex_search('^\/home\/(.*)\/.*', '\\1') | default([], true) | first ) }}"

tasks:
_ibridges_custom_pip_location: /usr/local/pip

- name: Create target directory if it does not exist
file:
path: "{{ ibridges_target_path }}/{{ item | basename }}"
state: directory
mode: "0750"
owner: "{{ _ibridges_user | default('root', true) }}"
group: "{{ _ibridges_group | default('root', true) }}"
with_items: "{{ ibridges_irods_path.split(',') }}"
tasks:
- name: Install ibridges
pip:
name: ibridges
extra_args: "--target {{ _ibridges_custom_pip_location }}"

- name: iBridges sync
ibridges_sync:
mode: down
env: '{{ ibridges_env | regex_replace("\\", "") }}'
irods_path: "{{ ibridges_irods_path }}"
local_path: "{{ ibridges_target_path }}/{{ item | basename }}"
password: "{{ ibridges_password }}"
check_mode: "{{ ibridges_dry_run | default(false) | bool }}"
with_items: "{{ ibridges_irods_path.split(',') }}"
- name: Create target directory if it does not exist
file:
path: "{{ ibridges_target_path }}/{{ item | basename }}"
state: directory
mode: "0750"
owner: "{{ _ibridges_user | default('root', true) }}"
group: "{{ _ibridges_group | default('root', true) }}"
with_items: "{{ ibridges_irods_path.split(',') }}"

- name: Change permissions of downloaded files
file:
path: "{{ ibridges_target_path }}/{{ item | basename }}"
state: directory
recurse: true
mode: "0750"
owner: "{{ _ibridges_user | default('root', true) }}"
group: "{{ _ibridges_group | default('root', true) }}"
with_items: "{{ ibridges_irods_path.split(',') }}"
- name: iBridges sync
ibridges_sync:
mode: down
env: '{{ ibridges_env | regex_replace("\\", "") }}'
irods_path: "{{ ibridges_irods_path }}"
local_path: "{{ ibridges_target_path }}/{{ item | basename }}"
password: "{{ ibridges_password }}"
check_mode: "{{ ibridges_dry_run | default(false) | bool }}"
with_items: "{{ ibridges_irods_path.split(',') }}"
environment:
PYTHON_PATH: "{{ _ibridges_custom_pip_location }}:{{ ansible_env.PYTHONPATH }}"

- name: Change permissions of downloaded files
file:
path: "{{ ibridges_target_path }}/{{ item | basename }}"
state: directory
recurse: true
mode: "0750"
owner: "{{ _ibridges_user | default('root', true) }}"
group: "{{ _ibridges_group | default('root', true) }}"
with_items: "{{ ibridges_irods_path.split(',') }}"

0 comments on commit 0a039b1

Please sign in to comment.