Created
March 4, 2019 19:31
-
-
Save tlester/a5a413da4d19d2cfda472874a5371054 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make FS for CIS compliance | |
- name: make filesystem for /var if needed | |
become: yes | |
filesystem: | |
fstype: ext4 | |
dev: "{{ var_disk }}" | |
register: fs | |
- name: Backup /var | |
when: fs is changed | |
become: yes | |
block: | |
# Adding a yum update here, because if this is happening, it means it's a new host. | |
- name: upgrade all packages | |
yum: | |
name: '*' | |
state: latest | |
- name: Make temporary mount point | |
become: yes | |
mount: | |
name: /mnt/var | |
src: "{{ var_disk }}" | |
fstype: ext4 | |
state: mounted | |
when: fs is changed | |
- name: Backup filesystem | |
become: yes | |
shell: cp -apx /var/* /mnt/var | |
- name: Unmount temp mount | |
become: yes | |
mount: | |
name: /mnt/var | |
state: absent | |
- name: Add /var to the filesystem but dont mount | |
become: yes | |
mount: | |
path: /var | |
src: "{{ var_disk }}" | |
fstype: ext4 | |
opts: defaults,nofail | |
state: present | |
backup: yes | |
- name: Reboot | |
reboot: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment