Hello Team,
We are trying to automate Replica set installation/ configuration through Ansible using OpsManager public API’s. We have done automation agent installation in the respective servers and able to see those servers in project UI. Now we tried replica set initialization using the Ansible script.
Initiate automation.yaml:-
- name: Initiate Automation
hosts: om_hosts[0]
gather_facts: yes
vars:
project_projects: "{{ lookup('file', '/home/ec2-user/commercetools-iac-staging-env/ansible/project_projects.yaml') }}"
org_private_key: "{{ lookup('file', '/home/ec2-user/commercetools-iac-staging-env/ansible/org_private_key.yaml') }}"
org_public_key: "{{ lookup('file', '/home/ec2-user/commercetools-iac-staging-env/ansible/org_public_key.yaml') }}"
roles:
- automation
Roles/automation/tasks/main.yaml:-
- name: Ignore warnings raised for files with unknown extensions while loading (2.7)
include_vars:
dir: vars
ignore_unknown_extensions: True
extensions: ['yaml', 'yml', 'json']
- name: "Set OM Base URL"
set_fact:
om_base_url: "{{ om_url.0 }}/api/public/v1.0"
###### Run the below projects one at a time by commenting and uncommenting individual blocks below
- name: "Initiate Projects Automation"
uri:
url: "{{ om_base_url }}/groups/{{ project_projects }}/automationConfig?pretty=true"
validate_certs: no
method: PUT
headers:
Content-Type: "application/json"
body: "{{ lookup('file', 'vars/projects-rs.json') }}"
body_format: json
status_code: 200
# return_content: yes
user: "{{ org_public_key }}"
password: "{{ org_private_key }}"
projects-rs.json file attached.
The error is
TASK [automation : Initiate Projects Automation] ************************************************************************************
[WARNING]: Module did not set no_log for password
fatal: [ip-192-168-128-191.cn-northwest-1.compute.internal]: FAILED! => {“changed”: false, “connection”: “close”, “content_length”: “187”, “content_type”: “application/json”, “date”: “Mon, 27 Mar 2023 12:48:22 GMT”, “elapsed”: 0, “json”: {“detail”: “Invalid config: The Automation Auth Key may not be unset when processes exist.”, “error”: 400, “errorCode”: null, “parameters”: null, “reason”: “Bad Request”}, “msg”: “Status code was 400 and not [200]: HTTP Error 400: Bad Request”, “redirected”: false, “referrer_policy”: “strict-origin-when-cross-origin”, “status”: 400, “strict_transport_security”: “max-age=0; includeSubdomains;”, “url”: “https://staging-om.db.cn-northwest-1.aws..cn:8443/api/public/v1.0/groups/**********/automationConfig?pretty=true”, “x_content_type_options”: “nosniff”, “x_frame_options”: “DENY”, “x_mongodb_service_version”: “gitHash=f6da67b6680af73325f5a4198d48f673204d72a8; versionString=6.0.5.100.20221019T1059Z”, “x_permitted_cross_domain_policies”: “none”}
Can you please help us here what’s the issue? if you can . It’s really great if so
Thanks & regards
Venkata