diff --git a/changelogs/fragments/fix_pagination_cloudfront_facts.yml b/changelogs/fragments/fix_pagination_cloudfront_facts.yml new file mode 100644 index 00000000000..95726212fb6 --- /dev/null +++ b/changelogs/fragments/fix_pagination_cloudfront_facts.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Allow more than one page of results by using the right pagination indicator ('NextMarker' instead of 'NextToken'). diff --git a/lib/ansible/modules/cloud/amazon/cloudfront_facts.py b/lib/ansible/modules/cloud/amazon/cloudfront_facts.py index 43756edb33f..3ed6ea11cfd 100644 --- a/lib/ansible/modules/cloud/amazon/cloudfront_facts.py +++ b/lib/ansible/modules/cloud/amazon/cloudfront_facts.py @@ -509,8 +509,12 @@ class CloudFrontServiceManager: else: result = response.get(result_key) results.update(result) - args['NextToken'] = response.get('NextToken') - loop = args['NextToken'] is not None + args['Marker'] = response.get('NextMarker') + for key in response.keys(): + if key.endswith('List'): + args['Marker'] = response[key].get('NextMarker') + break + loop = args['Marker'] is not None return results def keyed_list_helper(self, list_to_key):