Issue 1:
Observing a regression with a playbook that runs on a daily basis. The playbook relies on a custom ec2 module that has idempotency changes not yet accepted upstream.

The problem appears to be triggered by code the following method call:

module.from_json(instance_tags)

The task calling the module is as follows:

- name: create/locate ec2 instance(s)
ec2:
state: present
idempotency_attribute: 'tags'
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
region: '{{ aws_region }}'
instance_type: '{{ aws_instance_type }}'
instance_tags: '{"Name": "{{aws_name_prefix}}-{{item.name}}"}'
group: '{{ aws_security_group }}'
key_name: '{{ aws_key_name }}'
image: '{{ item.id }}'
wait: yes
with_items: aws_images
register: aws

TASK: [create_ec2 | create/locate ec2 instance(s)] ****************************
failed: [127.0.0.1] => (item={'id': 'ami-eb6b0182', 'user': 'root', 'name': 'centos-6.4-x86_64'}) => {"failed": true, "item": {"id": "ami-eb6b0182", "name": "centos-6.4-x86_64", "user": "root"}, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/Users/jlaska/.ansible/tmp/ansible-1383223541.39-224032155676733/ec2", line 1677, in <module>
main()
File "/Users/jlaska/.ansible/tmp/ansible-1383223541.39-224032155676733/ec2", line 735, in main
(instance_dict_array, new_instance_ids, changed) = create_instances(module, ec2)
File "/Users/jlaska/.ansible/tmp/ansible-1383223541.39-224032155676733/ec2", line 484, in create_instances
previous_reservations = get_instances(module, ec2, **dict(state='running', **filter_args))
File "/Users/jlaska/.ansible/tmp/ansible-1383223541.39-224032155676733/ec2", line 390, in get_instances
filters.update(dict(("tag:" + tn, tv) for tn, tv in module.from_json(instance_tags).items()))
File "/Users/jlaska/.ansible/tmp/ansible-1383223541.39-224032155676733/ec2", line 1492, in from_json
return json.loads(data)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

Using git bisect, I've determined that the commit causing the problem is commit b5c9d5a. I'm unclear why this would cause issues. I'm happy to share the custom ec2 module if that will aid in resolution.

b5c9d5a59b32b25ff1d0bc9448a92b0bf0656848 is the first bad commit
commit b5c9d5a59b32b25ff1d0bc9448a92b0bf0656848
Author: Michael DeHaan <michael@ansibleworks.com>
Date: Wed Oct 30 20:48:53 2013 -0400

Inventory directory should always be absolute. Fixes #4535.

Issue 2:
According to http://www.ansibleworks.com/docs/intro_configuration.html#the-ansible-configuration-file, ansible.cfg in the playbook directory should override any other file, but that doesn't happen, because instead of playbook's directory, ansible.cfg is read from current dir.

It happens, because ansible.cfg lookup is made during constants import [1], before command line arguments are processed [2] and playbook location is detected. The solution is to reread configuration explicitly once playbook location is known.

https://github.com/ansible/ansible/blob/devel/lib/ansible/constants.py#L80

https://github.com/ansible/ansible/blob/devel/bin/ansible-playbook#L26