Skip to content
Snippets Groups Projects
Commit 89704ad6 authored by Andreas Hamacher's avatar Andreas Hamacher
Browse files

reducing the number of changes

parent 40f56204
No related branches found
No related tags found
3 merge requests!310Gpu2,!308Youshallnotchanged,!304Gpu
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
- { role: lmod, tags: [ other ] } - { role: lmod, tags: [ other ] }
- { role: enable_modules, default_modules: "modulecmd", tags: [ other ] } - { role: enable_modules, default_modules: "modulecmd", tags: [ other ] }
- { role: postfix, tags: [ mail, other ] } - { role: postfix, tags: [ mail, other ] }
- { role: set_semaphore_count, tags: [ semaphore ] }
- hosts: 'VisNodes' - hosts: 'VisNodes'
vars_files: vars_files:
......
...@@ -23,7 +23,7 @@ for group in d['groups'].keys(): ...@@ -23,7 +23,7 @@ for group in d['groups'].keys():
else: else:
hosts[h] = ['%s.%s %s'%(name,domain,name)] hosts[h] = ['%s.%s %s'%(name,domain,name)]
for h in hosts.keys(): for h in sorted(hosts.keys()):
if d['hostvars'].has_key(h): if d['hostvars'].has_key(h):
for addr in d['hostvars'][h]['ansible_all_ipv4_addresses']: for addr in d['hostvars'][h]['ansible_all_ipv4_addresses']:
if "172.16.200" in addr: if "172.16.200" in addr:
...@@ -32,14 +32,14 @@ for h in hosts.keys(): ...@@ -32,14 +32,14 @@ for h in hosts.keys():
string=string+" %s"%(name) string=string+" %s"%(name)
print string print string
for h in hosts.keys(): for h in sorted(hosts.keys()):
if d['hostvars'].has_key(h): if d['hostvars'].has_key(h):
string="%s"%(d['hostvars'][h]['ansible_default_ipv4']['address']) string="%s"%(d['hostvars'][h]['ansible_default_ipv4']['address'])
for name in hosts[h]: for name in hosts[h]:
string=string+" %s"%(name) string=string+" %s"%(name)
print string print string
for h in hosts.keys(): for h in sorted(hosts.keys()):
if d['hostvars'].has_key(h): if d['hostvars'].has_key(h):
if d['hostvars'][h].has_key('ansible_tun0'): if d['hostvars'][h].has_key('ansible_tun0'):
string="%s"%(d['hostvars'][h]['ansible_tun0']['ipv4']['address']) string="%s"%(d['hostvars'][h]['ansible_tun0']['ipv4']['address'])
......
--- ---
- name: set the value of the Semaphores - name: set the value of the Semaphores
set_fact: set_fact:
SEM_COUNT: "500 256000 64 10240" SEM_COUNT: "500\t256000\t64\t10240"
when: SEM_COUNT is not defined when: SEM_COUNT is not defined
- name: test value - name: test value
debug: msg="Value of semaphores is {{ SEM_COUNT }} " #" debug: msg="Value of semaphores is {{ SEM_COUNT }} " #"
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
mode: "u+rwx,o=rx,g=rx" mode: "u+rwx,o=rx,g=rx"
become: true become: true
become_user: root become_user: root
when: ansible_os_family == 'RedHat'
- name: Place comment line in file - name: Place comment line in file
lineinfile: lineinfile:
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
state: present state: present
become: true become: true
become_user: root become_user: root
when: ansible_os_family == 'RedHat'
- name: Place comment line in file - name: Place comment line in file
lineinfile: lineinfile:
...@@ -36,9 +38,21 @@ ...@@ -36,9 +38,21 @@
mode: "u+rwx,o=rx,g=rx" mode: "u+rwx,o=rx,g=rx"
become: true become: true
become_user: root 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 - name: set semaphore count now
shell: "/usr/bin/echo {{ SEM_COUNT }} > /proc/sys/kernel/sem" shell: "/usr/bin/echo {{ SEM_COUNT }} > /proc/sys/kernel/sem"
become: true become: true
become_user: root become_user: root
when:
- current_sem.changed
- ansible_os_family == 'RedHat'
...@@ -3,12 +3,15 @@ ...@@ -3,12 +3,15 @@
template: src=ntp.conf.j2 dest=/etc/ntp.conf mode=644 owner=root group=root template: src=ntp.conf.j2 dest=/etc/ntp.conf mode=644 owner=root group=root
become: true become: true
become_user: root become_user: root
register: ntpinstall
- name: restart ntpd redhat - name: restart ntpd redhat
service: name=ntpd state=restarted service: name=ntpd state=restarted
become: true become: true
become_user: root become_user: root
when: ansible_os_family == "RedHat" when:
- ansible_os_family == "RedHat"
- ntpinstall.changed
- name: ensure ntpd is enabled and started redhat - name: ensure ntpd is enabled and started redhat
service: name=ntpd state=started enabled=yes service: name=ntpd state=started enabled=yes
...@@ -20,7 +23,9 @@ ...@@ -20,7 +23,9 @@
service: name=ntp state=restarted service: name=ntp state=restarted
become: true become: true
become_user: root become_user: root
when: ansible_os_family == "Debian" when:
- ansible_os_family == "Debian"
- ntpinstall.changed
- name: ensure ntpd is enabled and started ubuntu - name: ensure ntpd is enabled and started ubuntu
service: name=ntp state=started enabled=yes service: name=ntp state=started enabled=yes
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
become: true become: true
become_user: root become_user: root
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
register: yumtransactioncleanup
changed_when: "'No unfinished transactions left.' not in yumtransactioncleanup.stdout"
- name: yum upgrade - name: yum upgrade
yum: name=* state=latest yum: name=* state=latest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment