set default arc to 20%, attempt to fix data pool creation idempotence

This commit is contained in:
Josh Lay 2019-06-13 20:18:09 -05:00
parent c88082327f
commit af7f9d4f9a
2 changed files with 14 additions and 13 deletions

View file

@ -1,7 +1,7 @@
--- ---
username: jlay # user for 'create-user' role username: jlay # user for 'create-user' role
zfs_disk: /dev/sdb zfs_disk: /dev/vdb
zfs_arc_size_mb: "{{ (ansible_memtotal_mb * 0.50)|int|abs }}" zfs_arc_size_mb: "{{ (ansible_memtotal_mb * 0.20)|int|abs }}"
zfs_arc_size_bytes: "{{ zfs_arc_size_mb }}000000" zfs_arc_size_bytes: "{{ zfs_arc_size_mb }}000000"
pwgen: "{{ lookup('password', '/dev/null chars=ascii_letters,digits,hexdigits,punctuation length=32') }}" pwgen: "{{ lookup('password', '/dev/null chars=ascii_letters,digits,hexdigits,punctuation length=32') }}"
common_pkgs: common_pkgs:

View file

@ -47,22 +47,23 @@
zfs zfs
register: zfsload register: zfsload
# does not adjust to 75% of each host, depends on consistency between hosts - inconsistency leads to disproportionate allocations # does not adjust to 20% 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) - name: set zfs_arc_max to 20% 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="{{ zfs_arc_size_bytes }}"' line: 'options zfs zfs_arc_max="{{ zfs_arc_size_bytes }}"'
# create: yes create: yes
- name: import pools - name: check for data pool
command: "zpool import -a" command: "zpool list"
register: pools 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' - zpool_facts: properties='all'
# really bad idempotence in here... # really bad idempotence in here...
- name: create zpool - name: create zpool
command: "zpool create -f -O compression=lz4 data {{ zfs_disk }} -o ashift=13 -O secondarycache=all" 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