Ansible. Get specific value from {{ item }} loop - linux

I'm trying to work with loops and item(s) and I can't get it to work... maybe you can help me.
So I want to print in a loop the "content" value of this output and I'm unable to do this. Do
- name: "Verify started instances"
uri:
url: "http://localhost:808{{ item[-1] }}/url"
method: GET
return_content: yes
register: status
until: "status is search('Version')"
retries: 3
delay: 60
ignore_errors: yes
with_items: "{{ instances_running.stdout_lines }}"
- debug:
msg: "{{ item }}"
with_items: "{{ status }}"
ignore_errors: yes
Output looks like that:
TASK [[AppServerAgent] verify started instances] **************************************************************************************************************************************
FAILED - RETRYING: [AppServerAgent] verify started instances (3 retries left).
FAILED - RETRYING: [AppServerAgent] verify started instances (2 retries left).
ok: [SERVER] => (item=inst0)
FAILED - RETRYING: [AppServerAgent] verify started instances (3 retries left).
FAILED - RETRYING: [AppServerAgent] verify started instances (2 retries left).
FAILED - RETRYING: [AppServerAgent] verify started instances (1 retries left).
failed: [SERVER] (item=instnull) => {"ansible_loop_var": "item", "attempts": 3, "changed": false, "item": "instnull", "msg": "invalid literal for int() with base 10: '808l'", "status": -1, "url": "http://localhost:808l/url"}
...ignoring
TASK [debug] **************************************************************************************************************************************************************************
ok: [SERVER] => {
"msg": {
"changed": false,
"failed": true,
"msg": "All items completed",
"results": [
{
"ansible_loop_var": "item",
"attempts": 3,
"changed": false,
"connection": "close",
"content": "Version: 2-SNAPSHOT\nBuild number: 1\nBuild id: 2020-11-325_09-03-20\n",
"content_length": "281",
"cookies": {},
"cookies_string": "",
"date": "",
"elapsed": 0,
"failed": false,
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"body": null,
"body_format": "raw",
"client_cert": null,
"client_key": null,
"content": null,
"creates": null,
"delimiter": null,
"dest": null,
"directory_mode": null,
"follow": false,
"follow_redirects": "safe",
"force": false,
"force_basic_auth": false,
"group": null,
"headers": {},
"http_agent": "ansible-httpget",
"method": "GET",
"mode": null,
"owner": null,
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": true,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
200
],
"timeout": 30,
"unix_socket": null,
"unsafe_writes": null,
"url": "http://localhost:8080/url",
"url_password": null,
"url_username": null,
"use_proxy": true,
"validate_certs": true
}
},
"item": "inst0",
"msg": "OK (281 bytes)",
"redirected": false,
"status": 200,
"url": "http://localhost:8080/url"
},
{
"ansible_loop_var": "item",
"attempts": 3,
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"body": null,
"body_format": "raw",
"client_cert": null,
"client_key": null,
"content": null,
"creates": null,
"delimiter": null,
"dest": null,
"directory_mode": null,
"follow": false,
"follow_redirects": "safe",
"force": false,
"force_basic_auth": false,
"group": null,
"headers": {},
"http_agent": "ansible-httpget",
"method": "GET",
"mode": null,
"owner": null,
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": true,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
200
],
"timeout": 30,
"unix_socket": null,
"unsafe_writes": null,
"url": "http://localhost:808l/url",
"url_password": null,
"url_username": null,
"use_proxy": true,
"validate_certs": true
}
},
"item": "instnull",
"msg": "invalid literal for int() with base 10: '808l'",
"status": -1,
"url": "http://localhost:808l/url"
}
]
}
}
I was trying to use something like this:
- debug:
msg: "{{ item.content.split('\n') }}"
with_items: "{{ status }}"
ignore_errors: yes
but then the output looks like that:
TASK [debug] **************************************************************************************************************************************************************************
fatal: [SERVER]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeBytes object' has no attribute 'content'\n\nThe error appears to be in '/deploy.yaml': line 176, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - debug:\n ^ here\n"}
How can I do this?
Or maybe there is also a way to use other command instead of until: "status is search('Version')" to find content field and print output in name block instead of debug task?
THanks!

