{"action":"created","comment":{"url":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/comments/199887188","pull_request_review_id":134094306,"id":199887188,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTg4NzE4OA==","diff_hunk":"@@ -0,0 +1,135 @@\n+#!/usr/bin/python\n+\n+DOCUMENTATION = '''\n+---\n+module: find_unused_disk_module\n+short_description: Gets unused disks\n+description:\n+    - Disks are considered in ascending alphanumeric sorted order.\n+    - Disks that meet all conditions are considered 'empty' and returned (using kernel device name) in a list.\n+        - 1. No known signatures exist on the disk, with the exception of partition tables.\n+        - 2. If there is a partition table on the disk, it contains no partitions.\n+        - 3. The disk has no holders to eliminate the possibility of it being a multipath or dmraid member device.\n+        - 4. Device can be opened with exclusive access to make sure no other software is using it.\n+    - If no disks meet all criteria, \"Unable to find unused disk\" will be returned.\n+    - Number of returned disks defaults to first 10, but can be specified with 'max_return' argument.\n+author: Eda Zhou (@edamamez)\n+options:\n+    option-name: max_return\n+    description: Sets the maximum number of unused disks to return.\n+    default: 10\n+    type: int\n+'''\n+\n+EXAMPLES = '''\n+- name: test finding first unused device module\n+  hosts: localhost\n+  tasks:\n+    - name: run module\n+      find_unused_disk_module:\n+      register: testout\n+    - name: dump test output\n+      debug:\n+        msg: '{{ testout }}'\n+'''\n+\n+RETURN = '''\n+disk_name:\n+    description: Information about unused disks\n+    returned: On success\n+    type: complex\n+    contains:\n+        disks:\n+            description: Unused disk(s) that have been found\n+            returned: On success\n+            type: list\n+            samples: [\"/dev/sda1\", \"/dev/dm-0\", \"/dev/dm-3\"]\n+                     [\"/dev/sda\"]\n+        none:\n+            description: No unused disks were found\n+            returned: On success\n+            type: string\n+            sample: \"Unable to find unused disk\"\n+'''\n+\n+\n+import os\n+\n+from ansible.module_utils.basic import AnsibleModule\n+from ansible.module_utils import facts\n+\n+\n+def get_disks(run_command):\n+    \"\"\"Return list of devices on the system\"\"\"\n+    all_disks = run_command(['lsblk', '-o', 'kname', '-l', '-n', '-p'])","path":"library/find_unused_disk_module.py","position":64,"original_position":64,"commit_id":"7e98a7500b90fa8ac4e67e142d1a400bed478d3f","original_commit_id":"18eca5c14de51db9eff099bee1029de240bbf823","user":{"login":"dwlehman","id":6605451,"node_id":"MDQ6VXNlcjY2MDU0NTE=","avatar_url":"https://avatars3.githubusercontent.com/u/6605451?v=4","gravatar_id":"","url":"https://api.github.com/users/dwlehman","html_url":"https://github.com/dwlehman","followers_url":"https://api.github.com/users/dwlehman/followers","following_url":"https://api.github.com/users/dwlehman/following{/other_user}","gists_url":"https://api.github.com/users/dwlehman/gists{/gist_id}","starred_url":"https://api.github.com/users/dwlehman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwlehman/subscriptions","organizations_url":"https://api.github.com/users/dwlehman/orgs","repos_url":"https://api.github.com/users/dwlehman/repos","events_url":"https://api.github.com/users/dwlehman/events{/privacy}","received_events_url":"https://api.github.com/users/dwlehman/received_events","type":"User","site_admin":false},"body":"It is safe to assume that they will all be in /dev. The ansible facts get the list of devices by looking at /sys/block, which lists \"kernel\" devices (always in /dev) --  see [1].\r\n\r\n\r\n[1] https://github.com/ansible/ansible/blob/0691c9c099d56929321412df1f5842423a2dfdc0/lib/ansible/module_utils/facts/hardware/linux.py#L548","created_at":"2018-07-03T17:16:23Z","updated_at":"2018-07-03T17:16:23Z","html_url":"https://github.com/dwlehman/linux-storage-role/pull/5#discussion_r199887188","pull_request_url":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/5","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/comments/199887188"},"html":{"href":"https://github.com/dwlehman/linux-storage-role/pull/5#discussion_r199887188"},"pull_request":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/5"}},"in_reply_to_id":199586406},"pull_request":{"url":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/5","id":196487812,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2NDg3ODEy","html_url":"https://github.com/dwlehman/linux-storage-role/pull/5","diff_url":"https://github.com/dwlehman/linux-storage-role/pull/5.diff","patch_url":"https://github.com/dwlehman/linux-storage-role/pull/5.patch","issue_url":"https://api.github.com/repos/dwlehman/linux-storage-role/issues/5","number":5,"state":"open","locked":false,"title":"Add find unused disk module and its unit tests","user":{"login":"edamamez","id":36808054,"node_id":"MDQ6VXNlcjM2ODA4MDU0","avatar_url":"https://avatars1.githubusercontent.com/u/36808054?v=4","gravatar_id":"","url":"https://api.github.com/users/edamamez","html_url":"https://github.com/edamamez","followers_url":"https://api.github.com/users/edamamez/followers","following_url":"https://api.github.com/users/edamamez/following{/other_user}","gists_url":"https://api.github.com/users/edamamez/gists{/gist_id}","starred_url":"https://api.github.com/users/edamamez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edamamez/subscriptions","organizations_url":"https://api.github.com/users/edamamez/orgs","repos_url":"https://api.github.com/users/edamamez/repos","events_url":"https://api.github.com/users/edamamez/events{/privacy}","received_events_url":"https://api.github.com/users/edamamez/received_events","type":"User","site_admin":false},"body":"See for in depth description: https://gist.github.com/dwlehman/eceec2fb443408080b70d4fe2ea70459","created_at":"2018-06-21T15:16:56Z","updated_at":"2018-07-03T17:16:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ada640848d8de33e5dba28ae7a7918962c224817","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/5/commits","review_comments_url":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/5/comments","review_comment_url":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dwlehman/linux-storage-role/issues/5/comments","statuses_url":"https://api.github.com/repos/dwlehman/linux-storage-role/statuses/7e98a7500b90fa8ac4e67e142d1a400bed478d3f","head":{"label":"edamamez:eda_edits","ref":"eda_edits","sha":"7e98a7500b90fa8ac4e67e142d1a400bed478d3f","user":{"login":"edamamez","id":36808054,"node_id":"MDQ6VXNlcjM2ODA4MDU0","avatar_url":"https://avatars1.githubusercontent.com/u/36808054?v=4","gravatar_id":"","url":"https://api.github.com/users/edamamez","html_url":"https://github.com/edamamez","followers_url":"https://api.github.com/users/edamamez/followers","following_url":"https://api.github.com/users/edamamez/following{/other_user}","gists_url":"https://api.github.com/users/edamamez/gists{/gist_id}","starred_url":"https://api.github.com/users/edamamez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edamamez/subscriptions","organizations_url":"https://api.github.com/users/edamamez/orgs","repos_url":"https://api.github.com/users/edamamez/repos","events_url":"https://api.github.com/users/edamamez/events{/privacy}","received_events_url":"https://api.github.com/users/edamamez/received_events","type":"User","site_admin":false},"repo":{"id":138186204,"node_id":"MDEwOlJlcG9zaXRvcnkxMzgxODYyMDQ=","name":"linux-storage-role","full_name":"edamamez/linux-storage-role","owner":{"login":"edamamez","id":36808054,"node_id":"MDQ6VXNlcjM2ODA4MDU0","avatar_url":"https://avatars1.githubusercontent.com/u/36808054?v=4","gravatar_id":"","url":"https://api.github.com/users/edamamez","html_url":"https://github.com/edamamez","followers_url":"https://api.github.com/users/edamamez/followers","following_url":"https://api.github.com/users/edamamez/following{/other_user}","gists_url":"https://api.github.com/users/edamamez/gists{/gist_id}","starred_url":"https://api.github.com/users/edamamez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edamamez/subscriptions","organizations_url":"https://api.github.com/users/edamamez/orgs","repos_url":"https://api.github.com/users/edamamez/repos","events_url":"https://api.github.com/users/edamamez/events{/privacy}","received_events_url":"https://api.github.com/users/edamamez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edamamez/linux-storage-role","description":"Ansible Role for Storage Configuration on Linux","fork":true,"url":"https://api.github.com/repos/edamamez/linux-storage-role","forks_url":"https://api.github.com/repos/edamamez/linux-storage-role/forks","keys_url":"https://api.github.com/repos/edamamez/linux-storage-role/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edamamez/linux-storage-role/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edamamez/linux-storage-role/teams","hooks_url":"https://api.github.com/repos/edamamez/linux-storage-role/hooks","issue_events_url":"https://api.github.com/repos/edamamez/linux-storage-role/issues/events{/number}","events_url":"https://api.github.com/repos/edamamez/linux-storage-role/events","assignees_url":"https://api.github.com/repos/edamamez/linux-storage-role/assignees{/user}","branches_url":"https://api.github.com/repos/edamamez/linux-storage-role/branches{/branch}","tags_url":"https://api.github.com/repos/edamamez/linux-storage-role/tags","blobs_url":"https://api.github.com/repos/edamamez/linux-storage-role/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edamamez/linux-storage-role/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edamamez/linux-storage-role/git/refs{/sha}","trees_url":"https://api.github.com/repos/edamamez/linux-storage-role/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edamamez/linux-storage-role/statuses/{sha}","languages_url":"https://api.github.com/repos/edamamez/linux-storage-role/languages","stargazers_url":"https://api.github.com/repos/edamamez/linux-storage-role/stargazers","contributors_url":"https://api.github.com/repos/edamamez/linux-storage-role/contributors","subscribers_url":"https://api.github.com/repos/edamamez/linux-storage-role/subscribers","subscription_url":"https://api.github.com/repos/edamamez/linux-storage-role/subscription","commits_url":"https://api.github.com/repos/edamamez/linux-storage-role/commits{/sha}","git_commits_url":"https://api.github.com/repos/edamamez/linux-storage-role/git/commits{/sha}","comments_url":"https://api.github.com/repos/edamamez/linux-storage-role/comments{/number}","issue_comment_url":"https://api.github.com/repos/edamamez/linux-storage-role/issues/comments{/number}","contents_url":"https://api.github.com/repos/edamamez/linux-storage-role/contents/{+path}","compare_url":"https://api.github.com/repos/edamamez/linux-storage-role/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edamamez/linux-storage-role/merges","archive_url":"https://api.github.com/repos/edamamez/linux-storage-role/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edamamez/linux-storage-role/downloads","issues_url":"https://api.github.com/repos/edamamez/linux-storage-role/issues{/number}","pulls_url":"https://api.github.com/repos/edamamez/linux-storage-role/pulls{/number}","milestones_url":"https://api.github.com/repos/edamamez/linux-storage-role/milestones{/number}","notifications_url":"https://api.github.com/repos/edamamez/linux-storage-role/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edamamez/linux-storage-role/labels{/name}","releases_url":"https://api.github.com/repos/edamamez/linux-storage-role/releases{/id}","deployments_url":"https://api.github.com/repos/edamamez/linux-storage-role/deployments","created_at":"2018-06-21T15:04:48Z","updated_at":"2018-06-21T15:04:50Z","pushed_at":"2018-07-02T21:33:49Z","git_url":"git://github.com/edamamez/linux-storage-role.git","ssh_url":"git@github.com:edamamez/linux-storage-role.git","clone_url":"https://github.com/edamamez/linux-storage-role.git","svn_url":"https://github.com/edamamez/linux-storage-role","homepage":null,"size":35,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dwlehman:master","ref":"master","sha":"7b7b95e1b3c365a8ba4dd160ffd6f1328b9d606c","user":{"login":"dwlehman","id":6605451,"node_id":"MDQ6VXNlcjY2MDU0NTE=","avatar_url":"https://avatars3.githubusercontent.com/u/6605451?v=4","gravatar_id":"","url":"https://api.github.com/users/dwlehman","html_url":"https://github.com/dwlehman","followers_url":"https://api.github.com/users/dwlehman/followers","following_url":"https://api.github.com/users/dwlehman/following{/other_user}","gists_url":"https://api.github.com/users/dwlehman/gists{/gist_id}","starred_url":"https://api.github.com/users/dwlehman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwlehman/subscriptions","organizations_url":"https://api.github.com/users/dwlehman/orgs","repos_url":"https://api.github.com/users/dwlehman/repos","events_url":"https://api.github.com/users/dwlehman/events{/privacy}","received_events_url":"https://api.github.com/users/dwlehman/received_events","type":"User","site_admin":false},"repo":{"id":136380032,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYzODAwMzI=","name":"linux-storage-role","full_name":"dwlehman/linux-storage-role","owner":{"login":"dwlehman","id":6605451,"node_id":"MDQ6VXNlcjY2MDU0NTE=","avatar_url":"https://avatars3.githubusercontent.com/u/6605451?v=4","gravatar_id":"","url":"https://api.github.com/users/dwlehman","html_url":"https://github.com/dwlehman","followers_url":"https://api.github.com/users/dwlehman/followers","following_url":"https://api.github.com/users/dwlehman/following{/other_user}","gists_url":"https://api.github.com/users/dwlehman/gists{/gist_id}","starred_url":"https://api.github.com/users/dwlehman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwlehman/subscriptions","organizations_url":"https://api.github.com/users/dwlehman/orgs","repos_url":"https://api.github.com/users/dwlehman/repos","events_url":"https://api.github.com/users/dwlehman/events{/privacy}","received_events_url":"https://api.github.com/users/dwlehman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dwlehman/linux-storage-role","description":"Ansible Role for Storage Configuration on Linux","fork":false,"url":"https://api.github.com/repos/dwlehman/linux-storage-role","forks_url":"https://api.github.com/repos/dwlehman/linux-storage-role/forks","keys_url":"https://api.github.com/repos/dwlehman/linux-storage-role/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dwlehman/linux-storage-role/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dwlehman/linux-storage-role/teams","hooks_url":"https://api.github.com/repos/dwlehman/linux-storage-role/hooks","issue_events_url":"https://api.github.com/repos/dwlehman/linux-storage-role/issues/events{/number}","events_url":"https://api.github.com/repos/dwlehman/linux-storage-role/events","assignees_url":"https://api.github.com/repos/dwlehman/linux-storage-role/assignees{/user}","branches_url":"https://api.github.com/repos/dwlehman/linux-storage-role/branches{/branch}","tags_url":"https://api.github.com/repos/dwlehman/linux-storage-role/tags","blobs_url":"https://api.github.com/repos/dwlehman/linux-storage-role/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dwlehman/linux-storage-role/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dwlehman/linux-storage-role/git/refs{/sha}","trees_url":"https://api.github.com/repos/dwlehman/linux-storage-role/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dwlehman/linux-storage-role/statuses/{sha}","languages_url":"https://api.github.com/repos/dwlehman/linux-storage-role/languages","stargazers_url":"https://api.github.com/repos/dwlehman/linux-storage-role/stargazers","contributors_url":"https://api.github.com/repos/dwlehman/linux-storage-role/contributors","subscribers_url":"https://api.github.com/repos/dwlehman/linux-storage-role/subscribers","subscription_url":"https://api.github.com/repos/dwlehman/linux-storage-role/subscription","commits_url":"https://api.github.com/repos/dwlehman/linux-storage-role/commits{/sha}","git_commits_url":"https://api.github.com/repos/dwlehman/linux-storage-role/git/commits{/sha}","comments_url":"https://api.github.com/repos/dwlehman/linux-storage-role/comments{/number}","issue_comment_url":"https://api.github.com/repos/dwlehman/linux-storage-role/issues/comments{/number}","contents_url":"https://api.github.com/repos/dwlehman/linux-storage-role/contents/{+path}","compare_url":"https://api.github.com/repos/dwlehman/linux-storage-role/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dwlehman/linux-storage-role/merges","archive_url":"https://api.github.com/repos/dwlehman/linux-storage-role/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dwlehman/linux-storage-role/downloads","issues_url":"https://api.github.com/repos/dwlehman/linux-storage-role/issues{/number}","pulls_url":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls{/number}","milestones_url":"https://api.github.com/repos/dwlehman/linux-storage-role/milestones{/number}","notifications_url":"https://api.github.com/repos/dwlehman/linux-storage-role/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dwlehman/linux-storage-role/labels{/name}","releases_url":"https://api.github.com/repos/dwlehman/linux-storage-role/releases{/id}","deployments_url":"https://api.github.com/repos/dwlehman/linux-storage-role/deployments","created_at":"2018-06-06T20:00:45Z","updated_at":"2018-06-07T21:24:05Z","pushed_at":"2018-07-02T21:33:50Z","git_url":"git://github.com/dwlehman/linux-storage-role.git","ssh_url":"git@github.com:dwlehman/linux-storage-role.git","clone_url":"https://github.com/dwlehman/linux-storage-role.git","svn_url":"https://github.com/dwlehman/linux-storage-role","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":3,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/5"},"html":{"href":"https://github.com/dwlehman/linux-storage-role/pull/5"},"issue":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/issues/5"},"comments":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/dwlehman/linux-storage-role/statuses/7e98a7500b90fa8ac4e67e142d1a400bed478d3f"}},"author_association":"NONE"}}
{"actor":{"display_login":"dwlehman"}}