File tree Expand file tree Collapse file tree 13 files changed +165
-31
lines changed
environments/.stackhpc/terraform Expand file tree Collapse file tree 13 files changed +165
-31
lines changed Original file line number Diff line number Diff line change @@ -76,3 +76,7 @@ roles/*
7676! roles /pulp_site /**
7777! roles /doca /
7878! roles /doca /**
79+ ! roles /slurm_stats /
80+ ! roles /slurm_stats /**
81+ ! roles /pytools /
82+ ! roles /pytools /**
Original file line number Diff line number Diff line change 1717- name : Setup slurm stats
1818 hosts : slurm_stats
1919 tags : slurm_stats
20- collections :
21- - stackhpc.slurm_openstack_tools
2220 tasks :
2321 - include_role :
24- name : slurm-stats
25- apply :
26- # Collection currently requires root for all tasks.
27- become : true
22+ name : slurm_stats
2823
2924- name : Deploy filebeat
3025 hosts : filebeat
Original file line number Diff line number Diff line change 1+ stackhpc.slurm_openstack_tools.slurm-stats
2+ ==========================================
3+
4+ Configures slurm-stats from https://github.com/stackhpc/slurm-openstack-tools.git which
5+ transforms sacct output into a form that is more amenable for importing into elasticsearch/loki.
6+
7+ Requirements
8+ ------------
9+
10+ Role Variables
11+ --------------
12+
13+ See ` defaults/main.yml ` .
14+
15+ Dependencies
16+ ------------
17+
18+ Example Playbook
19+ ----------------
20+
21+ - hosts: compute
22+ tasks:
23+ - import_role:
24+ name: stackhpc.slurm_openstack_tools.slurm-stats
25+
26+
27+ License
28+ -------
29+
30+ Apache-2.0
31+
32+ Author Information
33+ ------------------
Original file line number Diff line number Diff line change 1+ ---
2+ # ###################
3+ # log rotate options
4+ # ###################
5+
6+ # These options affect the contents of the log-rotate file.
7+ # See: man logrotate
8+
9+ # Log files are rotated count times before being removed
10+ slurm_stats_log_rotate_content_rotate : 7
11+
12+ # How frequently are the log files rotated. Can be one of daily, monthly, ...
13+ slurm_stats_log_rotate_content_frequency : daily
Original file line number Diff line number Diff line change 1+ ---
2+
3+ - name : Setup slurm tools
4+ include_role :
5+ name : slurm_tools
6+
7+ - name : Create a directory to house the log files
8+ file :
9+ state : directory
10+ path : /var/log/slurm-stats
11+ become : true
12+
13+ - name : Create cron job
14+ cron :
15+ name : Generate slurm stats
16+ minute : " */5"
17+ user : root
18+ # NOTE: lasttimestamp is stored at /root/lasttimestamp
19+ job : " TZ=UTC /opt/slurm-tools/bin/slurm-stats >> /var/log/slurm-stats/finished_jobs.json"
20+ cron_file : slurm-stats
21+ become : true
22+
23+ - name : Setup log rotate
24+ copy :
25+ content : |
26+ # WARNING: This file is managed by ansible, do not modify.
27+ /var/log/slurm-stats/finished_jobs.json {
28+ {{ slurm_stats_log_rotate_content_frequency }}
29+ rotate {{ slurm_stats_log_rotate_content_rotate }}
30+ compress
31+ delaycompress
32+ }
33+ dest : /etc/logrotate.d/slurm-stats
34+ become : true
Original file line number Diff line number Diff line change 1+ ---
2+ language : python
3+ python : " 2.7"
4+
5+ # Use the new container infrastructure
6+ sudo : false
7+
8+ # Install ansible
9+ addons :
10+ apt :
11+ packages :
12+ - python-pip
13+
14+ install :
15+ # Install ansible
16+ - pip install ansible
17+
18+ # Check ansible version
19+ - ansible --version
20+
21+ # Create ansible.cfg with correct roles_path
22+ - printf '[defaults]\nroles_path=../' >ansible.cfg
23+
24+ script :
25+ # Basic role syntax check
26+ - ansible-playbook tests/test.yml -i tests/inventory --syntax-check
27+
28+ notifications :
29+ webhooks : https://galaxy.ansible.com/api/v1/notifications/
Original file line number Diff line number Diff line change 1+ slurm_tools
2+ =========
3+
4+ Install python-based tools from https://github.com/stackhpc/slurm-openstack-tools.git into ` /opt/slurm-tools/bin/ ` .
5+
6+ Role Variables
7+ --------------
8+
9+ - ` pytools_editable ` : Optional bool. Whether to install the package using ` pip ` 's
10+ editable mode (installing source to ` /opt/slurm-tools/src ` ). Default ` false ` .
11+ - ` pytools_gitref ` : Optional. Git branch/tag/commit etc to install. Default ` master ` .
12+ - ` pytools_user ` : Optional user to install as. Default ` root ` .
Original file line number Diff line number Diff line change 1+ ---
2+ pytools_editable : false
3+ pytools_gitref : master
4+ pytools_user : root
Original file line number Diff line number Diff line change 1+ ---
2+ - name : install python3
3+ package :
4+ name : python3,git
5+ become : true
6+
7+ - name : Create virtualenv directory
8+ file :
9+ path : /opt/slurm-tools
10+ owner : " {{ pytools_user }}"
11+ group : " {{ pytools_user }}"
12+ state : directory
13+ become : true
14+
15+ - block :
16+ - name : Upgrade pip
17+ # This needs to a separate step so that we use the updated version
18+ # to install the packages below.
19+ pip :
20+ name : pip
21+
22+ - name : Create virtualenv
23+ pip :
24+ name : " git+https://github.com/stackhpc/slurm-openstack-tools.git@{{ pytools_gitref }}#egg=slurm_openstack_tools"
25+ editable : " {{ pytools_editable }}"
26+
27+ module_defaults :
28+ ansible.builtin.pip :
29+ virtualenv : /opt/slurm-tools
30+ virtualenv_command : python3 -m venv
31+ state : latest
32+ become : true
33+ become_user : " {{ pytools_user }}"
Original file line number Diff line number Diff line change 99 - include_role :
1010 name : mysql
1111
12- - name : Setup slurm-driven reimage
13- hosts : rebuild
14- become : yes
15- tags :
16- - rebuild
17- - openhpc
18- tasks :
19- - import_role :
20- name : stackhpc.slurm_openstack_tools.rebuild
21-
2212- name : Setup slurm
2313 hosts : openhpc
2414 become : yes
You can’t perform that action at this time.
0 commit comments