Move /usr rw remount into remount-usr role
This commit is contained in:
parent
37c1325c1a
commit
1c48df025c
31 changed files with 69 additions and 347 deletions
|
@ -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:
|
||||
|
|
|
@ -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 }}"
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
- include: remount_usr_rw.yml
|
||||
- include_role:
|
||||
name: remount-usr
|
||||
when: general_scripts_dir | search("/usr")
|
||||
|
||||
- name: "copy generateldif.sh"
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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:
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
Normal file
6
remount-usr/handlers/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: remount usr
|
||||
command: mount -o remount /usr
|
||||
failed_when: false
|
||||
args:
|
||||
warn: no
|
16
remount-usr/tasks/main.yml
Normal file
16
remount-usr/tasks/main.yml
Normal file
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,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:
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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 }}"
|
||||
|
|
|
@ -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
|
|
@ -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…
Add table
Reference in a new issue