Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

core

ANSIBLE VERSION

ansible 2.3.1.0
config file = /home/hpepejau/Desktop/MyProjects/ansible-role-hpe_serviceguard_lx/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.13 (default, May 10 2017, 20:04:28) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]

CONFIGURATION

N/A

OS / ENVIRONMENT

Ansible is run on Fedora 25

Inventory servers are RedHat 7

SUMMARY

Using delegate_fact doesn't work when I have the connection to servers tunneled through SSH tunnel.

STEPS TO REPRODUCE

Example hosts inventory

[nodes]
10.2.55.2 ansible_user=root ansible_host=127.0.0.1 ansible_port=50035
10.2.55.3 ansible_user=root ansible_host=127.0.0.1 ansible_port=50036

[quorumserver]
10.2.55.66 ansible_user=root ansible_host=127.0.0.1 ansible_port=50034

Example playbook

- hosts: nodes
tasks:
- name: Gather facts from QS (regardless of limit or tags)
setup: filter=ansible_distribution
delegate_to: "{{item}}"
delegate_facts: true
with_items: "{{groups['quorumserver']}}"
- debug: var=hostvars[groups['quorumserver'][0]].ansible_distribution

EXPECTED RESULTS

PLAY [nodes] *******************************************************************

TASK [Gathering Facts] *********************************************************
ok: [10.2.55.3]
ok: [10.2.55.2]

TASK [Gather facts from QS (regardless of limit or tags)] *******************************************************************
ok: [10.2.55.2 -> 10.2.55.66]
ok: [10.2.55.3 -> 10.2.55.66]

TASK [debug] *******************************************************************
ok: [10.2.55.2] => {
"changed": false,
"hostvars[groups['quorumserver'][0]].ansible_distribution": "RedHat"
}
ok: [10.2.55.3] => {
"changed": false,
"hostvars[groups['quorumserver'][0]].ansible_distribution": "RedHat"
}

ACTUAL RESULTS

PLAY [nodes] *******************************************************************

TASK [Gathering Facts] *********************************************************
ok: [10.2.55.2]
ok: [10.2.55.3]

TASK [Gather facts from QS (regardless of limit or tags)] **********************
ok: [10.2.55.3 -> 10.2.55.66] => (item=10.2.55.66)
ok: [10.2.55.2 -> 10.2.55.66] => (item=10.2.55.66)

TASK [debug] *******************************************************************
ok: [10.2.55.2] => {
"changed": false,
"hostvars[groups['quorumserver'][0]].ansible_distribution": "VARIABLE IS NOT DEFINED!"
}
ok: [10.2.55.3] => {
"changed": false,
"hostvars[groups['quorumserver'][0]].ansible_distribution": "VARIABLE IS NOT DEFINED!"
}

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

ec2

ANSIBLE VERSION

works:

$ ansible --version
ansible 2.3.3.0
config file = /home/tessa/.ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.12 (default, Nov 20 2017, 18:23:56) [GCC 5.4.0 20160609]

broken:

