Browse Source

Move /usr rw remount into remount-usr role

evolinux-users
Victor LABORIE 4 years ago
parent
commit
1c48df025c
  1. 5
      apache/tasks/main.yml
  2. 12
      apache/tasks/remount_usr_rw.yml
  3. 19
      drbd/tasks/nagios.yml
  4. 18
      evoacme/tasks/certbot.yml
  5. 3
      evocheck/tasks/install_local.yml
  6. 19
      evocheck/tasks/remount_usr_rw.yml
  7. 19
      evolinux-base/tasks/remount_usr_rw.yml
  8. 3
      evolinux-base/tasks/system.yml
  9. 24
      filebeat/tasks/main.yml
  10. 3
      generate-ldif/tasks/main.yml
  11. 19
      generate-ldif/tasks/remount_usr_rw.yml
  12. 12
      kibana/tasks/main.yml
  13. 19
      kibana/tasks/remount_usr_rw.yml
  14. 17
      kvm-host/tasks/main.yml
  15. 19
      mysql/tasks/remount_usr_rw.yml
  16. 9
      mysql/tasks/utils.yml
  17. 3
      nagios-nrpe/tasks/main.yml
  18. 19
      nagios-nrpe/tasks/remount_usr_rw.yml
  19. 21
      opendkim/tasks/main.yml
  20. 15
      postfix/tasks/packmail.yml
  21. 21
      redis/tasks/munin.yml
  22. 6
      remount-usr/handlers/main.yml
  23. 16
      remount-usr/tasks/main.yml
  24. 15
      spamassasin/tasks/main.yml
  25. 17
      tomcat/tasks/nagios.yml
  26. 4
      varnish/tasks/munin.yml
  27. 19
      varnish/tasks/remount_usr_rw.yml
  28. 15
      webapps/evoadmin-mail/tasks/remount_usr_rw.yml
  29. 3
      webapps/evoadmin-mail/tasks/user.yml
  30. 19
      webapps/evoadmin-web/tasks/remount_usr_rw.yml
  31. 3
      webapps/evoadmin-web/tasks/user.yml

5
apache/tasks/main.yml

@ -131,7 +131,10 @@
tags:
- apache
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
tags:
- apache
- name: "Install save_apache_status.sh"
copy:

12
apache/tasks/remount_usr_rw.yml

@ -1,12 +0,0 @@
---
- name: update ansible_mounts facts
setup:
filter: ansible_mounts
- name: mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: false
when: item.mount == '/usr' and item.options | match(".*ro.*")
with_items: "{{ ansible_mounts }}"

19
drbd/tasks/nagios.yml

@ -8,23 +8,8 @@
tags:
- drbd
- name: Check if /usr is a partition
shell: "mount | grep 'on /usr type'"
args:
warn: no
changed_when: False
failed_when: False
register: usr_partition
check_mode: no
tags:
- drbd
- name: Mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: False
when: usr_partition.rc == 0 and nagios_plugins_dir.stat.exists
- include_role:
name: remount-usr
tags:
- drbd

18
evoacme/tasks/certbot.yml

@ -20,22 +20,8 @@
name: certbot
state: latest
- name: Check if /usr is a partition
shell: "mount | grep 'on /usr type'"
args:
warn: no
changed_when: False
failed_when: False
check_mode: no
register: usr_partition
- name: Mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: False
when: usr_partition.rc == 0
- include_role:
name: remount-usr
- name: Remove certbot symlink for apt install
file:

3
evocheck/tasks/install_local.yml

@ -1,5 +1,6 @@
---
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
when: evocheck_bin_dir | search ("/usr")
- name: Scripts dir is present

19
evocheck/tasks/remount_usr_rw.yml

@ -1,19 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when:
- not ansible_check_mode
- mount.rc == 0
- not mount.stdout_lines.0 | search("rw")
check_mode: yes
args:
warn: no

19
evolinux-base/tasks/remount_usr_rw.yml

@ -1,19 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when:
- not ansible_check_mode
- mount.rc == 0
- not mount.stdout_lines.0 | search("rw")
check_mode: yes
args:
warn: no

