{"action":"created","issue":{"url":"https://api.github.com/repos/ioc32/openhrc/issues/6","labels_url":"https://api.github.com/repos/ioc32/openhrc/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/ioc32/openhrc/issues/6/comments","events_url":"https://api.github.com/repos/ioc32/openhrc/issues/6/events","html_url":"https://github.com/ioc32/openhrc/pull/6","id":71115238,"number":6,"title":"Use ansible's service module instead of templating /etc/rc.conf.local","user":{"login":"ioc32","id":1151149,"avatar_url":"https://avatars.githubusercontent.com/u/1151149?v=3","gravatar_id":"","url":"https://api.github.com/users/ioc32","html_url":"https://github.com/ioc32","followers_url":"https://api.github.com/users/ioc32/followers","following_url":"https://api.github.com/users/ioc32/following{/other_user}","gists_url":"https://api.github.com/users/ioc32/gists{/gist_id}","starred_url":"https://api.github.com/users/ioc32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioc32/subscriptions","organizations_url":"https://api.github.com/users/ioc32/orgs","repos_url":"https://api.github.com/users/ioc32/repos","events_url":"https://api.github.com/users/ioc32/events{/privacy}","received_events_url":"https://api.github.com/users/ioc32/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-04-26T20:22:59Z","updated_at":"2015-04-28T20:49:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ioc32/openhrc/pulls/6","html_url":"https://github.com/ioc32/openhrc/pull/6","diff_url":"https://github.com/ioc32/openhrc/pull/6.diff","patch_url":"https://github.com/ioc32/openhrc/pull/6.patch"},"body":"This is more aligned with the ansible way of doing things.\r\nThe service.py module provides an OpenBsdService class that uses rcctl(8)\r\nto handle system services.\r\n\r\nThe playbooks themselves have not been tested yet, but initial ad-hoc\r\ntesting using ansible(1) suggests we could do without manually templating\r\n/etc/rc.conf.local. See below.\r\n\r\nSince the service to be enabled might be running, or not, we restart it\r\nto ensure it picks up the new config, if any, after enabling it.\r\n\r\nSince the service to be disabled might be running, or not, we stop it\r\nafter disabling it.\r\n\r\n$ fgrep pflog /etc/rc.conf.local\r\n$\r\n$ ansible localhost -m service -a \"name=pflogd enabled=yes args='-s 256' state=restarted\"\r\nlocalhost | success >> {\r\n    \"changed\": true,\r\n    \"enabled\": true,\r\n    \"name\": \"pflogd\",\r\n    \"state\": \"started\"\r\n}\r\n$ fgrep pflog /etc/rc.conf.local\r\npflogd_flags=-s 256\r\n$\r\n$ ansible localhost -m service -a \"name=pflogd enabled=no state=stopped\"\r\nlocalhost | success >> {\r\n    \"changed\": true,\r\n    \"enabled\": false,\r\n    \"name\": \"pflogd\",\r\n    \"state\": \"stopped\"\r\n}\r\n$ fgrep pflog /etc/rc.conf.local\r\npflogd_flags=NO\r\n$"},"comment":{"url":"https://api.github.com/repos/ioc32/openhrc/issues/comments/97203076","html_url":"https://github.com/ioc32/openhrc/pull/6#issuecomment-97203076","issue_url":"https://api.github.com/repos/ioc32/openhrc/issues/6","id":97203076,"user":{"login":"ioc32","id":1151149,"avatar_url":"https://avatars.githubusercontent.com/u/1151149?v=3","gravatar_id":"","url":"https://api.github.com/users/ioc32","html_url":"https://github.com/ioc32","followers_url":"https://api.github.com/users/ioc32/followers","following_url":"https://api.github.com/users/ioc32/following{/other_user}","gists_url":"https://api.github.com/users/ioc32/gists{/gist_id}","starred_url":"https://api.github.com/users/ioc32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioc32/subscriptions","organizations_url":"https://api.github.com/users/ioc32/orgs","repos_url":"https://api.github.com/users/ioc32/repos","events_url":"https://api.github.com/users/ioc32/events{/privacy}","received_events_url":"https://api.github.com/users/ioc32/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T20:49:22Z","updated_at":"2015-04-28T20:49:22Z","body":"This should do :-)"}}