I'm trying to create workers from my Ansible Master. This is my playbook:
- name: Provisioning Spot instaces
ec2:
assign_public_ip: no
spot_price: "{{ ondemand4_price }}"
spot_wait_timeout: 300
assign_public_ip: no
aws_access_key: "{{ assumed_role.sts_creds.access_key }}"
aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}"
security_token: "{{ assumed_role.sts_creds.session_token }}"
region: "{{ aws_region }}"
image: "{{ image_instance }}"
instance_type: "{{ large_instance }}"
key_name: "{{ ssh_keyname }}"
count: "{{ ninstances }}"
state: present
group_id: "{{ priv_sg }}"
vpc_subnet_id: "{{ subnet_id }}"
instance_profile_name: 'ML-Ansible'
wait: true
instance_tags:
Name: Worker
#delete_on_termination: yes
register: ec2
ignore_errors: True
I get the following error when I try to execute it. Please help!
"stderr": "\nAn error occurred (InvalidClientTokenId) when calling the PutMetricData operation: The security token included in the request is invalid.",