boto/ansible An error occurred (ValidationError) when calling the DescribeTargetGroups operation: You cannot describe more than '20' target groups at a time
scottdhowell3 opened this issue · comments
When running ec2_asg in ansible getting a boto error about not being able to describe the target groups associated with an already created ASG.
Code:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the DescribeTargetGroups operation: You cannot describe more than '20' target groups at a time fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/Users/scotthowell/.ansible/tmp/ansible-tmp-1561739975.61-72753041101081/AnsiballZ_ec2_asg.py\", line 113, in <module>\n _ansiballz_main()\n File \"/Users/scotthowell/.ansible/tmp/ansible-tmp-1561739975.61-72753041101081/AnsiballZ_ec2_asg.py\", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/Users/scotthowell/.ansible/tmp/ansible-tmp-1561739975.61-72753041101081/AnsiballZ_ec2_asg.py\", line 48, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/var/folders/z5/b2lxnmt14zz2_sr5_pm2gbgw0000gn/T/ansible_ec2_asg_payload_VtnKyO/__main__.py\", line 1492, in <module>\n File \"/var/folders/z5/b2lxnmt14zz2_sr5_pm2gbgw0000gn/T/ansible_ec2_asg_payload_VtnKyO/__main__.py\", line 1478, in main\n File \"/var/folders/z5/b2lxnmt14zz2_sr5_pm2gbgw0000gn/T/ansible_ec2_asg_payload_VtnKyO/__main__.py\", line 920, in create_autoscaling_group\n File \"/var/folders/z5/b2lxnmt14zz2_sr5_pm2gbgw0000gn/T/ansible_ec2_asg_payload_VtnKyO/__main__.py\", line 610, in get_properties\n File \"/usr/local/lib/python2.7/site-packages/botocore/paginate.py\", line 449, in build_full_result\n for response in self:\n File \"/usr/local/lib/python2.7/site-packages/botocore/paginate.py\", line 255, in __iter__\n response = self._make_request(current_kwargs)\n File \"/usr/local/lib/python2.7/site-packages/botocore/paginate.py\", line 332, in _make_request\n return self._method(**current_kwargs)\n File \"/usr/local/lib/python2.7/site-packages/botocore/client.py\", line 357, in _api_call\n return self._make_api_call(operation_name, kwargs)\n File \"/usr/local/lib/python2.7/site-packages/botocore/client.py\", line 661, in _make_api_call\n raise error_class(parsed_response, operation_name)\nbotocore.exceptions.ClientError: An error occurred (ValidationError) when calling the DescribeTargetGroups operation: You cannot describe more than '20' target groups at a time\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
I also have this issue with Ansible 2.9.4
Here is the piece of script which cause the issue :
- name: Create the autoscaling group
ec2_asg:
name: "my-group"
launch_config_name: my-lc-config
target_group_arns: "{{ tg | json_query('results[*].ansible_facts.target_group_arn') | list }}"
vpc_zone_identifier: "{{ config.subnets }}"
health_check_period: 60
health_check_type: ELB
replace_all_instances: yes
min_size: 1
max_size: 4
desired_capacity: 2
region: "{{ config.region }}"
register: instances
I think this issue still shows up pretty high in Google so leaving this here in case. Fix for this was just merged in