Try "{{ status.results.content }}"

Related

#pnp/sp list request returns different objects on SharePoint Site view/edit mode

I use the #pnp/sp library to get list data in a SPFX web part.
The crucial code for my issue looks as follows:
const list = await sp.web.lists
.getByTitle("ListTitle")
.fields.getByTitle("Category")
.get();
return list.Choices.results;
When I open the SharePoint page, where the web part is located, in view mode, it loads the correct object:
{
"__metadata": {
"id": "...",
"uri": "...",
"type": "SP.FieldChoice"
},
"DescriptionResource": {
"__deferred": {
"uri": "..."
}
},
"TitleResource": {
"__deferred": {
"uri": "..."
}
},
"AutoIndexed": false,
"CanBeDeleted": true,
"ClientSideComponentId": "00000000-0000-0000-0000-000000000000",
"ClientSideComponentProperties": null,
"ClientValidationFormula": null,
"ClientValidationMessage": null,
"CustomFormatter": null,
"DefaultFormula": null,
"DefaultValue": "SocialEvent",
"Description": "",
"Direction": "none",
"EnforceUniqueValues": false,
"EntityPropertyName": "...",
"Filterable": true,
"FromBaseType": false,
"Group": "Benutzerdefinierte Spalten",
"Hidden": false,
"Id": "...",
"Indexed": false,
"IndexStatus": 0,
"InternalName": "...",
"IsModern": false,
"JSLink": "clienttemplates.js",
"PinnedToFiltersPane": false,
"ReadOnlyField": false,
"Required": true,
"SchemaXml": "<Field Type=\"Choice\" DisplayName=\"Category\" Required=\"TRUE\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" Format=\"Dropdown\" FillInChoice=\"FALSE\" ID=\"{...}\" SourceID=\"{{listid:...}}\" StaticName=\"...\" Name=\"...\" ColName=\"nvarchar4\" RowOrdinal=\"0\" CustomFormatter=\"\" Version=\"2\"><Default>SocialEvent</Default><CHOICES><CHOICE>SocialEvent</CHOICE><CHOICE>Schulung</CHOICE><CHOICE>Fachbesprechung</CHOICE><CHOICE>Messe</CHOICE></CHOICES></Field>",
"Scope": "/sites/.../Lists/...",
"Sealed": false,
"ShowInFiltersPane": 0,
"Sortable": true,
"StaticName": "...",
"Title": "Category",
"FieldTypeKind": 6,
"TypeAsString": "Choice",
"TypeDisplayName": "Auswahl",
"TypeShortDescription": "Auswahl (MenĂ¼)",
"ValidationFormula": null,
"ValidationMessage": null,
"FillInChoice": false,
"Mappings": null,
"Choices": {
"__metadata": {
"type": "Collection(Edm.String)"
},
"results": [
"SocialEvent",
"Schulung",
"Fachbesprechung",
"Messe"
]
},
"EditFormat": 0
}
But when I change the mode to edit, the same code gives me the following result (I shortened it, because the result is 10.000+ lines):
{
"user": {
"#odata.context": "...",
"#odata.type": "#SP.User",
"#odata.id": "...",
"#odata.editLink": "Web/GetUserById(17)",
"Id": 17,
"IsHiddenInUI": false,
"LoginName": "...",
"Title": "...",
"PrincipalType": 1,
"Email": "...",
"Expiration": "",
"IsEmailAuthenticationGuestUser": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": true,
"UserId": {
"NameId": "...",
"NameIdIssuer": "urn:federation:microsoftonline"
},
"UserPrincipalName": "..."
},
"item": {
"#odata.context": "...",
"#odata.type": "#SP.Data.SitePagesItem",
"#odata.id": "...",
"#odata.etag": "\"363\"",
"#odata.editLink": "...",
"FileSystemObjectType": 0,
"Id": 1,
"ContentTypeId": "...",
"OData__ModerationComments": null,
"ComplianceAssetId": null,
"Title": "Homepage",
"PageLayoutType": "Home",
"BannerImageUrl": {
"Description": "...",
"Url": "..."
},
"Description": "...",
"PromotedState": 0,
"FirstPublishedDate": null,
"LayoutWebpartsContent": null,
"OData__AuthorBylineId": null,
"OData__TopicHeader": null,
"OData__SPSitePageFlags": null,
"OData__SPCallToAction": null,
"OData__OriginalSourceUrl": null,
"OData__OriginalSourceSiteId": null,
"OData__OriginalSourceWebId": null,
"OData__OriginalSourceListId": null,
"OData__OriginalSourceItemId": null,
"ID": 1,
"Created": "2022-07-30T16:11:23-07:00",
"AuthorId": 0,
"Modified": "2022-09-28T00:45:46-07:00",
"EditorId": 0,
"OData__ModerationStatus": 3,
"CheckoutUserId": 0,
"UniqueId": "...",
"owshiddenversion": 363,
"OData__UIVersionString": "41.5",
"GUID": "..."
},
"itemProperties": {}
...
}
The following versions are installed:
"#pnp/common": "1.3.9",
"#pnp/logging": "1.3.9",
"#pnp/odata": "1.3.9",
"#pnp/sp": "1.3.9",
Update:
I installed the web part in different site collections within the tenant, which resulted in the same error. Now I have installed the web part in another tenant, where the problem don't occur. Unfortunately, I still cannot determine where the error is.