3
evolinux-base/tasks/system.yml

@ -33,7 +33,8 @@
# TODO : find a way to force the console-data configuration
# non-interactively (like tzdata ↑)
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
- name: Ensure automagic vim conf is disabled
lineinfile:

24
filebeat/tasks/main.yml

@ -59,31 +59,11 @@
when: filebeat_logstash_plugin and logstash_plugin.stat.exists
- block:
- name: Check if /usr is a partition
shell: "mount | grep 'on /usr type'"
args:
warn: no
changed_when: False
failed_when: False
check_mode: no
register: usr_partition
- name: Mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: False
when: usr_partition.rc == 0
- include_role:
name: remount-usr
- name: Logstash plugin is installed
command: /usr/share/logstash/bin/logstash-plugin install logstash-input-beats
- name: /usr is remounted
command: mount -oremount /usr
args:
warn: no
changed_when: False
when: usr_partition.rc == 0
when:
- filebeat_logstash_plugin
- logstash_plugin.stat.exists

3
generate-ldif/tasks/main.yml

@ -1,5 +1,6 @@
---
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
when: general_scripts_dir | search("/usr")
- name: "copy generateldif.sh"

19
generate-ldif/tasks/remount_usr_rw.yml

@ -1,19 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when:
- not ansible_check_mode
- mount.rc == 0
- not mount.stdout_lines.0 | search("rw")
check_mode: yes
args:
warn: no

12
kibana/tasks/main.yml

@ -58,10 +58,8 @@
when: not ansible_check_mode
- block:
- name: Remount /usr as writable
command: "mount -o remount,rw /usr"
args:
warn: no
- include_role:
name: remount-usr
- name: Move kibana optimize directory
shell: "mv /usr/share/kibana/optimize /var/lib/kibana/optimize && ln -s /var/lib/kibana/optimize /usr/share/kibana/optimize"
@ -69,11 +67,5 @@
creates: /var/lib/kibana/optimize
notify: restart kibana
- name: Remount /usr as read-only
command: "mount -o remount /usr"
args:
warn: no
when: mount.rc == 0 and not mount.stdout_lines.0 | search("rw")
- include: proxy_nginx.yml
when: kibana_proxy_nginx

19
kibana/tasks/remount_usr_rw.yml

@ -1,19 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when:
- not ansible_check_mode
- mount.rc == 0
- not mount.stdout_lines.0 | search("rw")
check_mode: yes
args:
warn: no

17
kvm-host/tasks/main.yml

@ -5,21 +5,8 @@
- include: packages.yml
- name: Check if /usr is a partition
shell: "mount | grep 'on /usr type'"
args:
warn: no
changed_when: False
failed_when: False
check_mode: no
register: usr_partition
- name: Mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: False
when: usr_partition.rc == 0
- include_role:
name: remount-usr
- name: Copy add-vm script
get_url:

19
mysql/tasks/remount_usr_rw.yml

@ -1,19 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when:
- not ansible_check_mode
- mount.rc == 0
- not mount.stdout_lines.0 | search("rw")
check_mode: yes
args:
warn: no

9
mysql/tasks/utils.yml

@ -48,7 +48,8 @@
# mysqltuner
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr")
- name: Install mysqltuner
@ -71,7 +72,8 @@
# automatic optimizations
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr")
- name: Optimize script for MySQL
@ -133,7 +135,8 @@
# my-add.sh
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr")
- name: Install my-add.sh

3
nagios-nrpe/tasks/main.yml

@ -28,7 +28,8 @@
state: directory
notify: restart nagios-nrpe-server
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
when: nagios_plugins_directory | search ("/usr")
tags:
- nagios-plugins

19
nagios-nrpe/tasks/remount_usr_rw.yml

@ -1,19 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when:
- not ansible_check_mode
- mount.rc == 0
- not mount.stdout_lines.0 | search("rw")
check_mode: yes
args:
warn: no

21
opendkim/tasks/main.yml

