expanded zfs role
This commit is contained in:
parent
d3d2d6d560
commit
de4b1e497b
2 changed files with 31 additions and 7 deletions
|
@ -1,5 +1,8 @@
|
||||||
---
|
---
|
||||||
zfs_glob: /dev/disk/by-id/*HC_Volume*
|
zfs_disk: /dev/sdb
|
||||||
|
zfs_arc_size_mb: "{{ (ansible_memtotal_mb * 0.75)|int|abs }}"
|
||||||
|
zfs_arc_size_bytes: "{{ zfs_arc_size_mb }}000000"
|
||||||
|
pwgen: "{{ lookup('password', '/dev/null chars=ascii_letters,digits,hexdigits,punctuation length=32') }}"
|
||||||
common_pkgs:
|
common_pkgs:
|
||||||
- bash-completion
|
- bash-completion
|
||||||
- htop
|
- htop
|
||||||
|
@ -10,6 +13,3 @@ common_pkgs:
|
||||||
- sysbench
|
- sysbench
|
||||||
- fio
|
- fio
|
||||||
- rsync
|
- rsync
|
||||||
arc_size_mb: "{{ (ansible_memtotal_mb * 0.75)|int|abs }}"
|
|
||||||
arc_size_bytes: "{{ arc_size_mb }}000000"
|
|
||||||
pwgen: "{{ lookup('password', '/dev/null chars=ascii_letters,digits,hexdigits,punctuation length=32') }}"
|
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# temporarily added to test zfs role by itself
|
||||||
|
#- name: check if atomic
|
||||||
|
# stat:
|
||||||
|
# path: /run/ostree-booted
|
||||||
|
# register: ostree
|
||||||
|
#
|
||||||
|
#- name: set fact (atomic state)
|
||||||
|
# set_fact:
|
||||||
|
# is_atomic: "{{ ostree.stat.exists }}"
|
||||||
|
# end temp additions
|
||||||
|
|
||||||
- name: install zfs-release package (RHEL/CentOS)
|
- name: install zfs-release package (RHEL/CentOS)
|
||||||
yum:
|
yum:
|
||||||
name: "http://download.zfsonlinux.org/epel/zfs-release.el7_5.noarch.rpm"
|
name: "http://download.zfsonlinux.org/epel/zfs-release.el7_5.noarch.rpm"
|
||||||
|
@ -34,11 +45,24 @@
|
||||||
dest: "/etc/modules-load.d/zfs.conf"
|
dest: "/etc/modules-load.d/zfs.conf"
|
||||||
content: |
|
content: |
|
||||||
zfs
|
zfs
|
||||||
|
register: zfsload
|
||||||
|
|
||||||
#- name: set zfs_arc_max to 75% installed memory ({{ arc_size_bytes }} bytes)
|
# does not adjust to 75% of each host, depends on consistency between hosts - inconsistency leads to disproportionate allocations
|
||||||
|
#- name: set zfs_arc_max to 75% installed memory ({{ zfs_arc_size_bytes }} bytes)
|
||||||
# lineinfile:
|
# lineinfile:
|
||||||
# path: "/etc/modprobe.d/zfs.conf"
|
# path: "/etc/modprobe.d/zfs.conf"
|
||||||
# regexp: '^options zfs zfs_arc_max='
|
# regexp: '^options zfs zfs_arc_max='
|
||||||
# line: 'options zfs zfs_arc_max="{{ arc_size_bytes }}"'
|
# line: 'options zfs zfs_arc_max="{{ zfs_arc_size_bytes }}"'
|
||||||
# create: yes
|
# create: yes
|
||||||
# commented out, does not adjust to 75% of each host, leading to disproportionate allocations
|
|
||||||
|
- name: import pools
|
||||||
|
command: "zpool import -a"
|
||||||
|
register: pools
|
||||||
|
changed_when: "pools.stderr != 'no pools available to import'"
|
||||||
|
|
||||||
|
- zpool_facts: properties='all'
|
||||||
|
|
||||||
|
# really bad idempotence in here...
|
||||||
|
- name: create zpool
|
||||||
|
command: "zpool create -f -O compression=lz4 data {{ zfs_disk }} -o ashift=13 -O secondarycache=all"
|
||||||
|
when: ansible_zfs_pools is not defined
|
||||||
|
|
Loading…
Add table
Reference in a new issue