I am trying to get Values from JSON in Node.JS

I am trying to get values from a json in node.
Here is the code:
https.get('https://www.reddit.com/r/cute/random.json', (resp) => {
let data = '';
resp.on('data', (chunk) => {
data += chunk;
});
const obj = JSON.parse(data);
resp.on('end', () => {
console.log(obj.url);
});
}).on("error", (err) => {
console.log("Error: " + err.message);
});
First I get the json file from Reddit, then the code should parse the data, get the url value and print.
Here is a response from reddit:
[{"kind": "Listing", "data": {"modhash": "k08cakl21qf62e475cdf685ff8f62982c15997278420b30b86", "dist": 1, "children": [{"kind": "t3", "data": {"approved_at_utc": null, "subreddit": "cute", "selftext": "", "user_reports": [], "saved": false, "mod_reason_title": null, "gilded": 0, "clicked": false, "title": "Took this picture at my local zoo", "link_flair_richtext": [], "subreddit_name_prefixed": "r/cute", "hidden": false, "pwls": 6, "link_flair_css_class": null, "downs": 0, "thumbnail_height": 140, "top_awarded_type": null, "parent_whitelist_status": "all_ads", "hide_score": false, "name": "t3_np1ulg", "quarantine": false, "link_flair_text_color": "dark", "upvote_ratio": 1.0, "author_flair_background_color": null, "subreddit_type": "public", "ups": 13, "total_awards_received": 0, "media_embed": {}, "thumbnail_width": 140, "author_flair_template_id": null, "is_original_content": false, "author_fullname": "t2_6oq8e4ri", "secure_media": null, "is_reddit_media_domain": true, "is_meta": false, "category": null, "secure_media_embed": {}, "link_flair_text": null, "can_mod_post": false, "score": 13, "approved_by": null, "is_created_from_ads_ui": false, "author_premium": false, "thumbnail": "https://b.thumbs.redditmedia.com/rcVqy9jgOCmApJ36YpAN9CCDQ2lRC0hSsAqBpt0zBxw.jpg", "edited": false, "author_flair_css_class": null, "author_flair_richtext": [], "gildings": {}, "post_hint": "image", "content_categories": null, "is_self": false, "mod_note": null, "created": 1622491454.0, "link_flair_type": "text", "wls": 6, "removed_by_category": null, "banned_by": null, "author_flair_type": "text", "domain": "i.redd.it", "allow_live_comments": false, "selftext_html": null, "likes": null, "suggested_sort": null, "banned_at_utc": null, "url_overridden_by_dest": "https://i.redd.it/h9b00p6y4g271.jpg", "view_count": null, "archived": false, "no_follow": false, "is_crosspostable": true, "pinned": false, "over_18": false, "preview": {"images": [{"source": {"url": "https://preview.redd.it/h9b00p6y4g271.jpg?auto=webp&s=9962d8aa05efc905e39b67bff7a3385576ef4267", "width": 2448, "height": 3264}, "resolutions": [{"url": "https://preview.redd.it/h9b00p6y4g271.jpg?width=108&crop=smart&auto=webp&s=a30f747ccc3a51648498dbe90ffc92f114f438e5", "width": 108, "height": 144}, {"url": "https://preview.redd.it/h9b00p6y4g271.jpg?width=216&crop=smart&auto=webp&s=4bade02391aff8db706eeb74c3354aace0195048", "width": 216, "height": 288}, {"url": "https://preview.redd.it/h9b00p6y4g271.jpg?width=320&crop=smart&auto=webp&s=76bec250dec57f8ee75c379188c2d209eaa21646", "width": 320, "height": 426}, {"url": "https://preview.redd.it/h9b00p6y4g271.jpg?width=640&crop=smart&auto=webp&s=520ab610461f06a6d64f3a183ef25e33cdee4625", "width": 640, "height": 853}, {"url": "https://preview.redd.it/h9b00p6y4g271.jpg?width=960&crop=smart&auto=webp&s=961c512920a728777b9b13185d53f9afe4f6aaea", "width": 960, "height": 1280}, {"url": "https://preview.redd.it/h9b00p6y4g271.jpg?width=1080&crop=smart&auto=webp&s=6f943fbd5d53b892dd15b28052f12c929e5887b9", "width": 1080, "height": 1440}], "variants": {}, "id": "W08V856IQ3icquk8jx2Q0UiWHZnlDFcsSY7Cdu8J-S4"}], "enabled": true}, "all_awardings": [], "awarders": [], "media_only": false, "can_gild": true, "spoiler": false, "locked": false, "author_flair_text": null, "treatment_tags": [], "visited": false, "removed_by": null, "num_reports": null, "distinguished": null, "subreddit_id": "t5_2qh5l", "mod_reason_by": null, "removal_reason": null, "link_flair_background_color": "", "id": "np1ulg", "is_robot_indexable": true, "num_duplicates": 0, "report_reasons": null, "author": "ForMotherRussia3", "discussion_type": null, "num_comments": 1, "send_replies": true, "media": null, "contest_mode": false, "author_patreon_flair": false, "author_flair_text_color": null, "permalink": "/r/cute/comments/np1ulg/took_this_picture_at_my_local_zoo/", "whitelist_status": "all_ads", "stickied": false, "url": "https://i.redd.it/h9b00p6y4g271.jpg", "subreddit_subscribers": 96358, "created_utc": 1622462654.0, "num_crossposts": 0, "mod_reports": [], "is_video": false}}], "after": null, "before": null}}, {"kind": "Listing", "data": {"modhash": "k08cakl21qf62e475cdf685ff8f62982c15997278420b30b86", "dist": null, "children": [{"kind": "t1", "data": {"total_awards_received": 0, "approved_at_utc": null, "comment_type": null, "awarders": [], "mod_reason_by": null, "banned_by": null, "ups": 1, "author_flair_type": "text", "removal_reason": null, "link_id": "t3_np1ulg", "author_flair_template_id": null, "likes": null, "replies": "", "user_reports": [], "saved": false, "id": "h02og3g", "banned_at_utc": null, "mod_reason_title": null, "gilded": 0, "archived": false, "no_follow": true, "author": "AutoModerator", "can_mod_post": false, "send_replies": false, "parent_id": "t3_np1ulg", "score": 1, "author_fullname": "t2_6l4z3", "report_reasons": null, "approved_by": null, "all_awardings": [], "subreddit_id": "t5_2qh5l", "body": "This is the perfect post for r/cute!\n\n*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/cute) if you have any questions or concerns.*", "edited": false, "downs": 0, "author_flair_css_class": null, "is_submitter": false, "collapsed": false, "author_flair_richtext": [], "author_patreon_flair": false, "body_html": "<div class=\"md\"><p>This is the perfect post for <a href=\"/r/cute\">r/cute</a>!</p>\n\n<p><em>I am a bot, and this action was performed automatically. Please <a href=\"/message/compose/?to=/r/cute\">contact the moderators of this subreddit</a> if you have any questions or concerns.</em></p>\n</div>", "gildings": {}, "collapsed_reason": null, "associated_award": null, "stickied": false, "author_premium": true, "subreddit_type": "public", "can_gild": true, "top_awarded_type": null, "author_flair_text_color": null, "score_hidden": false, "permalink": "/r/cute/comments/np1ulg/took_this_picture_at_my_local_zoo/h02og3g/", "num_reports": null, "locked": false, "name": "t1_h02og3g", "created": 1622491455.0, "subreddit": "cute", "author_flair_text": null, "treatment_tags": [], "created_utc": 1622462655.0, "subreddit_name_prefixed": "r/cute", "controversiality": 0, "depth": 0, "author_flair_background_color": null, "collapsed_because_crowd_control": null, "mod_reports": [], "mod_note": null, "distinguished": "moderator"}}], "after": null, "before": null}}]
When I run the code (Includes are present but not shown in the code snippet I have imported https) I get this error:
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at ClientRequest.<anonymous> (C:\Users\cameron\Desktop\cjp\bot.js:22:20)
at Object.onceWrapper (node:events:485:26)
at ClientRequest.emit (node:events:378:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:636:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:129:17)
at TLSSocket.socketOnData (node:_http_client:502:22)
at TLSSocket.emit (node:events:378:20)
at addChunk (node:internal/streams/readable:313:12)
at readableAddChunk (node:internal/streams/readable:288:9)
Thanks in advance for any help!
Updated code here:
const fetch = require("node-fetch");
const main = async () => {
const json = await fetch("https://www.reddit.com/r/cute/random.json").then(
res => res.json()
);
console.log(
json
.map(entry => entry.data.children.map(child => child.data.url))
.flat()
.filter(Boolean)
);
};
main();
I am iterating it through the data and getting the output of the listing, I guess only one URL gets populated of k3 kind. So you get this as an output here:
Run #1
[ 'https://i.redd.it/pjom447yp8271.jpg' ]
Run #2
[ 'https://i.redd.it/h9b00p6y4g271.jpg' ]
Run #3
[ 'https://v.redd.it/lcejh8z6zp271' ]
Previous Answer for your reference:
In simple way, you can use something like node-fetch:
const fetch = require("node-fetch");
const main = async () => {
const json = await fetch("https://www.reddit.com/r/cute/random.json").then(
res => res.json()
);
console.log(json);
};
main();
You'll get the contents in the console.log(). When I run it with Node JS, I get the output so.js:
$ node so
[
{
kind: 'Listing',
data: {
modhash: '',
dist: 1,
children: [Array],
after: null,
before: null
}
},
{
kind: 'Listing',
data: {
modhash: '',
dist: null,
children: [Array],
after: null,
before: null
}
}
]