@ -66,25 +66,8 @@
tags:
- opendkim
- name: check if /usr is a partition
shell: "mount | grep 'on /usr type'"
args:
warn: no
changed_when: False
failed_when: False
register: usr_partition
check_mode: no
tags:
- opendkim
- name: mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: False
when: usr_partition.rc == 0
tags:
- opendkim
- include_role:
name: remount-usr
- name: deploy opendkim-add.sh script
copy:

15
postfix/tasks/packmail.yml

@ -87,19 +87,8 @@
tags:
- postfix
- name: update ansible_mounts facts
setup:
filter: ansible_mounts
tags:
- postfix
- name: mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: false
when: item.mount == '/usr' and item.options | match(".*ro.*")
with_items: "{{ ansible_mounts }}"
- include_role:
name: remount-usr
tags:
- postfix

21
redis/tasks/munin.yml

@ -6,23 +6,10 @@
tags:
- redis
- name: Check if /usr is a partition
shell: "mount | grep 'on /usr type'"
args:
warn: no
changed_when: False
failed_when: False
check_mode: no
register: usr_partition
tags: redis
- name: Mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: False
when: usr_partition.rc == 0
tags: redis
- include_role:
name: remount-usr
tags:
- redis
- name: Create plugin directory
file:

6
remount-usr/handlers/main.yml

@ -0,0 +1,6 @@
---
- name: remount usr
command: mount -o remount /usr
failed_when: false
args:
warn: no

16
remount-usr/tasks/main.yml

@ -0,0 +1,16 @@
---
- name: check if /usr is a read-only partition
command: grep -E " /usr.*ro" /proc/mounts
args:
warn: no
changed_when: False
failed_when: False
check_mode: no
register: usr_partition
- name: mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
when: usr_partition.rc == 0
notify: remount usr

15
spamassasin/tasks/main.yml

@ -27,19 +27,8 @@
tags:
- spamassassin
- name: update ansible_mounts facts
setup:
filter: ansible_mounts
tags:
- spamassassin
- name: mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: false
when: item.mount == '/usr' and item.options | match(".*ro.*")
with_items: "{{ ansible_mounts }}"
- include_role:
name: remount-usr
tags:
- spamassassin

17
tomcat/tasks/nagios.yml

@ -4,21 +4,8 @@
name: monitoring-plugins
state: present
- name: Check if /usr is a partition
shell: "mount | grep 'on /usr type'"
args:
warn: no
changed_when: False
failed_when: False
check_mode: no
register: usr_partition
- name: Mount /usr in rw
command: mount -o remount,rw /usr
args:
warn: no
changed_when: False
when: usr_partition.rc == 0
- include_role:
name: remount-usr
- name: Create Nagios plugins dir
file:

4
varnish/tasks/munin.yml

@ -4,7 +4,9 @@
name: libxml-parser-perl
tags: varnish
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
tags: varnish
- name: Create plugin directory
file:

19
varnish/tasks/remount_usr_rw.yml

@ -1,19 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when:
- not ansible_check_mode
- mount.rc == 0
- not mount.stdout_lines.0 | search("rw")
check_mode: yes
args:
warn: no

15
webapps/evoadmin-mail/tasks/remount_usr_rw.yml

@ -1,15 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when: mount.rc == 0 and not mount.stdout_lines.0 | search("rw")
args:
warn: no

3
webapps/evoadmin-mail/tasks/user.yml

@ -86,7 +86,8 @@
group: "adm"
mode: "0640"
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
when: evoadminmail_scripts_dir | search ("/usr")
- name: "Create {{ evoadminmail_scripts_dir }}"

19
webapps/evoadmin-web/tasks/remount_usr_rw.yml

@ -1,19 +0,0 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when:
- not ansible_check_mode
- mount.rc == 0
- not mount.stdout_lines.0 | search("rw")
check_mode: yes
args:
warn: no

3
webapps/evoadmin-web/tasks/user.yml

@ -52,7 +52,8 @@
group: "{{ evoadmin_username }}"
recurse: yes
- include: remount_usr_rw.yml
- include_role:
name: remount-usr
when: evoadmin_scripts_dir | search ("/usr")
- name: "Create {{ evoadmin_scripts_dir }}"

Loading…
Cancel
Save