Skip to content
Snippets Groups Projects
main.yml 1.64 KiB
Newer Older
---
- name: set the value of the Semaphores
  set_fact:
       SEM_COUNT: "500\t256000\t64\t10240"
  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"
  when: ansible_os_family == 'RedHat'
     
- 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
  when: ansible_os_family == 'RedHat'
- 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
  when: ansible_os_family == 'RedHat'

- name: get current value
  command: cat /proc/sys/kernel/sem
  register: current_sem
  changed_when: current_sem.stdout not in "{{ SEM_COUNT }}"

- debug:
    var: current_sem

- name: set semaphore count now 
  shell: "/usr/bin/echo {{ SEM_COUNT }}   > /proc/sys/kernel/sem"
  become: true
  become_user: root
  when: 
  - current_sem.changed
  - ansible_os_family == 'RedHat'