How do one should set a custom agent pool in DevOps release definition?

I create release definitions using DevOps REST APIs. Due to lack of documentation I used to capture HTTP requests and examine JSON payload.
I'm able to set a release using Azure agent pools. It follows only the relevant node:
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": 0
},
"agentSpecification": {
"identifier": "windows-2019"
},
"skipArtifactsDownload": false,
"artifactsDownloadInput": {},
"queueId": 749,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {},
"dependencies": []
}
I want to set a custom defined agent pool, but if I try to capture the request I still can't undertand how to set it. This is the full JSON of an empty release with custom agent set:
{
"id": 0,
"name": "New release pipeline",
"source": 2,
"comment": "",
"createdOn": "2020-10-31T10:02:19.034Z",
"createdBy": null,
"modifiedBy": null,
"modifiedOn": "2020-10-31T10:02:19.034Z",
"environments": [
{
"id": -1,
"name": "Stage 1",
"rank": 1,
"variables": {},
"variableGroups": [],
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 0
}
],
"approvalOptions": {
"executionOrder": 1
}
},
"deployStep": {
"tasks": [],
"id": 0
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 0
}
],
"approvalOptions": {
"executionOrder": 2
}
},
"deployPhases": [
{
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": 0
},
"agentSpecification": null,
"skipArtifactsDownload": false,
"artifactsDownloadInput": {},
"queueId": 1039,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {},
"dependencies": []
},
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"workflowTasks": [],
"phaseInputs": {
"phaseinput_artifactdownloadinput": {
"artifactsDownloadInput": {},
"skipArtifactsDownload": false
}
}
}
],
"runOptions": {},
"environmentOptions": {
"emailNotificationType": "OnlyOnFailure",
"emailRecipients": "release.environment.owner;release.creator",
"skipArtifactsDownload": false,
"timeoutInMinutes": 0,
"enableAccessToken": false,
"publishDeploymentStatus": true,
"badgeEnabled": false,
"autoLinkWorkItems": false,
"pullRequestDeploymentEnabled": false
},
"demands": [],
"conditions": [
{
"conditionType": 1,
"name": "ReleaseStarted",
"value": ""
}
],
"executionPolicy": {
"concurrencyCount": 1,
"queueDepthCount": 0
},
"schedules": [],
"properties": {
"LinkBoardsWorkItems": false,
"BoardsEnvironmentType": "unmapped"
},
"preDeploymentGates": {
"id": 0,
"gatesOptions": null,
"gates": []
},
"postDeploymentGates": {
"id": 0,
"gatesOptions": null,
"gates": []
},
"environmentTriggers": [],
"owner": {
"displayName": "Giacomo Stelluti Scala",
"id": "3617734a-1751-66f2-8343-c71c1398b5e6",
"isAadIdentity": true,
"isContainer": false,
"uniqueName": "giacomo.stelluti#dev4side.com",
"url": "https://dev.azure.com/dev4side/"
},
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"processParameters": {}
}
],
"artifacts": [],
"variables": {},
"variableGroups": [],
"triggers": [],
"lastRelease": null,
"tags": [],
"path": "\\test-poc",
"properties": {
"DefinitionCreationSource": "ReleaseNew",
"IntegrateJiraWorkItems": "false",
"IntegrateBoardsWorkItems": false
},
"releaseNameFormat": "Release-$(rev:r)",
"description": ""
}
Where do this is agent is set? Anyone knows how to do it properly?
Any help really appreciated.
Giacomo S. S.
I've found the solution in this question.
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": 0
},
"agentSpecification": null,
"skipArtifactsDownload": false,
"artifactsDownloadInput": {},
"queueId": 1039,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {},
"dependencies": []
}
agentSpecification must be null and queueId must be set.

