8000 Call hooks directly from parent role instead of specifying absolute path by simon-ess · Pull Request #77 · epics-training/training-vm · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ansible/roles/epics-module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Each dictionary in `epics_modules_to_build` should have the following keys:
- `required_debs`: (Optional) List of Debian packages required for building.
- `required_rpms`: (Optional) List of RPM packages required for building.
- `enable_repos`: (Optional) List of repositories to enable when installing RPMs.
- `pre_hook`: (Optional) Absolute path to a task file to run before the build. Recommendation: use `"{{ playbook_dir }}/roles/role-name/tasks/my_pre_hook.yml"`.
- `post_hook`: (Optional) Absolute path to a task file to run after the build. Recommendation: use `"{{ playbook_dir }}/roles/role-name/tasks/my_post_hook.yml"`.
- `pre_hook`: (Optional) Name of task file to run before the build. Must be in `/tasks/` directory.
- `post_hook`: (Optional) Name of task file to run after the build. Must be in `/tasks/` directory.
- `args`: (Optional) Additional arguments to pass to `make`.
- `exclude`: (Optional) List of patterns to exclude when extracting the tarball.

Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/epics-module/tasks/build_module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
become: true

- name: "{{ module.name }} rebuild | Run pre-build hook"
include_tasks: "{{ module.pre_hook }}"
include_tasks: "{{ epics_module_parent_role_path }}/tasks/{{ module.pre_hook }}"
when: module.pre_hook is defined

- name: "{{ module.name }} rebuild | Compile from sources (this may take a while)"
Expand All @@ -84,7 +84,7 @@
become: true

- name: "{{ module.name }} rebuild | Run post-build hook"
include_tasks: "{{ module.post_hook }}"
include_tasks: "{{ epics_module_parent_role_path }}/tasks/{{ module.post_hook }}"
when: module.post_hook is defined

- name: "{{ module.name }} rebuild | Show build result"
Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/epics-module/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# This role should only be included by other roles, so this will be defined
epics_module_parent_role_path: "{{ ansible_parent_role_paths[0] }}"
8 changes: 4 additions & 4 deletions ansible/roles/m-areadetector/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ m_areadetector_modules:
url: "https://github.com/epics-modules/sscan/archive/refs/tags/R{{ sscan_version | replace('.', '-') }}.tar.gz"
release_var: "SSCAN"
release_sortkey: "10"
pre_hook: "{{ playbook_dir }}/roles/m-areadetector/tasks/sscan_prep.yml"
pre_hook: "sscan_prep.yml"

- id: calc
name: "Calc module (misc records)"
Expand Down Expand Up @@ -51,7 +51,7 @@ m_areadetector_modules:
- hdf5-devel
enable_repos:
- crb
pre_hook: "{{ playbook_dir }}/roles/m-areadetector/tasks/adcore_prep.yml"
pre_hook: "adcore_prep.yml"
# Fedora/Rocky 9 libxml2 is too new for Core 3.13 (missing XmlGetGlobal)
# Also skip on Ubuntu 24.04 (Noble) as seen in CI failures
skip: "{{ ansible_facts['distribution'] == 'Fedora' or (ansible_facts['distribution'] == 'Rocky' and ansible_facts.distribution_major_version == '9') or (ansible_facts['distribution'] == 'Ubuntu' and ansible_facts.distribution_release == 'noble') }}"
Expand All @@ -62,7 +62,7 @@ m_areadetector_modules:
url: "https://github.com/areaDetector/ADSimDetector/archive/refs/tags/R{{ adsimdetector_version | replace('.', '-') }}.tar.gz"
release_var: "ADSIMDETECTOR"
release_sortkey: "10"
pre_hook: "{{ playbook_dir }}/roles/m-areadetector/tasks/adsimdetector_prep.yml"
pre_hook: "adsimdetector_prep.yml"
skip: "{{ ansible_facts['distribution'] == 'Fedora' or (ansible_facts['distribution'] == 'Rocky' and ansible_facts.distribution_major_version == '9') or (ansible_facts['distribution'] == 'Ubuntu' and ansible_facts.distribution_release == 'noble') }}"

- id: adpvadriver
Expand All @@ -71,6 +71,6 @@ m_areadetector_modules:
url: "https://github.com/areaDetector/pvaDriver/archive/refs/tags/R{{ adpvadriver_version | replace('.', '-') }}.tar.gz"
release_var: "PVADRIVER"
release_sortkey: "10"
pre_hook: "{{ playbook_dir }}/roles/m-areadetector/tasks/adpvadriver_prep.yml"
pre_hook: "adpvadriver_prep.yml"
# only build on Rocky < 9 and non-Noble Ubuntu (though it was only Rocky originally)
skip: "{{ ansible_facts['distribution'] != 'Rocky' or ansible_facts.distribution_major_version == '9' }}"
2 changes: 1 addition & 1 deletion ansible/roles/m-asyn/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ m_asyn_modules:
- libtirpc-devel
enable_repos:
- crb
pre_hook: "{{ playbook_dir }}/roles/m-asyn/tasks/asyn_prep.yml"
pre_hook: "asyn_prep.yml"
args: -j {{ ansible_facts.processor_vcpus }}
2 changes: 1 addition & 1 deletion ansible/roles/m-base/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ m_base_modules:
- perl-Test-Harness
- perl-FindBin
- perl-Sys-Hostname
pre_hook: "{{ playbook_dir }}/roles/m-base/tasks/base_prep.yml"
pre_hook: "base_prep.yml"
args: -j {{ ansible_facts.processor_vcpus }}

- id: pvxs
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/m-opcua/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ m_opcua_modules:
- cmake
- openssl-devel
- libxml2-devel
pre_hook: "{{ playbook_dir }}/roles/m-opcua/tasks/opcua_prep.yml"
pre_hook: "opcua_prep.yml"
args: -j {{ ansible_facts.processor_vcpus }}
2 changes: 1 addition & 1 deletion ansible/roles/m-p4p/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ m_p4p_modules:
- python3-Cython
enable_repos:
- crb
pre_hook: "{{ playbook_dir }}/roles/m-p4p/tasks/p4p_prep.yml"
pre_hook: "p4p_prep.yml"
args: -j {{ ansible_facts.processor_vcpus }}
4 changes: 2 additions & 2 deletions ansible/roles/m-pvaPy/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ m_pvapy_modules:
- python3-sphinx_rtd_theme
enable_repos:
- crb
pre_hook: "{{ playbook_dir }}/roles/m-pvaPy/tasks/pvapy_prep.yml"
post_hook: "{{ playbook_dir }}/roles/m-pvaPy/tasks/pvapy_post.yml"
pre_hook: "pvapy_prep.yml"
post_hook: "pvapy_post.yml"
2 changes: 1 addition & 1 deletion ansible/roles/m-stream/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ m_stream_modules:
url: "https://github.com/paulscherrerinstitute/StreamDevice/archive/refs/tags/{{ stream_version }}.tar.gz"
release_var: "STREAM"
release_sortkey: "10"
pre_hook: "{{ playbook_dir }}/roles/m-stream/tasks/stream_prep.yml"
pre_hook: "stream_prep.yml"
args: -j {{ ansible_facts.processor_vcpus }}
0