diff --git a/roles/set_semaphore_count/README.md b/roles/set_semaphore_count/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..f35566b98e63eb91da3b3da01985a28586f66e79
--- /dev/null
+++ b/roles/set_semaphore_count/README.md
@@ -0,0 +1,12 @@
+Some program, i.e. GAMESS, needs a larger number of system semaphores than normal.
+This program creates a systemd file that sets the value on startup, so that it is persistent
+
+To set count:
+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
+
+- { 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..ad2b5b0c4fdfac35b653fce901856b4e0a8ced2d
--- /dev/null
+++ b/roles/set_semaphore_count/tasks/main.yml
@@ -0,0 +1,15 @@
+---
+- 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: Template set_semaphores.service file
+  template: src=set_semaphores.service.j2 dest=/etc/systemd/system/set_semaphores.service
+  become: true
+  become_user: root
+- name: enable and start set_semaphores service
+  service: name="set_semaphores" state=started enabled=true
+
+
diff --git a/roles/set_semaphore_count/templates/set_semaphores.service.j2 b/roles/set_semaphore_count/templates/set_semaphores.service.j2
new file mode 100644
index 0000000000000000000000000000000000000000..bb29e4df91f2e4e00b6761900404f48e79eab95b
--- /dev/null
+++ b/roles/set_semaphore_count/templates/set_semaphores.service.j2
@@ -0,0 +1,10 @@
+[Unit]
+Description=Increase maximum number of semaphores available on the system
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/bin/sh -c '/usr/bin/echo {{ SEM_COUNT }}   > /proc/sys/kernel/sem'
+
+[Install]
+WantedBy=default.target