---
TEST1: my inventory looks as follows:
192.168.153.31output:
TASK [command] **************************************************************** changed: [192.168.153.31] => (item=ls) changed: [192.168.153.31] => (item=df -h) TASK [delegate] ***************************************************************************** fatal: [192.168.153.31]: FAILED! => {"msg": "'dict object' has no attribute 'test_servers1'"} ...ignoring TASK [lineinfile] ***************************************************************** skipping: [192.168.153.31]TEST2: inventory as follows:
192.168.153.31Output:
TASK [command] ****************************************************************** changed: [192.168.153.31] => (item=ls) changed: [192.168.153.31] => (item=df -h)Question1: In TEST1 since inventory doesn't contain test_servers1 group, so task is ignored. but why lineinfile is skipped eventhought file variable contain results?
Question2: In TEST2, my delegate task contains only one command i.e., ls why file2 has results? As per my knowledge when looping through multiple commands only register variable contains results.
Question3: In lineinfile module, Is it possible to check files2 contains results and if yes to check files2.results is not empty then only loop through it otherwise skip it?