Elasticsearch installation with xpack fails

I am installing Elasticsearch 6.6 with Xpack and it is failing on "nativeUser" issue:
failed: [elasticsearch1] (item=nativeUser) => {
"changed": false,
"content": "",
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"body": "{\"password\": \"<****>\", \"roles\": [\"power_user\", \"user\"]}",
"body_format": "json",
"client_cert": "",
"client_key": "",
"content": null,
"creates": null,
"delimiter": null,
"dest": null,
"directory_mode": null,
"follow": false,
"follow_redirects": "safe",
"force": false,
"force_basic_auth": true,
"group": null,
"headers": {
"Content-Type": "application/json"
},
"http_agent": "ansible-httpget",
"method": "POST",
"mode": null,
"owner": null,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
"200"
],
"timeout": 30,
"unsafe_writes": null,
"url": "https://<hostname1>:9201/_xpack/security/user/nativeUser",
"url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"url_username": "es_admin",
"use_proxy": true,
"user": "es_admin",
"validate_certs": false
}
},
"item": "nativeUser",
"msg": "Status code was -1 and not [200]: Connection failure: ('The read operation timed out',)",
"redirected": false,
"status": -1,
"url": "https://<hostname1>:9201/_xpack/security/user/nativeUser"
}
I do not understand what is "nativeUser" and how this error can be fixed?
I ran the url with curl and got the following error:
curl -u es_admin:changeMe -X POST "https://illin7040:9201/_xpack/security/user/nativeUser?pretty" -H 'Content-Type: application/json' -d' { "password" : "changeMe", "roles" : [ "admin", "power_user", "user" ], "full_name" : "nativeUser", "email" : null, "metadata" : {"reserved":true},"enabled":true}}' -k
{
"error" : {
"root_cause" : [
{
"type" : "master_not_discovered_exception",
"reason" : null
}
],
"type" : "master_not_discovered_exception",
"reason" : null
},
"status" : 503
}
All the three nodes in my env are configured as master..
I am new to Ansible and Elasticsearch, any advice would be appreciated. Thanks.

