{"action":"closed","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/11558","labels_url":"https://api.github.com/repos/ansible/ansible/issues/11558/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/11558/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/11558/events","html_url":"https://github.com/ansible/ansible/issues/11558","id":94470828,"number":11558,"title":"Add element to array for multiple array","user":{"login":"dazorni","id":1658380,"avatar_url":"https://avatars.githubusercontent.com/u/1658380?v=3","gravatar_id":"","url":"https://api.github.com/users/dazorni","html_url":"https://github.com/dazorni","followers_url":"https://api.github.com/users/dazorni/followers","following_url":"https://api.github.com/users/dazorni/following{/other_user}","gists_url":"https://api.github.com/users/dazorni/gists{/gist_id}","starred_url":"https://api.github.com/users/dazorni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dazorni/subscriptions","organizations_url":"https://api.github.com/users/dazorni/orgs","repos_url":"https://api.github.com/users/dazorni/repos","events_url":"https://api.github.com/users/dazorni/events{/privacy}","received_events_url":"https://api.github.com/users/dazorni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-11T12:54:39Z","updated_at":"2015-07-19T03:20:27Z","closed_at":"2015-07-19T03:20:27Z","body":"If tried to go over a multiple array and save a element only if the state ```skipped``` is not ```true``` or doesn't exist. I think code is easier to understand for all of us, so i made an example in php.\r\n\r\n``` php\r\n$result = [\r\n  'results' => [\r\n    [\r\n      'ssh_key' => [\r\n        'id' => 100001,\r\n        'name' =>'username'\r\n      ]\r\n    ],\r\n    [\r\n      'ssh_key' => [\r\n        'id' => 100002,\r\n        'name' =>'username'\r\n      ]\r\n    ],\r\n    [\r\n      'skipped' => true\r\n    ]\r\n  ]\r\n];\r\n\r\n$keyIds = [];\r\n\r\nforeach ($result['results'] as $item) {\r\n  if (! array_key_exists('skipped', $item) || $item['skipped'] != true)\r\n    $keyIds[] = $item['ssh_key']['id'];\r\n}\r\n\r\n// result\r\narray(1) {\r\n  [0] => int(100001),\r\n  [1] => int(100002)\r\n}\r\n\r\n```\r\n\r\nIs there a way to do exactly the same in ansible? I tried a lot!\r\n\r\nThanks for your help!"}}