34 lines
656 B
Plaintext
34 lines
656 B
Plaintext
|
|
|
|
# - Ansible List
|
|
# -
|
|
# - Python lists have a truthiness of False when empty. So you
|
|
# - can use:
|
|
# - when: <listname>
|
|
# -
|
|
# - Example:
|
|
# - root_user: {} or
|
|
# - root_user:
|
|
# - - value1
|
|
# - - value2
|
|
# -
|
|
# - Check if list 'root_user' is empty:
|
|
# - when: root_user
|
|
|
|
|
|
# - Ansible Array /Scalar
|
|
# -
|
|
# - use:
|
|
# - when <var> is defined and <var>.lenght > 0
|
|
# -
|
|
# - Example:
|
|
# - apt_lxc_host_pkgs: []
|
|
# - apt_lxc_host_pkgs:
|
|
# - - bridge-utils
|
|
# - - lxc
|
|
# - - btrfs-tools
|
|
# - - lua5.3
|
|
# -
|
|
# - Check if list 'apt_lxc_host_pkgs'' is empty:
|
|
# - when: apt_lxc_host_pkgs is defined and apt_lxc_host_pkgs.length > 0
|