---------------------------
ec2: error: unrecognized arguments
This is almost certainly caused by placing the EC2 dynamic inventory script in you project's ./library directory. What's happening is that the dynamic inventory python script has the same name as the default EC2 module. Therefore, it overloads the default module at runtime. Put your dynamic inventory scripts in the root directory of your project to avoid this problem.
---------------------------
"The conditional check {Some check} failed. The error was: unhashable type: 'AnsibleMapping'
This is probably because your conditional check contains a colon or some other special character for jinja2. My example was:
when:
- volume_state.stdout == "/dev/xvdb: data"
I fixed this by changing the statment to:
when:
- "{{ volume_state.stdout == '/dev/xvdb: data' }}"
---------------------------
Conditional string contains single quote character [ ' ]
Running a conditional check on a string with a single quote in it will generate a variety of syntax errors. Here's a quick playbook to show how to manage single quotes when doing conditionals:
#!/usr/local/bin/ansible-playbook --- - name: Testing conditionals hosts: localhost gather_facts: False tasks: - set_fact: test_string: "This string 'sucks'" - shell: "echo \"Success! {{ test_string }}\"" register: results when: test_string.find('\'') != -1 - debug: var=results.stdout when: results.changed