set default arc to 20%, attempt to fix data pool creation idempotence
This commit is contained in:
parent
c88082327f
commit
af7f9d4f9a
2 changed files with 14 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
username: jlay # user for 'create-user' role
|
||||
zfs_disk: /dev/sdb
|
||||
zfs_arc_size_mb: "{{ (ansible_memtotal_mb * 0.50)|int|abs }}"
|
||||
zfs_disk: /dev/vdb
|
||||
zfs_arc_size_mb: "{{ (ansible_memtotal_mb * 0.20)|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:
|
||||
|
|
|
@ -47,22 +47,23 @@
|
|||
zfs
|
||||
register: zfsload
|
||||
|
||||
# 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:
|
||||
# path: "/etc/modprobe.d/zfs.conf"
|
||||
# regexp: '^options zfs zfs_arc_max='
|
||||
# line: 'options zfs zfs_arc_max="{{ zfs_arc_size_bytes }}"'
|
||||
# create: yes
|
||||
# does not adjust to 20% of each host, depends on consistency between hosts - inconsistency leads to disproportionate allocations
|
||||
- name: set zfs_arc_max to 20% installed memory ({{ zfs_arc_size_bytes }} bytes)
|
||||
lineinfile:
|
||||
path: "/etc/modprobe.d/zfs.conf"
|
||||
regexp: '^options zfs zfs_arc_max='
|
||||
line: 'options zfs zfs_arc_max="{{ zfs_arc_size_bytes }}"'
|
||||
create: yes
|
||||
|
||||
- name: import pools
|
||||
command: "zpool import -a"
|
||||
- name: check for data pool
|
||||
command: "zpool list"
|
||||
register: pools
|
||||
changed_when: "pools.stderr != 'no pools available to import'"
|
||||
#ignore_errors: true
|
||||
changed_when: pools.stdout.find('data') != -1
|
||||
|
||||
- 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
|
||||
when: not pools.changed
|
||||
|
|
Loading…
Reference in a new issue