You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encountered an issue where tasks run multiple times on hosts that belong to several groups included in the play hosts line with the OR operator (ie. "hosts: group1:group2") when one of the groups is generated at run time using add_host.
This happens on both Ansible 1.4.4 and current devel.
Please see the test case below:
inventory/hosts
[testgroup]
foo
[testgroup2]
foo
test.yml
---
- name: Add test host
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Add host to temporary group
local_action: add_host hostname=foo groupname=tempgroup
# Run a task against two groups, both defined in inventory (works correctly)
- name: Test 1
hosts: testgroup:testgroup2
gather_facts: no
tasks:
- name: Check host
local_action: command /bin/true
# Run a task agains two groups, one defined in inventory and another at run time (works incorrectly)
- name: Test 2
hosts: testgroup:tempgroup
gather_facts: no
tasks:
- name: Check host
local_action: command /bin/true
Expected output (Test 1 and Test 2 are exactly the same):
PLAY [Add test host] **********************************************************
TASK: [Add host to temporary group] *******************************************
ok: [localhost]
PLAY [Test 1] *****************************************************************
TASK: [Check host] ************************************************************
changed: [foo]
PLAY [Test 2] *****************************************************************
TASK: [Check host] ************************************************************
changed: [foo]
Actual output (Test 2 task runs twice):
PLAY [Add test host] **********************************************************
TASK: [Add host to temporary group] *******************************************
ok: [localhost]
PLAY [Test 1] *****************************************************************
TASK: [Check host] ************************************************************
changed: [foo]
PLAY [Test 2] *****************************************************************
TASK: [Check host] ************************************************************
changed: [foo]
changed: [foo]
The text was updated successfully, but these errors were encountered:
Hi,
I have encountered an issue where tasks run multiple times on hosts that belong to several groups included in the play hosts line with the OR operator (ie. "hosts: group1:group2") when one of the groups is generated at run time using add_host.
This happens on both Ansible 1.4.4 and current devel.
Please see the test case below:
inventory/hosts
test.yml
Expected output (Test 1 and Test 2 are exactly the same):
Actual output (Test 2 task runs twice):
The text was updated successfully, but these errors were encountered: