I am trying to automate the creation of aws workspaces using ansible, but I cant get the command to create the workspace right.
Here is my playbook.yml and I am running ansible on a linux ec2 instance.
- hosts: windows
gather_facts: false
vars:
BundleId: "wpc-30g6060"
DirectoryId: "d-8039964"
UserName: "testing"
tasks:
- name: deploy workspaces
command: >
aws workspaces create-workspaces --workspaces
--cli-input-json '{{ lookup('template', 'workspaces.json') | to_json }}'
delegate_to: localhost
# loop: "{{ user_list }}"
Here is the workspaces.json
{
"DirectoryId": "{{ DirectoryId }}",
"UserName": "{{ UserName }}",
"BundleId": "{{ BundleId }}",
"UserVolumeEncryptionEnabled": false,
"RootVolumeEncryptionEnabled": false,
"WorkspaceProperties": {
"RunningMode": "ALWAYS_ON",
"RunningModeAutoStopTimeoutInMinutes": 5,
"RootVolumeSizeGib": 80,
"UserVolumeSizeGib": 10,
"ComputeTypeName": "PERFORMANCE"
},
"Tags": [
{
"Key": "",
"Value": ""
}
]
}
I keep getting the following error when I run the playbook
["", "Error parsing parameter '--cli-input-json': Invalid type: expecting map, received <class 'str'>"], "stdout": "", "stdout_lines": []}"
I cant figure out why.