{"action":"created","comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments/62798772","id":62798772,"diff_hunk":"@@ -0,0 +1,110 @@\n+#!/usr/bin/python\n+# -*- coding: utf-8 -*-\n+\n+# This file is part of Ansible\n+#\n+# Ansible is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 3 of the License, or\n+# (at your option) any later version.\n+#\n+# Ansible is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.\n+\n+DOCUMENTATION='''\n+---\n+module: atomic_image\n+short_description: Manage the container images on the atomic host platform\n+description:\n+    - Manage the container images on the atomic host platform\n+version_added: \"2.2\"\n+author: \"Saravanan KR @krsacme\"\n+notes:\n+    - Host should be an atomic platform (verified by existence of '/run/ostree-booted' file)\n+requirements:\n+  - atomic\n+options:\n+    name:\n+        description:\n+          - Name of the container image\n+        required: True\n+        default: null\n+    state:\n+        description:\n+          - Whether to install (C(present) or C(start) or C(update)), or uninstall (C(stop) or C(remove))\n+        required: True\n+        choices: [\"present\", \"start\", \"stop\", \"update\", \"remove\"]\n+        default: null\n+'''\n+\n+EXAMPLES = '''\n+\n+# Install rhel-tools container image (atomic install rhel7/rhel-tools)\n+- atomic_image: name=rhel7/rhel-tools state=present\n+\n+# Run rsyslog container image (atomic run rhel7/rsyslog)\n+- atomic_image: name=rhel7/rsyslog state=start\n+\n+'''\n+\n+RETURN = '''\n+msg:\n+    description: The command standard output\n+    returned: always\n+    type: string\n+    sample: [u'Using default tag: latest ...']\n+'''\n+\n+import os\n+import sys\n+\n+def core(module):\n+    state_map = {'present'  : 'install',\n+                 'start'    : 'run',\n+                 'stop'     : 'stop',\n+                 'update'   : 'update',\n+                 'remove'   : 'uninstall'}","path":"system/atomic_image.py","position":71,"original_position":71,"commit_id":"212b1f7022d4d6bec8711361b66a8365de2656d5","original_commit_id":"212b1f7022d4d6bec8711361b66a8365de2656d5","user":{"login":"krsacme","id":6107458,"avatar_url":"https://avatars.githubusercontent.com/u/6107458?v=3","gravatar_id":"","url":"https://api.github.com/users/krsacme","html_url":"https://github.com/krsacme","followers_url":"https://api.github.com/users/krsacme/followers","following_url":"https://api.github.com/users/krsacme/following{/other_user}","gists_url":"https://api.github.com/users/krsacme/gists{/gist_id}","starred_url":"https://api.github.com/users/krsacme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krsacme/subscriptions","organizations_url":"https://api.github.com/users/krsacme/orgs","repos_url":"https://api.github.com/users/krsacme/repos","events_url":"https://api.github.com/users/krsacme/events{/privacy}","received_events_url":"https://api.github.com/users/krsacme/received_events","type":"User","site_admin":false},"body":"@miabbott and @tima, I agree that the atomic_host operations are inline with ```command``` and cannot be ```state```. But the atomic_image operations are purely ```state``` operations (i will change```remove``` to ```absent``` and ```update``` to ```latest``` ). And along with ```atomic run <image>```, it is also possible to give the command to be executed on the image like ```atomic run rhel7/rhel-tools hostname```, in which case, naming it as ```command``` is not appropriate.\r\n@bcoca 's suggestion of using```started=yes|no``` with ```present``` is explicit and easy to understand. I will follow it.","created_at":"2016-05-11T06:47:10Z","updated_at":"2016-05-11T06:47:10Z","html_url":"https://github.com/ansible/ansible-modules-extras/pull/1902#discussion_r62798772","pull_request_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1902","_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments/62798772"},"html":{"href":"https://github.com/ansible/ansible-modules-extras/pull/1902#discussion_r62798772"},"pull_request":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1902"}}},"pull_request":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1902","id":64002204,"html_url":"https://github.com/ansible/ansible-modules-extras/pull/1902","diff_url":"https://github.com/ansible/ansible-modules-extras/pull/1902.diff","patch_url":"https://github.com/ansible/ansible-modules-extras/pull/1902.patch","issue_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1902","number":1902,"state":"open","locked":false,"title":"Added modules to manage Atomic Host Platform (host and image)","user":{"login":"krsacme","id":6107458,"avatar_url":"https://avatars.githubusercontent.com/u/6107458?v=3","gravatar_id":"","url":"https://api.github.com/users/krsacme","html_url":"https://github.com/krsacme","followers_url":"https://api.github.com/users/krsacme/followers","following_url":"https://api.github.com/users/krsacme/following{/other_user}","gists_url":"https://api.github.com/users/krsacme/gists{/gist_id}","starred_url":"https://api.github.com/users/krsacme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krsacme/subscriptions","organizations_url":"https://api.github.com/users/krsacme/orgs","repos_url":"https://api.github.com/users/krsacme/repos","events_url":"https://api.github.com/users/krsacme/events{/privacy}","received_events_url":"https://api.github.com/users/krsacme/received_events","type":"User","site_admin":false},"body":"##### ISSUE TYPE\r\n - New Module Pull Request\r\n\r\n##### COMPONENT NAME\r\natomic_host\r\natomic_image\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.1.0\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = /usr/share/my_modules/\r\n```\r\n\r\n##### SUMMARY\r\nAtomic Host Plaform provides atomic command to manage the host and to manage the container images on the host. Details of the command can be found at [1]. Added 2 modules in here:\r\natomic_host :- Module to mange the host itself, upgrade or rollback\r\natomic_image :- Module to manage the container images\r\n\r\n\r\n[1] http://www.projectatomic.io/docs/usr-bin-atomic/, https://github.com/projectatomic/atomic/","created_at":"2016-03-24T08:21:58Z","updated_at":"2016-05-11T06:47:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5d61b0a615092308732906cee31c4d65d128040","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1902/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1902/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1902/comments","statuses_url":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/212b1f7022d4d6bec8711361b66a8365de2656d5","head":{"label":"krsacme:krs/atomic_host_cmd","ref":"krs/atomic_host_cmd","sha":"212b1f7022d4d6bec8711361b66a8365de2656d5","user":{"login":"krsacme","id":6107458,"avatar_url":"https://avatars.githubusercontent.com/u/6107458?v=3","gravatar_id":"","url":"https://api.github.com/users/krsacme","html_url":"https://github.com/krsacme","followers_url":"https://api.github.com/users/krsacme/followers","following_url":"https://api.github.com/users/krsacme/following{/other_user}","gists_url":"https://api.github.com/users/krsacme/gists{/gist_id}","starred_url":"https://api.github.com/users/krsacme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krsacme/subscriptions","organizations_url":"https://api.github.com/users/krsacme/orgs","repos_url":"https://api.github.com/users/krsacme/repos","events_url":"https://api.github.com/users/krsacme/events{/privacy}","received_events_url":"https://api.github.com/users/krsacme/received_events","type":"User","site_admin":false},"repo":{"id":54622364,"name":"ansible-modules-extras","full_name":"krsacme/ansible-modules-extras","owner":{"login":"krsacme","id":6107458,"avatar_url":"https://avatars.githubusercontent.com/u/6107458?v=3","gravatar_id":"","url":"https://api.github.com/users/krsacme","html_url":"https://github.com/krsacme","followers_url":"https://api.github.com/users/krsacme/followers","following_url":"https://api.github.com/users/krsacme/following{/other_user}","gists_url":"https://api.github.com/users/krsacme/gists{/gist_id}","starred_url":"https://api.github.com/users/krsacme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krsacme/subscriptions","organizations_url":"https://api.github.com/users/krsacme/orgs","repos_url":"https://api.github.com/users/krsacme/repos","events_url":"https://api.github.com/users/krsacme/events{/privacy}","received_events_url":"https://api.github.com/users/krsacme/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/krsacme/ansible-modules-extras","description":"Ansible extra modules - these modules ship with ansible","fork":true,"url":"https://api.github.com/repos/krsacme/ansible-modules-extras","forks_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/forks","keys_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/teams","hooks_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/hooks","issue_events_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/issues/events{/number}","events_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/events","assignees_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/assignees{/user}","branches_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/branches{/branch}","tags_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/tags","blobs_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/languages","stargazers_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/stargazers","contributors_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/contributors","subscribers_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/subscribers","subscription_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/subscription","commits_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/issues/comments{/number}","contents_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/contents/{+path}","compare_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/merges","archive_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/downloads","issues_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/issues{/number}","pulls_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/labels{/name}","releases_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/releases{/id}","deployments_url":"https://api.github.com/repos/krsacme/ansible-modules-extras/deployments","created_at":"2016-03-24T07:16:08Z","updated_at":"2016-03-24T07:16:12Z","pushed_at":"2016-05-10T10:26:15Z","git_url":"git://github.com/krsacme/ansible-modules-extras.git","ssh_url":"git@github.com:krsacme/ansible-modules-extras.git","clone_url":"https://github.com/krsacme/ansible-modules-extras.git","svn_url":"https://github.com/krsacme/ansible-modules-extras","homepage":"","size":6857,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"31e7463e6857734c356cefff48ce1fcb8aef5290","user":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"repo":{"id":24474138,"name":"ansible-modules-extras","full_name":"ansible/ansible-modules-extras","owner":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ansible/ansible-modules-extras","description":"Ansible extra modules - these modules ship with ansible","fork":false,"url":"https://api.github.com/repos/ansible/ansible-modules-extras","forks_url":"https://api.github.com/repos/ansible/ansible-modules-extras/forks","keys_url":"https://api.github.com/repos/ansible/ansible-modules-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ansible/ansible-modules-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ansible/ansible-modules-extras/teams","hooks_url":"https://api.github.com/repos/ansible/ansible-modules-extras/hooks","issue_events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/events{/number}","events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/events","assignees_url":"https://api.github.com/repos/ansible/ansible-modules-extras/assignees{/user}","branches_url":"https://api.github.com/repos/ansible/ansible-modules-extras/branches{/branch}","tags_url":"https://api.github.com/repos/ansible/ansible-modules-extras/tags","blobs_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/ansible/ansible-modules-extras/languages","stargazers_url":"https://api.github.com/repos/ansible/ansible-modules-extras/stargazers","contributors_url":"https://api.github.com/repos/ansible/ansible-modules-extras/contributors","subscribers_url":"https://api.github.com/repos/ansible/ansible-modules-extras/subscribers","subscription_url":"https://api.github.com/repos/ansible/ansible-modules-extras/subscription","commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/ansible/ansible-modules-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/comments{/number}","contents_url":"https://api.github.com/repos/ansible/ansible-modules-extras/contents/{+path}","compare_url":"https://api.github.com/repos/ansible/ansible-modules-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ansible/ansible-modules-extras/merges","archive_url":"https://api.github.com/repos/ansible/ansible-modules-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ansible/ansible-modules-extras/downloads","issues_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues{/number}","pulls_url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/ansible/ansible-modules-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/ansible/ansible-modules-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ansible/ansible-modules-extras/labels{/name}","releases_url":"https://api.github.com/repos/ansible/ansible-modules-extras/releases{/id}","deployments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/deployments","created_at":"2014-09-25T20:28:42Z","updated_at":"2016-05-09T13:43:16Z","pushed_at":"2016-05-11T04:41:37Z","git_url":"git://github.com/ansible/ansible-modules-extras.git","ssh_url":"git@github.com:ansible/ansible-modules-extras.git","clone_url":"https://github.com/ansible/ansible-modules-extras.git","svn_url":"https://github.com/ansible/ansible-modules-extras","homepage":"","size":13945,"stargazers_count":573,"watchers_count":573,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1185,"mirror_url":null,"open_issues_count":582,"forks":1185,"open_issues":582,"watchers":573,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1902"},"html":{"href":"https://github.com/ansible/ansible-modules-extras/pull/1902"},"issue":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1902"},"comments":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/1902/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1902/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/1902/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible-modules-extras/statuses/212b1f7022d4d6bec8711361b66a8365de2656d5"}}}}