ansible-collections/azure aks Bad Request'. Details: Must define at least one system pool

I am using ansible-collections/azure and I got this error: basically I need to define at least one system pool. But there is no example for it and it gives error for every tries which I did.
20-04-01 API is version which I used for this automation.
I follow this links.
https://learn.microsoft.com/en-us/azure/templates/microsoft.containerservice/managedclusters
https://github.com/ansible-collections/azure
If anybody can help me that would be great!
The full traceback is:
File "/tmp/ansible_azure.azcollection.azure_rm_aks_payload_6b2sjfcj/ansible_azure.azcollection.azure_rm_aks_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_aks.py", line 791, in create_update_aks
File "/usr/local/lib/python3.5/dist-packages/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py", line 670, in create_or_update
**operation_config
File "/usr/local/lib/python3.5/dist-packages/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py", line 621, in _create_or_update_initial
raise exp
[WARNING]: Azure API profile latest does not define an entry for ContainerServiceClient
fatal: [127.0.0.1]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"aad_profile": null,
"ad_user": null,
"addon": null,
"adfs_authority_url": null,
"agent_pool_profiles": [
{
"count": 2,
"dns_prefix": null,
"enable_auto_scaling": null,
"max_count": null,
"min_count": null,
"name": "default",
"os_disk_size_gb": null,
"os_type": null,
"ports": null,
"storage_profiles": null,
"type": "VirtualMachineScaleSets",
"vm_size": "Standard_D2_v2",
"vnet_subnet_id": null
}
],
"api_profile": "latest",
"append_tags": true,
"auth_source": null,
"cert_validation_mode": null,
"client_id": null,
"cloud_environment": "AzureCloud",
"dns_prefix": "myaks1",
"enable_rbac": true,
"kubernetes_version": "1.16.9",
"linux_profile": {
"admin_username": "azureuser",
"ssh_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
},
"location": "uksouth",
"name": "myaks",
"network_profile": null,
"node_resource_group": "nodetest",
"password": null,
"profile": null,
"resource_group": "mytest",
"secret": null,
"service_principal": {
"client_id": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"client_secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
},
"state": "present",
"subscription_id": null,
"tags": {
"Environment": "Production"
},
"tenant": null
}
},
"msg": "Error creating the AKS instance: Operation failed with status: 'Bad Request'. Details: Must define at least one system pool."
}
This version of the API version requires an agentPoolMode to be provided.
AgentPoolMode
AgentPoolMode represents mode of an agent pool.
Name Type Description
System string
User string
https://learn.microsoft.com/en-us/rest/api/aks/agentpools/get
AKS requires a minimum of one system agent node pool
it fixed by new pull request, I tested in my local.
https://github.com/ansible-collections/azure/pull/170

Resources