{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/60449","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/60449/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/60449/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/60449/events","html_url":"https://github.com/ansible/ansible/issues/60449","id":479914932,"node_id":"MDU6SXNzdWU0Nzk5MTQ5MzI=","number":60449,"title":"RFE: os_object support deleting container and all files","user":{"login":"jhg03a","id":4870549,"node_id":"MDQ6VXNlcjQ4NzA1NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/4870549?v=4","gravatar_id":"","url":"https://api.github.com/users/jhg03a","html_url":"https://github.com/jhg03a","followers_url":"https://api.github.com/users/jhg03a/followers","following_url":"https://api.github.com/users/jhg03a/following{/other_user}","gists_url":"https://api.github.com/users/jhg03a/gists{/gist_id}","starred_url":"https://api.github.com/users/jhg03a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhg03a/subscriptions","organizations_url":"https://api.github.com/users/jhg03a/orgs","repos_url":"https://api.github.com/users/jhg03a/repos","events_url":"https://api.github.com/users/jhg03a/events{/privacy}","received_events_url":"https://api.github.com/users/jhg03a/received_events","type":"User","site_admin":false},"labels":[{"id":1316917295,"node_id":"MDU6TGFiZWwxMzE2OTE3Mjk1","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.9","name":"affects_2.9","color":"ededed","default":false},{"id":61528803,"node_id":"MDU6TGFiZWw2MTUyODgwMw==","url":"https://api.github.com/repos/ansible/ansible/labels/cloud","name":"cloud","color":"4071a5","default":false},{"id":852590921,"node_id":"MDU6TGFiZWw4NTI1OTA5MjE=","url":"https://api.github.com/repos/ansible/ansible/labels/feature","name":"feature","color":"006b75","default":false},{"id":496359346,"node_id":"MDU6TGFiZWw0OTYzNTkzNDY=","url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":503572087,"node_id":"MDU6TGFiZWw1MDM1NzIwODc=","url":"https://api.github.com/repos/ansible/ansible/labels/needs_triage","name":"needs_triage","color":"0e8a16","default":false},{"id":379682897,"node_id":"MDU6TGFiZWwzNzk2ODI4OTc=","url":"https://api.github.com/repos/ansible/ansible/labels/openstack","name":"openstack","color":"c5def5","default":false},{"id":636327968,"node_id":"MDU6TGFiZWw2MzYzMjc5Njg=","url":"https://api.github.com/repos/ansible/ansible/labels/support:community","name":"support:community","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-08-13T01:12:39Z","updated_at":"2019-08-13T01:26:52Z","closed_at":null,"author_association":"NONE","body":"<!--- Verify first that your feature was not already discussed on GitHub -->\r\n<!--- Complete *all* sections as described, this form is processed automatically -->\r\n\r\n##### SUMMARY\r\n<!--- Describe the new feature/improvement briefly below -->\r\nAs a os_object module user I'd like to be able to delete a container and all its contents.  \r\n\r\n##### ISSUE TYPE\r\n- Feature Idea\r\n\r\n##### COMPONENT NAME\r\n<!--- Write the short name of the module, plugin, task or feature below, use your best guess if unsure -->\r\nos_object\r\n\r\n##### ADDITIONAL INFORMATION\r\n<!--- Describe how the feature would be used, why it is needed and what it would solve -->\r\nToday if you try to delete a container that still has any files in it, you receive the message: `The container is not empty. Please delete the objects inside it before deleting the container`.  On the openstack CLI, normally you would pass in the `--recursive` option to delete the container and all its contents.  Alternatively, the os_object module could support a means to list all container contents in an order that could be passed to an ansible `loop` invocation of os_object prior to deleting the container itself.  The latter solution, while more complicated to get in the right order, is more powerful as it allows users to retrieve the contents of a swift container.\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n- name: Destroy the Openstack Swift Container and its contents\r\n  os_object:\r\n    auth:\r\n      auth_url: \"{{ tf_swift_auth_url }}\"\r\n      tenant_name: \"{{ tf_swift_tenant_name }}\"\r\n      domain_name: \"{{ tf_swift_domain_name }}\"\r\n      tenant_id: \"{{ tf_swift_tenant_id }}\"\r\n    region_name: \"{{ tf_swift_region_name }}\"\r\n    container: \"{{ tf_swift_container_name }}\"\r\n    state: absent\r\n    recursive: true\r\n\r\n# OR\r\n\r\n- name: Get the Openstack Swift Container contents\r\n  os_object:\r\n    auth:\r\n      auth_url: \"{{ tf_swift_auth_url }}\"\r\n      tenant_name: \"{{ tf_swift_tenant_name }}\"\r\n      domain_name: \"{{ tf_swift_domain_name }}\"\r\n      tenant_id: \"{{ tf_swift_tenant_id }}\"\r\n    region_name: \"{{ tf_swift_region_name }}\"\r\n    container: \"{{ tf_swift_container_name }}\"\r\n    state: list\r\n  register: container_contents\r\n\r\n- name: Destroy the contents of the Openstack Swift Container\r\n  os_object:\r\n    auth:\r\n      auth_url: \"{{ tf_swift_auth_url }}\"\r\n      tenant_name: \"{{ tf_swift_tenant_name }}\"\r\n      domain_name: \"{{ tf_swift_domain_name }}\"\r\n      tenant_id: \"{{ tf_swift_tenant_id }}\"\r\n    region_name: \"{{ tf_swift_region_name }}\"\r\n    container: \"{{ tf_swift_container_name }}\"\r\n    state: absent\r\n    filename: \"{{ item }}\"\r\n  with_items: \"{{ container_contents }}\"\r\n\r\n- name: Destroy the Openstack Swift Container\r\n  os_object:\r\n    auth:\r\n      auth_url: \"{{ tf_swift_auth_url }}\"\r\n      tenant_name: \"{{ tf_swift_tenant_name }}\"\r\n      domain_name: \"{{ tf_swift_domain_name }}\"\r\n      tenant_id: \"{{ tf_swift_tenant_id }}\"\r\n    region_name: \"{{ tf_swift_region_name }}\"\r\n    container: \"{{ tf_swift_container_name }}\"\r\n    state: absent\r\n```\r\n\r\n<!--- HINT: You can also paste gist.github.com links for larger files -->\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/520653063","html_url":"https://github.com/ansible/ansible/issues/60449#issuecomment-520653063","issue_url":"https://api.github.com/repos/ansible/ansible/issues/60449","id":520653063,"node_id":"MDEyOklzc3VlQ29tbWVudDUyMDY1MzA2Mw==","user":{"login":"ansibot","id":6585283,"node_id":"MDQ6VXNlcjY1ODUyODM=","avatar_url":"https://avatars0.githubusercontent.com/u/6585283?v=4","gravatar_id":"","url":"https://api.github.com/users/ansibot","html_url":"https://github.com/ansibot","followers_url":"https://api.github.com/users/ansibot/followers","following_url":"https://api.github.com/users/ansibot/following{/other_user}","gists_url":"https://api.github.com/users/ansibot/gists{/gist_id}","starred_url":"https://api.github.com/users/ansibot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansibot/subscriptions","organizations_url":"https://api.github.com/users/ansibot/orgs","repos_url":"https://api.github.com/users/ansibot/repos","events_url":"https://api.github.com/users/ansibot/events{/privacy}","received_events_url":"https://api.github.com/users/ansibot/received_events","type":"User","site_admin":false},"created_at":"2019-08-13T01:26:52Z","updated_at":"2019-08-13T01:26:52Z","author_association":"CONTRIBUTOR","body":"cc @Shrews @cloudnull @dagnello @emonty @gtema @juliakreger @mnaser @odyssey4me @rcarrillocruz\n[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)\n<!--- boilerplate: notify --->"}}
{"actor":{"display_login":"ansibot"}}