Last active
December 24, 2015 09:49
-
-
Save base10/6780137 to your computer and use it in GitHub Desktop.
I'm getting an error message when trying to use a variable with async and poll options on a task. It's no problem to use variables elsewhere, but for poll and async, it's a problem. Example below with just poll. Thoughts?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Create ec2 instances | |
hosts: local | |
gather_facts: True | |
vars_files: | |
- group_vars/all | |
vars: | |
poll_interval: 5 | |
roles: | |
- { role: create-instances, query_group: 'assignment_take_small' } | |
- { role: create-instances, query_group: 'visit_scores' } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Create aws instances | |
local_action: | |
module: ec2 | |
key_name={{ keypair }} | |
group_id={{ security_group }} | |
instance_type={{ instance_type }} | |
image={{ image }} | |
wait=true | |
wait_timeout={{ wait_timeout }} | |
region={{ region }} | |
count={{ query_groups[query_group]['count'] }} | |
async: 1800 | |
poll: '{{ poll_interval }}' | |
register: ec2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/Users/nathan/code/infrastructure/ansible/bin/ansible-playbook", line 268, in <module> | |
sys.exit(main(sys.argv[1:])) | |
File "/Users/nathan/code/infrastructure/ansible/bin/ansible-playbook", line 208, in main | |
pb.run() | |
File "/Users/nathan/code/infrastructure/ansible/lib/ansible/playbook/__init__.py", line 228, in run | |
play = Play(self, play_ds, play_basedir) | |
File "/Users/nathan/code/infrastructure/ansible/lib/ansible/playbook/play.py", line 123, in __init__ | |
self._tasks = self._load_tasks(self._ds.get('tasks', []), load_vars) | |
File "/Users/nathan/code/infrastructure/ansible/lib/ansible/playbook/play.py", line 452, in _load_tasks | |
results += self._load_tasks(data, mv, default_vars, included_sudo_vars, included_additional_conditions, original_file=include_filename, role_name=new_role) | |
File "/Users/nathan/code/infrastructure/ansible/lib/ansible/playbook/play.py", line 454, in _load_tasks | |
results.append(Task(self,x,module_vars=task_vars,default_vars=default_vars,additional_conditions=additional_conditions,role_name=role_name)) | |
File "/Users/nathan/code/infrastructure/ansible/lib/ansible/playbook/task.py", line 187, in __init__ | |
self.async_poll_interval = int(ds.get('poll', 10)) # default poll = 10 seconds | |
ValueError: invalid literal for int() with base 10: '{{poll_interval}}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment