diff --git a/roles/set_semaphore_count/README.md b/roles/set_semaphore_count/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2dc03ea31a574196932a811e5a27dc0509236c81 --- /dev/null +++ b/roles/set_semaphore_count/README.md @@ -0,0 +1,12 @@ +Some programs, i.e. GAMESS, needs a larger number of system semaphores than provided by default. +This role creates a config file in /etc/sysctl.d/ that sets the value on startup, so that it is persistent after reboot + +It also runs a Shell command so change has immediate effect: This is the default value for the role +echo 500 256000 64 10240 > /proc/sys/kernel/sem + +We use a variable SEM_COUNT so users can override the default setting. + +use +- { role: set_semaphore_count } #to use default value hardcoded inside main.yml, (as above) +or +- { role: set_semaphore_count, SEM_COUNT: "200 252000 24 20240" } #to use some other value (the ones here are nonsense for example only) diff --git a/roles/set_semaphore_count/tasks/main.yml b/roles/set_semaphore_count/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..01203f6d9fbbfb0de5d564bb045e10430e9a0a07 --- /dev/null +++ b/roles/set_semaphore_count/tasks/main.yml @@ -0,0 +1,44 @@ +--- +- name: set the value of the Semaphores + set_fact: + SEM_COUNT: "500 256000 64 10240" + when: SEM_COUNT is not defined +- name: test value + debug: msg="Value of semaphores is {{ SEM_COUNT }} " #" +- name: Place comment line in file + lineinfile: + path: /etc/sysctl.d/88-setSemaphore.conf + line: "#set large semaphore count. Needed for Gamess." + state: present + create: yes + owner: root + group: root + mode: "u+rwx,o=rx,g=rx" + become: true + become_user: root + +- name: Place comment line in file + lineinfile: + path: /etc/sysctl.d/88-setSemaphore.conf + line: "#https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/tuning_and_optimizing_red_hat_enterprise_linux_for_oracle_9i_and_10g_databases/sect-oracle_9i_and_10g_tuning_guide-setting_semaphores-setting_semaphore_parameters " + state: present + become: true + become_user: root + +- name: Place comment line in file + lineinfile: + path: /etc/sysctl.d/88-setSemaphore.conf + line: "kernel.sem={{ SEM_COUNT }}" + state: present + create: yes + owner: root + group: root + mode: "u+rwx,o=rx,g=rx" + become: true + become_user: root + +- name: set semaphore count now + shell: "/usr/bin/echo {{ SEM_COUNT }} > /proc/sys/kernel/sem" + become: true + become_user: root +