diff --git a/roles/aws/aws_ses/tasks/main.yml b/roles/aws/aws_ses/tasks/main.yml index ffa4bba50..346c3c476 100644 --- a/roles/aws/aws_ses/tasks/main.yml +++ b/roles/aws/aws_ses/tasks/main.yml @@ -5,6 +5,7 @@ identity: "{{ _ses_domain }}" state: present region: "{{ _aws_region }}" + delegate_to: localhost - name: Gather AWS account ID if it isn't already set. amazon.aws.aws_caller_info: diff --git a/roles/aws/aws_ses/templates/fetch_account_id.py.j2 b/roles/aws/aws_ses/templates/fetch_account_id.py.j2 deleted file mode 100644 index 8de519679..000000000 --- a/roles/aws/aws_ses/templates/fetch_account_id.py.j2 +++ /dev/null @@ -1,18 +0,0 @@ -#!/home/controller/ansible/bin/python3 -import boto3 -import sys -from botocore.exceptions import NoCredentialsError - -def get_account_id(): - try: - session = boto3.Session() - sts_client = session.client('sts') - response = sts_client.get_caller_identity() - return response['Account'] - except NoCredentialsError: - print("Could not find AWS credentials.") - sys.exit(1) - -if __name__ == "__main__": - account_id = get_account_id() - print(account_id)