$ ansible --version
ansible 2.4.2.0
config file = /home/tessa/.ansible.cfg
configured module search path = [u'/home/tessa/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.12 (default, Nov 20 2017, 18:23:56) [GCC 5.4.0 20160609]

CONFIGURATION

N/A

OS / ENVIRONMENT

Ubuntu 16.04 amd64 on ec2.

SUMMARY

Discovered that using multiple count_tag entries + exact_count to prevent spinning up duplicate instances in ec2 no longer works in ansible 2.4.x, and that it'll just spin up a duplicates even when the tags match. Downgrading to ansible 2.3.x solves the problem.

STEPS TO REPRODUCE

run the following task from localhost multiple times:

- ec2:
region: "us-west-2"
instance_tags:
Name: test
Prefix: dev
exact_count: 1
count_tag:
Name: test
Prefix: dev
key_name: "{{ ssh_key }}"
instance_type: t2.micro
image: ami-45224425
vpc_subnet_id: "{{ vpc_subnet_id }}

EXPECTED RESULTS

only spin up one instance.

ACTUAL RESULTS

spins up multiple instances.

TASK [aws_instances : ec2] ****************************************************************************************************************************************************************************************
task path: /home/tessa/ansible/roles/aws_instances/tasks/main.yml:2
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/cloud/amazon/ec2.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: tessa
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/tessa/.ansible/tmp/ansible-tmp-1515707342.82-54897923708400 `" && echo ansible-tmp-1515707342.82-54897923708400="` echo /home/tessa/.ansible/tmp/ansible-tmp-1515707342.82-54897923708400 `" ) && sleep 0'
<127.0.0.1> PUT /tmp/tmpPn7vWS TO /home/tessa/.ansible/tmp/ansible-tmp-1515707342.82-54897923708400/ec2.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/tessa/.ansible/tmp/ansible-tmp-1515707342.82-54897923708400/ /home/tessa/.ansible/tmp/ansible-tmp-1515707342.82-54897923708400/ec2.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /home/tessa/.ansible/tmp/ansible-tmp-1515707342.82-54897923708400/ec2.py; rm -rf "/home/tessa/.ansible/tmp/ansible-tmp-1515707342.82-54897923708400/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
"changed": true,
"instance_ids": [
"i-04992feeb756b46c5"
],
"instances": [
{
"ami_launch_index": "0",
"architecture": "x86_64",
"block_device_mapping": {
"/dev/sda1": {
"delete_on_termination": true,
"status": "attaching",
"volume_id": "vol-07a2b13e9a727b7cc"
}
},
"dns_name": "",
"ebs_optimized": false,
"groups": {
"sg-8b2faff0": "default"
},
"hypervisor": "xen",
"id": "i-04992feeb756b46c5",
"image_id": "ami-45224425",
"instance_type": "t2.micro",
"kernel": null,
"key_name": "ssh-key",
"launch_time": "2018-01-11T21:49:05.000Z",
"placement": "us-west-2c",
"private_dns_name": "ip-172-23-30-176.us-west-2.compute.internal",
"private_ip": "172.23.30.176",
"public_dns_name": "",
"public_ip": null,
"ramdisk": null,
"region": "us-west-2",
"root_device_name": "/dev/sda1",
"root_device_type": "ebs",
"state": "pending",
"state_code": 0,
"tags": {
"Name": "test",
"Prefix": "dev"
},
"tenancy": "default",
"virtualization_type": "hvm"
}
],
"invocation": {
"module_args": {
"assign_public_ip": false,
"aws_access_key": null,
"aws_secret_key": null,
"count": 1,
"count_tag": "{'Prefix': 'dev', 'Name': 'test'}",
"ebs_optimized": false,
"ec2_url": null,
"exact_count": 1,
"group": null,
"group_id": null,
"id": null,
"image": "ami-45224425",
"instance_ids": null,
"instance_initiated_shutdown_behavior": null,
"instance_profile_name": null,
"instance_tags": {
"Name": "test",
"Prefix": "dev"
},
"instance_type": "t2.micro",
"kernel": null,
"key_name": "bench-tools",
"monitoring": false,
"network_interfaces": null,
"placement_group": null,
"private_ip": null,
"profile": null,
"ramdisk": null,
"region": "us-west-2",
"security_token": null,
"source_dest_check": true,
"spot_launch_group": null,
"spot_price": null,
"spot_type": "one-time",
"spot_wait_timeout": "600",
"state": "present",
"tenancy": "default",
"termination_protection": null,
"user_data": null,
"validate_certs": true,
"volumes": null,
"vpc_subnet_id": "vpc_subnet_id",
"wait": false,
"wait_timeout": "300",
"zone": null
}
},
"tagged_instances": [
{
"ami_launch_index": "0",
"architecture": "x86_64",
"block_device_mapping": {
"/dev/sda1": {
"delete_on_termination": true,
"status": "attaching",
"volume_id": "vol-07a2b13e9a727b7cc"
}
},
"dns_name": "",
"ebs_optimized": false,
"groups": {
"sg-8b2faff0": "default"
},
"hypervisor": "xen",
"id": "i-04992feeb756b46c5",
"image_id": "ami-45224425",
"instance_type": "t2.micro",
"kernel": null,
"key_name": "bench-tools",
"launch_time": "2018-01-11T21:49:05.000Z",
"placement": "us-west-2c",
"private_dns_name": "ip-172-23-30-176.us-west-2.compute.internal",
"private_ip": "172.23.30.176",
"public_dns_name": "",
"public_ip": null,
"ramdisk": null,
"region": "us-west-2",
"root_device_name": "/dev/sda1",
"root_device_type": "ebs",
"state": "pending",
"state_code": 0,
"tags": {
"Name": "test",
"Prefix": "dev"
},
"tenancy": "default",
"virtualization_type": "hvm"
}
]
}