ansible/ansibullbot

Is lookup (AWS_SSM) supported in China region cn-north-1??

yervaraj1991 opened this issue · 1 comments

I have an existing ansible configuration in place to use lookup along with aws_ssm ansible plugin to retrieve the ssm values in US-east-1 and eu-central-1 and its working fine. I am trying to use the same for china region cn-north-1 but it is throwing an error/exception. So wanted to make sure if aws_ssm plugin is supported in china region??

We kept using this cofiguration/plugin in us east1 and eu central 1 from almost two years but never saw any issue with the plugin

ERRORS:

--> FAILED! => {"msg": "An unhandled exception occurred while templating '{{ lookup( 'aws_ssm', '/{{ env }}/trend_micro_install_token', region='cn-north-1', endpoint='ssm.cn-north-1.amazonaws.com.cn')}}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while running the lookup plugin 'aws_ssm'. Error was a <class 'AttributeError'>, original message: 'LookupModule' object has no attribute 'fail_json'. 'LookupModule' object has no attribute 'fail_json'"}

-->FAILED! => {"msg": "An unhandled exception occurred while templating '{{ lookup( 'aws_ssm', '/{{ env }}/trend_micro_install_token', region=region)}}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while running the lookup plugin 'aws_ssm'. Error was a <class 'TypeError'>, original message: expected string or bytes-like object"}

these are the couple of errors i saw

MY ANSIBLE CONFIGURATION LOOKS LIKE BELOW

name: copy TrendMicro powershell script
win_copy:
src: files/common/InstallTrendMicro.ps1
dest: '{{ powershell_script_dir }}\InstallTrendMicro.ps1'
remote_src: no
when:

not configure_agents
name: run TrendMicro powershell script
win_command: 'powershell.exe -ExecutionPolicy ByPass -File {{ powershell_script_dir }}\InstallTrendMicro.ps1 -InstallToken {{ trendmicro_agent_token }}'
when:

configure_agents | bool
--> trendmicro_agent_token. is being passed as a secured value as below

trendmicro_agent_token: "{{ lookup( 'aws_ssm', '/{{ env }}/trend_micro_install_token', region=region')}}"

since its china, we also tried hardcoding the region=cn-north-1 and also tried passing endpoint parameter like below

trendmicro_agent_token: "{{ lookup( 'aws_ssm', '/{{ env }}/trend_micro_install_token', region='cn-north-1', endpoint='ssm.cn-north-1.amazonaws.com.cn')}}"

but still it doesnt work

Help would be appreciated.. Thanks in Advance