From 99f67c6d724aed9e0e970c68208f52c24fecb12d Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Wed, 15 Jan 2025 15:07:00 +0000 Subject: [PATCH 1/6] remove slurm_openstack_tools collection --- ansible/.gitignore | 4 ++ ansible/monitoring.yml | 6 +-- ansible/roles/pytools/.travis.yml | 29 ++++++++++++ ansible/roles/pytools/README.md | 36 ++++++++++++++ ansible/roles/pytools/defaults/main.yml | 5 ++ ansible/roles/pytools/handlers/main.yml | 2 + ansible/roles/pytools/meta/main.yml | 52 +++++++++++++++++++++ ansible/roles/pytools/tasks/main.yml | 34 ++++++++++++++ ansible/roles/pytools/tests/inventory | 2 + ansible/roles/pytools/tests/test.yml | 5 ++ ansible/roles/pytools/vars/main.yml | 2 + ansible/roles/slurm_stats/README.md | 33 +++++++++++++ ansible/roles/slurm_stats/defaults/main.yml | 13 ++++++ ansible/roles/slurm_stats/tasks/main.yml | 34 ++++++++++++++ ansible/slurm.yml | 10 ---- requirements.yml | 3 -- 16 files changed, 252 insertions(+), 18 deletions(-) create mode 100644 ansible/roles/pytools/.travis.yml create mode 100644 ansible/roles/pytools/README.md create mode 100644 ansible/roles/pytools/defaults/main.yml create mode 100644 ansible/roles/pytools/handlers/main.yml create mode 100644 ansible/roles/pytools/meta/main.yml create mode 100644 ansible/roles/pytools/tasks/main.yml create mode 100644 ansible/roles/pytools/tests/inventory create mode 100644 ansible/roles/pytools/tests/test.yml create mode 100644 ansible/roles/pytools/vars/main.yml create mode 100644 ansible/roles/slurm_stats/README.md create mode 100644 ansible/roles/slurm_stats/defaults/main.yml create mode 100644 ansible/roles/slurm_stats/tasks/main.yml diff --git a/ansible/.gitignore b/ansible/.gitignore index 1cabb8ad8..c6e7887c8 100644 --- a/ansible/.gitignore +++ b/ansible/.gitignore @@ -76,3 +76,7 @@ roles/* !roles/pulp_site/** !roles/doca/ !roles/doca/** +!roles/slurm_stats/ +!roles/slurm_stats/** +!roles/pytools/ +!roles/pytools/** diff --git a/ansible/monitoring.yml b/ansible/monitoring.yml index 84f319688..3ec86aca2 100644 --- a/ansible/monitoring.yml +++ b/ansible/monitoring.yml @@ -17,14 +17,10 @@ - name: Setup slurm stats hosts: slurm_stats tags: slurm_stats - collections: - - stackhpc.slurm_openstack_tools tasks: - include_role: name: slurm-stats - apply: - # Collection currently requires root for all tasks. - become: true + become: true - name: Deploy filebeat hosts: filebeat diff --git a/ansible/roles/pytools/.travis.yml b/ansible/roles/pytools/.travis.yml new file mode 100644 index 000000000..36bbf6208 --- /dev/null +++ b/ansible/roles/pytools/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/ansible/roles/pytools/README.md b/ansible/roles/pytools/README.md new file mode 100644 index 000000000..dec1b2c59 --- /dev/null +++ b/ansible/roles/pytools/README.md @@ -0,0 +1,36 @@ +stackhpc.slurm_openstack_tools.pytools +========= + +Installs python-based tools from https://github.com/stackhpc/slurm-openstack-tools.git into `/opt/slurm-tools/bin/`. + +Requirements +------------ + +Role Variables +-------------- + +`pytools_editable`: Optional. Whether to install the package using `pip`'s editable mode (installing source to `/opt/slurm-tools/src`) - `true` or `false` (default). +`pytools_gitref`: Optional. Git branch, version, commit etc to install. Default `master`. +`pytools_user`: User to install as. Default `root`. + +Dependencies +------------ +None. + +Example Playbook +---------------- + + - hosts: compute + tasks: + - import_role: + name: stackhpc.slurm_openstack_tools.pytools + + +License +------- + +Apache-2.0 + +Author Information +------------------ + diff --git a/ansible/roles/pytools/defaults/main.yml b/ansible/roles/pytools/defaults/main.yml new file mode 100644 index 000000000..2e88ac1a8 --- /dev/null +++ b/ansible/roles/pytools/defaults/main.yml @@ -0,0 +1,5 @@ +--- +# defaults file for pytools +pytools_editable: false +pytools_gitref: master +pytools_user: root diff --git a/ansible/roles/pytools/handlers/main.yml b/ansible/roles/pytools/handlers/main.yml new file mode 100644 index 000000000..9fe318713 --- /dev/null +++ b/ansible/roles/pytools/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for pytools diff --git a/ansible/roles/pytools/meta/main.yml b/ansible/roles/pytools/meta/main.yml new file mode 100644 index 000000000..c572acc9f --- /dev/null +++ b/ansible/roles/pytools/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/ansible/roles/pytools/tasks/main.yml b/ansible/roles/pytools/tasks/main.yml new file mode 100644 index 000000000..89bfb663b --- /dev/null +++ b/ansible/roles/pytools/tasks/main.yml @@ -0,0 +1,34 @@ +--- +- name: install python3 + package: + name: python3,git + become: true + +- name: Create virtualenv directory + file: + path: /opt/slurm-tools + owner: "{{ pytools_user }}" + group: "{{ pytools_user }}" + state: directory + become: true + +- block: + - name: Upgrade pip + # This needs to a separate step so that we use the updated version + # to install the packages below. + pip: + name: pip + + - name: Create virtualenv + pip: + name: "git+https://github.com/stackhpc/slurm-openstack-tools.git@{{ pytools_gitref }}#egg=slurm_openstack_tools" + editable: "{{ pytools_editable }}" + + module_defaults: + ansible.builtin.pip: + virtualenv: /opt/slurm-tools + virtualenv_command: python3 -m venv + state: latest + become: true + become_user: "{{ pytools_user }}" + # become_flags: -H #'-s /bin/bash' # as has shell specified as /sbin/nologin diff --git a/ansible/roles/pytools/tests/inventory b/ansible/roles/pytools/tests/inventory new file mode 100644 index 000000000..878877b07 --- /dev/null +++ b/ansible/roles/pytools/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/ansible/roles/pytools/tests/test.yml b/ansible/roles/pytools/tests/test.yml new file mode 100644 index 000000000..a665aa544 --- /dev/null +++ b/ansible/roles/pytools/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - pytools diff --git a/ansible/roles/pytools/vars/main.yml b/ansible/roles/pytools/vars/main.yml new file mode 100644 index 000000000..940a734c2 --- /dev/null +++ b/ansible/roles/pytools/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for pytools diff --git a/ansible/roles/slurm_stats/README.md b/ansible/roles/slurm_stats/README.md new file mode 100644 index 000000000..69032c13a --- /dev/null +++ b/ansible/roles/slurm_stats/README.md @@ -0,0 +1,33 @@ +stackhpc.slurm_openstack_tools.slurm-stats +========================================== + +Configures slurm-stats from https://github.com/stackhpc/slurm-openstack-tools.git which +transforms sacct output into a form that is more amenable for importing into elasticsearch/loki. + +Requirements +------------ + +Role Variables +-------------- + +See `defaults/main.yml`. + +Dependencies +------------ + +Example Playbook +---------------- + + - hosts: compute + tasks: + - import_role: + name: stackhpc.slurm_openstack_tools.slurm-stats + + +License +------- + +Apache-2.0 + +Author Information +------------------ diff --git a/ansible/roles/slurm_stats/defaults/main.yml b/ansible/roles/slurm_stats/defaults/main.yml new file mode 100644 index 000000000..4aaa75784 --- /dev/null +++ b/ansible/roles/slurm_stats/defaults/main.yml @@ -0,0 +1,13 @@ +--- +#################### +# log rotate options +#################### + +# These options affect the contents of the log-rotate file. +# See: man logrotate + +# Log files are rotated count times before being removed +slurm_stats_log_rotate_content_rotate: 7 + +# How frequently are the log files rotated. Can be one of daily, monthly, ... +slurm_stats_log_rotate_content_frequency: daily diff --git a/ansible/roles/slurm_stats/tasks/main.yml b/ansible/roles/slurm_stats/tasks/main.yml new file mode 100644 index 000000000..d681b7f3c --- /dev/null +++ b/ansible/roles/slurm_stats/tasks/main.yml @@ -0,0 +1,34 @@ +--- + +- name: Setup slurm tools + include_role: + name: pytools + +- name: Create a directory to house the log files + file: + state: directory + path: /var/log/slurm-stats + become: true + +- name: Create cron job + cron: + name: Generate slurm stats + minute: "*/5" + user: root + # NOTE: lasttimestamp is stored at /root/lasttimestamp + job: "TZ=UTC /opt/slurm-tools/bin/slurm-stats >> /var/log/slurm-stats/finished_jobs.json" + cron_file: slurm-stats + become: true + +- name: Setup log rotate + copy: + content: | + # WARNING: This file is managed by ansible, do not modify. + /var/log/slurm-stats/finished_jobs.json { + {{ slurm_stats_log_rotate_content_frequency }} + rotate {{ slurm_stats_log_rotate_content_rotate }} + compress + delaycompress + } + dest: /etc/logrotate.d/slurm-stats + become: true diff --git a/ansible/slurm.yml b/ansible/slurm.yml index cf282f786..71e2ab9c3 100644 --- a/ansible/slurm.yml +++ b/ansible/slurm.yml @@ -9,16 +9,6 @@ - include_role: name: mysql -- name: Setup slurm-driven reimage - hosts: rebuild - become: yes - tags: - - rebuild - - openhpc - tasks: - - import_role: - name: stackhpc.slurm_openstack_tools.rebuild - - name: Setup slurm hosts: openhpc become: yes diff --git a/requirements.yml b/requirements.yml index 71adbc6e5..3eff9168e 100644 --- a/requirements.yml +++ b/requirements.yml @@ -28,9 +28,6 @@ collections: version: 1.16.2 - name: community.grafana version: 1.5.4 - - name: https://github.com/stackhpc/ansible_collection_slurm_openstack_tools - type: git - version: v0.2.0 - name: ansible.posix version: 1.5.4 - name: ansible.netcommon From dc5c50a9ab6e76f8d4b34d77d769ea792b315a08 Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Wed, 15 Jan 2025 16:03:38 +0000 Subject: [PATCH 2/6] bump CI images --- .../.stackhpc/terraform/cluster_image.auto.tfvars.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environments/.stackhpc/terraform/cluster_image.auto.tfvars.json b/environments/.stackhpc/terraform/cluster_image.auto.tfvars.json index 37bd8c3d6..de5e8e194 100644 --- a/environments/.stackhpc/terraform/cluster_image.auto.tfvars.json +++ b/environments/.stackhpc/terraform/cluster_image.auto.tfvars.json @@ -1,6 +1,6 @@ { "cluster_image": { - "RL8": "openhpc-RL8-250114-1627-bccc88b5", - "RL9": "openhpc-RL9-250114-1626-bccc88b5" + "RL8": "openhpc-RL8-250115-1510-99f67c6d", + "RL9": "openhpc-RL9-250115-1510-99f67c6d" } } From 0cded5c2ad04ad8b73676b47c10187c530122831 Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Wed, 15 Jan 2025 16:39:49 +0000 Subject: [PATCH 3/6] remove unused pytest role files --- ansible/roles/pytools/handlers/main.yml | 2 - ansible/roles/pytools/meta/main.yml | 52 ------------------------- ansible/roles/pytools/tests/inventory | 2 - ansible/roles/pytools/tests/test.yml | 5 --- ansible/roles/pytools/vars/main.yml | 2 - 5 files changed, 63 deletions(-) delete mode 100644 ansible/roles/pytools/handlers/main.yml delete mode 100644 ansible/roles/pytools/meta/main.yml delete mode 100644 ansible/roles/pytools/tests/inventory delete mode 100644 ansible/roles/pytools/tests/test.yml delete mode 100644 ansible/roles/pytools/vars/main.yml diff --git a/ansible/roles/pytools/handlers/main.yml b/ansible/roles/pytools/handlers/main.yml deleted file mode 100644 index 9fe318713..000000000 --- a/ansible/roles/pytools/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for pytools diff --git a/ansible/roles/pytools/meta/main.yml b/ansible/roles/pytools/meta/main.yml deleted file mode 100644 index c572acc9f..000000000 --- a/ansible/roles/pytools/meta/main.yml +++ /dev/null @@ -1,52 +0,0 @@ -galaxy_info: - author: your name - description: your role description - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) - - min_ansible_version: 2.1 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. diff --git a/ansible/roles/pytools/tests/inventory b/ansible/roles/pytools/tests/inventory deleted file mode 100644 index 878877b07..000000000 --- a/ansible/roles/pytools/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/ansible/roles/pytools/tests/test.yml b/ansible/roles/pytools/tests/test.yml deleted file mode 100644 index a665aa544..000000000 --- a/ansible/roles/pytools/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - pytools diff --git a/ansible/roles/pytools/vars/main.yml b/ansible/roles/pytools/vars/main.yml deleted file mode 100644 index 940a734c2..000000000 --- a/ansible/roles/pytools/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for pytools From 1d83ec55eeef9dde5fd61cf3296bba8a290a81f2 Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Wed, 15 Jan 2025 16:40:58 +0000 Subject: [PATCH 4/6] remove unused reboot validation --- ansible/validate.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ansible/validate.yml b/ansible/validate.yml index d02caac60..ca0a95854 100644 --- a/ansible/validate.yml +++ b/ansible/validate.yml @@ -40,16 +40,6 @@ tasks_from: validate.yml tags: validate -- name: Validate rebuild configuration - hosts: rebuild - gather_facts: false - tags: rebuild - tasks: - - import_role: - name: stackhpc.slurm_openstack_tools.rebuild - tasks_from: validate.yml - tags: validate - - name: Validate openondemand configuration hosts: - openondemand From 6c390cf8f66ffcf963e7109f47210c6e187ddd65 Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Thu, 16 Jan 2025 09:33:20 +0000 Subject: [PATCH 5/6] rename pytools to slurm_tools --- ansible/roles/{pytools => slurm_tools}/.travis.yml | 0 ansible/roles/{pytools => slurm_tools}/README.md | 0 ansible/roles/{pytools => slurm_tools}/defaults/main.yml | 0 ansible/roles/{pytools => slurm_tools}/tasks/main.yml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename ansible/roles/{pytools => slurm_tools}/.travis.yml (100%) rename ansible/roles/{pytools => slurm_tools}/README.md (100%) rename ansible/roles/{pytools => slurm_tools}/defaults/main.yml (100%) rename ansible/roles/{pytools => slurm_tools}/tasks/main.yml (100%) diff --git a/ansible/roles/pytools/.travis.yml b/ansible/roles/slurm_tools/.travis.yml similarity index 100% rename from ansible/roles/pytools/.travis.yml rename to ansible/roles/slurm_tools/.travis.yml diff --git a/ansible/roles/pytools/README.md b/ansible/roles/slurm_tools/README.md similarity index 100% rename from ansible/roles/pytools/README.md rename to ansible/roles/slurm_tools/README.md diff --git a/ansible/roles/pytools/defaults/main.yml b/ansible/roles/slurm_tools/defaults/main.yml similarity index 100% rename from ansible/roles/pytools/defaults/main.yml rename to ansible/roles/slurm_tools/defaults/main.yml diff --git a/ansible/roles/pytools/tasks/main.yml b/ansible/roles/slurm_tools/tasks/main.yml similarity index 100% rename from ansible/roles/pytools/tasks/main.yml rename to ansible/roles/slurm_tools/tasks/main.yml From 62778b397ed9a5838f480dd80c38e4631514d93a Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Thu, 16 Jan 2025 09:35:46 +0000 Subject: [PATCH 6/6] tidy slurm_tools --- ansible/roles/slurm_tools/README.md | 36 ++++----------------- ansible/roles/slurm_tools/defaults/main.yml | 1 - ansible/roles/slurm_tools/tasks/main.yml | 1 - 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/ansible/roles/slurm_tools/README.md b/ansible/roles/slurm_tools/README.md index dec1b2c59..9724c4460 100644 --- a/ansible/roles/slurm_tools/README.md +++ b/ansible/roles/slurm_tools/README.md @@ -1,36 +1,12 @@ -stackhpc.slurm_openstack_tools.pytools +slurm_tools ========= -Installs python-based tools from https://github.com/stackhpc/slurm-openstack-tools.git into `/opt/slurm-tools/bin/`. - -Requirements ------------- +Install python-based tools from https://github.com/stackhpc/slurm-openstack-tools.git into `/opt/slurm-tools/bin/`. Role Variables -------------- -`pytools_editable`: Optional. Whether to install the package using `pip`'s editable mode (installing source to `/opt/slurm-tools/src`) - `true` or `false` (default). -`pytools_gitref`: Optional. Git branch, version, commit etc to install. Default `master`. -`pytools_user`: User to install as. Default `root`. - -Dependencies ------------- -None. - -Example Playbook ----------------- - - - hosts: compute - tasks: - - import_role: - name: stackhpc.slurm_openstack_tools.pytools - - -License -------- - -Apache-2.0 - -Author Information ------------------- - +- `pytools_editable`: Optional bool. Whether to install the package using `pip`'s + editable mode (installing source to `/opt/slurm-tools/src`). Default `false`. +- `pytools_gitref`: Optional. Git branch/tag/commit etc to install. Default `master`. +- `pytools_user`: Optional user to install as. Default `root`. diff --git a/ansible/roles/slurm_tools/defaults/main.yml b/ansible/roles/slurm_tools/defaults/main.yml index 2e88ac1a8..39070255c 100644 --- a/ansible/roles/slurm_tools/defaults/main.yml +++ b/ansible/roles/slurm_tools/defaults/main.yml @@ -1,5 +1,4 @@ --- -# defaults file for pytools pytools_editable: false pytools_gitref: master pytools_user: root diff --git a/ansible/roles/slurm_tools/tasks/main.yml b/ansible/roles/slurm_tools/tasks/main.yml index 89bfb663b..e1eb3e51d 100644 --- a/ansible/roles/slurm_tools/tasks/main.yml +++ b/ansible/roles/slurm_tools/tasks/main.yml @@ -31,4 +31,3 @@ state: latest become: true become_user: "{{ pytools_user }}" - # become_flags: -H #'-s /bin/bash' # as has shell specified as /sbin/nologin