Skip to content
Draft
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
75 changes: 38 additions & 37 deletions .docs/role_documentation_generator
Original file line number Diff line number Diff line change
Expand Up @@ -40,52 +40,53 @@ if __name__ == "__main__":
roles_rst.append("")

# options
roles_rst.extend(["`Variables`", "^^^^^^^^^^^", ""])
for option in specs["argument_specs"]["main"]["options"]:
roles_rst.extend([
".. _{}_variable:".format(option),
"",
"``{}``".format(option),
'"' * (len(option) + 4),
"",
":Type: **{}**".format(
specs["argument_specs"]["main"]["options"][option]["type"]
),
"",
":Required: **{}**".format(
json_dumps(
specs["argument_specs"]["main"]["options"][option]["required"]
)
),
"",
])
if "choices" in specs["argument_specs"]["main"]["options"][option]:
if "options" in specs["argument_specs"]["main"]:
roles_rst.extend(["`Variables`", "^^^^^^^^^^^", ""])
for option in specs["argument_specs"]["main"]["options"]:
roles_rst.extend([
":Allowed Values: ``{}``".format(
json_dumps(specs["argument_specs"]["main"]["options"][option]["choices"])
)
])
if (not specs["argument_specs"]["main"]["options"][option]["required"] and
"default" in specs["argument_specs"]["main"]["options"][option]):
roles_rst.extend([
":Default: ``{}``".format(
".. _{}_variable:".format(option),
"",
"``{}``".format(option),
'"' * (len(option) + 4),
"",
":Type: **{}**".format(
specs["argument_specs"]["main"]["options"][option]["type"]
),
"",
":Required: **{}**".format(
json_dumps(
specs["argument_specs"]["main"]["options"][option]["default"]
specs["argument_specs"]["main"]["options"][option]["required"]
)
),
"",
])
roles_rst.extend([
":Description: {}".format(
specs["argument_specs"]["main"]["options"][option]["description"]
),
"",
])
if "raw" in specs["argument_specs"]["main"]["options"][option]:
if "choices" in specs["argument_specs"]["main"]["options"][option]:
roles_rst.extend([
":Allowed Values: ``{}``".format(
json_dumps(specs["argument_specs"]["main"]["options"][option]["choices"])
)
])
if (not specs["argument_specs"]["main"]["options"][option]["required"] and
"default" in specs["argument_specs"]["main"]["options"][option]):
roles_rst.extend([
":Default: ``{}``".format(
json_dumps(
specs["argument_specs"]["main"]["options"][option]["default"]
)
),
"",
])
roles_rst.extend([
specs["argument_specs"]["main"]["options"][option]["raw"],
":Description: {}".format(
specs["argument_specs"]["main"]["options"][option]["description"]
),
"",
])
if "raw" in specs["argument_specs"]["main"]["options"][option]:
roles_rst.extend([
specs["argument_specs"]["main"]["options"][option]["raw"],
"",
])

print("--- writing out documentation for NSP roles ---")
out_dir = Path(__file__).parent.joinpath("source/reference")
Expand Down
14 changes: 7 additions & 7 deletions .docs/source/starting/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ We will name our spack environments according to the following schema ``core<yea
.. code-block:: jinja
:caption: ``moria/spack/environments/concretizer.yaml.j2``

{{ ansible_managed | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}

concretizer:
reuse: false
Expand All @@ -391,7 +391,7 @@ We will name our spack environments according to the following schema ``core<yea
.. code-block:: jinja
:caption: ``moria/spack/environments/config.yaml.j2``

{{ ansible_managed | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}

config:
install_tree:
Expand Down Expand Up @@ -447,7 +447,7 @@ We will name our spack environments according to the following schema ``core<yea
.. code-block:: jinja
:caption: ``moria/spack/environments/modules.yaml.j2``

{{ ansible_managed | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}

modules:
prefix_inspections:
Expand Down Expand Up @@ -508,7 +508,7 @@ We will name our spack environments according to the following schema ``core<yea
.. code-block:: jinja
:caption: ``moria/spack/environments/packages.yaml.j2``

{{ ansible_managed | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}

packages:
all:
Expand Down Expand Up @@ -552,7 +552,7 @@ We will name our spack environments according to the following schema ``core<yea
.. code-block:: jinja
:caption: ``moria/spack/environments/core25.02/spack.yaml.j2``

{{ ansible_managed | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}

# OLCF {{ NSP_system_name }} {{ _SPACK_environment_name }} Spack Environment

Expand Down Expand Up @@ -593,7 +593,7 @@ We will name our spack environments according to the following schema ``core<yea
.. code-block:: jinja
:caption: ``moria/spack/environments/sw25.02/spack.yaml.j2``

{{ ansible_managed | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning="##", end="##", decoration="#", prefix_count=0, postfix_count=0) }}

# OLCF {{ NSP_system_name }} {{ _SPACK_environment_name }} Spack Environment

Expand Down Expand Up @@ -728,7 +728,7 @@ environment that we installed.
.. code-block:: jinja
:caption: ``moria/files/Core/25.02.lua``

{{ ansible_managed | comment(beginning="--[[", end="]]--", decoration="", prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning="--[[", end="]]--", decoration="", prefix_count=0, postfix_count=0) }}

help("Add path for Core 25.02 modules to MODULEPATH")

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# IDE files
.idea
.vscode

# build files
.docs/build
Expand Down
8 changes: 0 additions & 8 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
[defaults]
roles_path = ./roles
display_skipped_hosts = no
ansible_managed = | WARNING! This file is managed by Ansible.
| Do NOT make manual changes to this file.
| Please email {{{{ NSP_help_email }}}} to request a change.

| Info:
| Role: {{{{ ansible_role_name }}}}
| {{{{ "{{}} Template: {{}}".format(NSP_site_name, template_path.replace(playbook_dir, "").lstrip("/")) if playbook_dir in template_path else "NSP Template: {{}}".format(template_path) }}}}
| User: {{{{ ansible_user_id }}}}
2 changes: 1 addition & 1 deletion aocc/templates/module.lua.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ ansible_managed | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}

family("compiler")

Expand Down
2 changes: 1 addition & 1 deletion codee/templates/module.lua.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ ansible_managed | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}

whatis("Codee : A code modernization and optimization platform")
whatis("Version : {{ NSP_CODEE_version }}")
Expand Down
2 changes: 1 addition & 1 deletion cuda/templates/module.lua.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ ansible_managed | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}

family("gpu")

Expand Down
2 changes: 1 addition & 1 deletion gcc/templates/module.lua.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ ansible_managed | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}

family("compiler")

Expand Down
1 change: 0 additions & 1 deletion init/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
NSP_INIT_wipe: false
11 changes: 5 additions & 6 deletions init/meta/argument_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ argument_specs:

The ``init`` directory and accompanying files are completely optional. Without them, blank init scripts
will be created.
options:
NSP_INIT_wipe:
type: bool
required: false
default: false
description: Wipe and recreate the init scripts on every run.
- |-
.. note::
The init role provides a bash/csh function called ``nsp_initialize_lmod`` that can be used to setup Lmod
from the default location. You may use them in your own ``profile.j2`` and ``cshrc.j2``
templates if desired.
44 changes: 0 additions & 44 deletions init/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,13 @@
tags:
- init

- name: Check profile Status
ansible.builtin.stat:
path: "{{ [NSP_install_root, 'init', 'profile'] | path_join }}"
register: profile_status
tags:
- init

- name: Generate profile
ansible.builtin.template:
src: profile.j2
dest: "{{ [NSP_install_root, 'init', 'profile'] | path_join }}"
owner: "{{ NSP_user }}"
group: "{{ NSP_group }}"
mode: "{{ NSP_file_permissions }}"
when: NSP_INIT_wipe or not profile_status.stat.exists
tags:
- init

- name: Add Contents to profile
ansible.builtin.blockinfile:
block: "{{ lookup('template', [playbook_dir, 'init/profile.j2'] | path_join) }}"
path: "{{ [NSP_install_root, 'init', 'profile'] | path_join }}"
marker: "# {mark} INIT MANAGED"
append_newline: true
prepend_newline: true
owner: "{{ NSP_user }}"
group: "{{ NSP_group }}"
mode: "{{ NSP_file_permissions }}"
when: "[playbook_dir, 'init/profile.j2'] | path_join is file"
tags:
- init

- name: Check cshrc Status
ansible.builtin.stat:
path: "{{ [NSP_install_root, 'init', 'cshrc'] | path_join }}"
register: cshrc_status
tags:
- init

Expand All @@ -54,20 +25,5 @@
owner: "{{ NSP_user }}"
group: "{{ NSP_group }}"
mode: "{{ NSP_file_permissions }}"
when: NSP_INIT_wipe or not cshrc_status.stat.exists
tags:
- init

- name: Add Contents to cshrc
ansible.builtin.blockinfile:
block: "{{ lookup('template', [playbook_dir, 'init/cshrc.j2'] | path_join) }}"
path: "{{ [NSP_install_root, 'init', 'cshrc'] | path_join }}"
marker: "# {mark} INIT MANAGED"
append_newline: true
prepend_newline: true
owner: "{{ NSP_user }}"
group: "{{ NSP_group }}"
mode: "{{ NSP_file_permissions }}"
when: "[playbook_dir, 'init/cshrc.j2'] | path_join is file"
tags:
- init
18 changes: 17 additions & 1 deletion init/templates/cshrc.j2
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
#!/usr/bin/env csh
{{ ansible_managed | comment(beginning='##', end='##', decoration='#', prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning='##', end='##', decoration='#', prefix_count=0, postfix_count=0) }}

########################################
# NSP Helpers
########################################

nsp_initialize_lmod() {
if ( -f "{{ [NSP_install_root, 'lmod/etc/profile'] | path_join }}" ) then
source "{{ [NSP_install_root, 'lmod/etc/profile'] | path_join }}"
endif
}

########################################
# User Content
########################################

{{ lookup('template', [playbook_dir, 'init/cshrc.j2'] | path_join, errors='ignore') | default('') }}
18 changes: 17 additions & 1 deletion init/templates/profile.j2
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
#!/usr/bin/env bash
{{ ansible_managed | comment(beginning='##', end='##', decoration='#', prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning='##', end='##', decoration='#', prefix_count=0, postfix_count=0) }}

########################################
# NSP Helpers
########################################

nsp_initialize_lmod() {
if [ -f {{ [NSP_install_root, 'lmod/etc/profile'] | path_join }} ]; then
source {{ [NSP_install_root, 'lmod/etc/profile'] | path_join }}
fi
}

########################################
# User Content
########################################

{{ lookup('template', [playbook_dir, 'init/profile.j2'] | path_join, errors='ignore') | default('') }}
2 changes: 1 addition & 1 deletion llvm/templates/module.lua.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ ansible_managed | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}
{{ NSP_template_header | comment(beginning='--[[', end=']]--', decoration='', prefix_count=0, postfix_count=0) }}
{% set llvm_v_list = NSP_LLVM_version.split('.') %}

family("compiler")
Expand Down
1 change: 0 additions & 1 deletion lmod/meta/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
dependencies:
- role: nsp
- role: init
47 changes: 0 additions & 47 deletions lmod/tasks/external.yaml

This file was deleted.

Loading