{"action":"created","comment":{"url":"https://api.github.com/repos/systemconsole/syco/pulls/comments/31639249","id":31639249,"diff_hunk":"@@ -0,0 +1,143 @@\n+#!/usr/bin/env python\n+'''\n+Install DHCP Server\n+\n+This dhcp server is mainly used to get KVM guest installation to work with\n+kickstarts.\n+\n+http://www.yolinux.com/TUTORIALS/DHCP-Server.html\n+http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch08_:_Configuring_the_DHCP_Server\n+http://www.howtoforge.com/dhcp_server_linux_debian_sarge\n+\n+'''\n+\n+__author__ = \"mattias.hemmingsson@fareoffice.com\"\n+__copyright__ = \"Copyright 2014, The System Console project\"\n+__maintainer__ = \"Mattias Hemmingsson\"\n+__email__ = \"syco@cybercow.se\"\n+__credits__ = [\"Daniel Lindh\"]\n+__license__ = \"???\"\n+__version__ = \"1.0.0\"\n+__status__ = \"Production\"\n+\n+import general\n+from general import x\n+from scopen import scOpen\n+import app\n+import version\n+import os\n+import iptables\n+\n+# The version of this module, used to prevent the same script version to be\n+# executed more then once on the same host.\n+SCRIPT_VERSION = 1\n+CONF_SOURCE='/opt/syco/usr/syco-private/var/'\n+\n+def build_commands(commands):\n+    commands.add(\"install-espower\", install_espower, help=\"Install power modules for elastcisearch\")\n+    commands.add(\"uninstall-espower\", uninstall_espower, help=\"Uninstall the power modules for elastic search\")\n+\n+\n+def install_espower(args):\n+\t'''\n+\tInstallation of Elastic search passing rule\n+\t\n+\t'''\n+\tinstall_rabbit()\n+\tinstall_logstash()\n+\tconfig_rabbitmq()\n+\tconfig_logstash()\n+\t# Adding iptables rules\n+\tiptables.add_rabbitmq_chain()\n+\tiptables.save()\n+\t\n+\n+\tprint(\"Go to http://ip-address:15672 for rabbit mq \")\n+\n+def uninstall_espower(args):\n+\tx('yum remove rabbitmq-server -y')\n+\t#x('yum remove erlang -y')\n+\tx('rm -rf /opt/logstash')\n+\tx('rm -rf /etc/logstash')\n+\tx('rm -rf /etc/rabbitmq')\n+\tx('rm -rf /etc/init.d/shipper')\n+\tx('rm -rf /etc/init.d/index') \n+\n+\n+\n+\n+def install_rabbit():\n+\t'''\n+\tInstalla and setup the rabbit mq server.\n+\t'''\n+\n+\n+\t#check if epel is install else installed\n+\tif not os.path.isfile(\"yum install rabbitmq-server -y/etc/yum.repos.d/epel.repo\"):\n+\t\tx('yum localinstall http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm -y')\n+\tx('yum install erlang -y')\n+\tx('rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')\n+\tx('yum install rabbitmq-server -y')\n+\n+\n+\n+def install_logstash():\n+    '''\n+    Download and install logstash\n+    '''\n+    x(\"curl -O  https://download.elasticsearch.org/logstash/logstash/logstash-1.4.2.tar.gz\")\n+    x('mv logstash-1.4.2.tar.gz /opt/logstash.tar.gz')\n+    x('tar -zxvf /opt/logstash.tar.gz -C /opt/')\n+    x('rm /opt/logstash.tar.gz')\n+    x('rm -rf /opt/logstash')\n+    x('ln -s /opt/logstash-1* /opt/logstash')\n+\n+\n+\n+def config_logstash():\n+\t'''\n+\tThere are now defult config for logstash\n+\tCopy config from\n+\t1. First from syco-private\n+\t2. syco var defult config\n+\t''' \n+\tx('cp -r %slogstash /etc/' %CONF_SOURCE)\n+\tx('chown logstash:logstash -R /opt/logstash')\n+\tx('cp /opt/syco/usr/syco-private/var/logstash/start/shipper /etc/init.d/')\n+\tx('cp /opt/syco/usr/syco-private/var/logstash/start/index /etc/init.d/')\n+\tx('chmod 700 /etc/init.d/shipper')\n+\tx('chmod 700 /etc/init.d/index')\n+\tx('chkconfig --add shipper')\n+\tx('chkconfig --add index')\n+\tx('chkconfig shipper on')\n+\tx('chkconfig index on')\n+\tx('/etc/init.d/shipper start')\n+\tx('/etc/init.d/index start')\n+\n+def config_rabbitmq():\n+\t'''\n+\tThere are now defult config for logstash\n+\tCopy config from\n+\t1. First from syco-private\n+\t2. syco var defult config\n+\t'''\n+\t#Remove old certs\n+\tx('rm -rf /etc/rabbitmq/ssl')\n+\n+\tx('mkdir -p /etc/rabbitmq/ssl/private')\n+\tx('openssl req -x509 -config /opt/syco/usr/syco-private/var/rabbitmq/ssl/openssl.cnf -newkey rsa:4096 -days 3650 -out /etc/rabbitmq/ssl/cacert.pem -outform PEM -subj /CN=RabbitMQ/ -nodes')","path":"bin/public/installESpower.py","position":128,"original_position":128,"commit_id":"873cd09da404fb9a6b50c40334a8c833c2138808","original_commit_id":"873cd09da404fb9a6b50c40334a8c833c2138808","user":{"login":"arlukin","id":223861,"avatar_url":"https://avatars.githubusercontent.com/u/223861?v=3","gravatar_id":"","url":"https://api.github.com/users/arlukin","html_url":"https://github.com/arlukin","followers_url":"https://api.github.com/users/arlukin/followers","following_url":"https://api.github.com/users/arlukin/following{/other_user}","gists_url":"https://api.github.com/users/arlukin/gists{/gist_id}","starred_url":"https://api.github.com/users/arlukin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arlukin/subscriptions","organizations_url":"https://api.github.com/users/arlukin/orgs","repos_url":"https://api.github.com/users/arlukin/repos","events_url":"https://api.github.com/users/arlukin/events{/privacy}","received_events_url":"https://api.github.com/users/arlukin/received_events","type":"User","site_admin":false},"body":"Utan att än ha tittat på den så gissar jag att openssl.cnf inte har några hemligheter?","created_at":"2015-06-03T16:03:16Z","updated_at":"2015-06-03T16:03:16Z","html_url":"https://github.com/systemconsole/syco/pull/169#discussion_r31639249","pull_request_url":"https://api.github.com/repos/systemconsole/syco/pulls/169","_links":{"self":{"href":"https://api.github.com/repos/systemconsole/syco/pulls/comments/31639249"},"html":{"href":"https://github.com/systemconsole/syco/pull/169#discussion_r31639249"},"pull_request":{"href":"https://api.github.com/repos/systemconsole/syco/pulls/169"}}},"pull_request":{"url":"https://api.github.com/repos/systemconsole/syco/pulls/169","id":34728686,"html_url":"https://github.com/systemconsole/syco/pull/169","diff_url":"https://github.com/systemconsole/syco/pull/169.diff","patch_url":"https://github.com/systemconsole/syco/pull/169.patch","issue_url":"https://api.github.com/repos/systemconsole/syco/issues/169","number":169,"state":"open","locked":false,"title":"Es power","user":{"login":"mattiashem","id":710338,"avatar_url":"https://avatars.githubusercontent.com/u/710338?v=3","gravatar_id":"","url":"https://api.github.com/users/mattiashem","html_url":"https://github.com/mattiashem","followers_url":"https://api.github.com/users/mattiashem/followers","following_url":"https://api.github.com/users/mattiashem/following{/other_user}","gists_url":"https://api.github.com/users/mattiashem/gists{/gist_id}","starred_url":"https://api.github.com/users/mattiashem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattiashem/subscriptions","organizations_url":"https://api.github.com/users/mattiashem/orgs","repos_url":"https://api.github.com/users/mattiashem/repos","events_url":"https://api.github.com/users/mattiashem/events{/privacy}","received_events_url":"https://api.github.com/users/mattiashem/received_events","type":"User","site_admin":false},"body":".installation av elasticsearch\r\n-installation av elasticsearch power med rabbitmq och logstash\r\n- kopierar configs till rätt ställen\r\n- Dummy cert för att testa ska bytas senare","created_at":"2015-05-05T14:19:48Z","updated_at":"2015-06-03T16:03:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"50046138cb2937aa316e9fca0a237b01584e6a2e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/systemconsole/syco/pulls/169/commits","review_comments_url":"https://api.github.com/repos/systemconsole/syco/pulls/169/comments","review_comment_url":"https://api.github.com/repos/systemconsole/syco/pulls/comments{/number}","comments_url":"https://api.github.com/repos/systemconsole/syco/issues/169/comments","statuses_url":"https://api.github.com/repos/systemconsole/syco/statuses/873cd09da404fb9a6b50c40334a8c833c2138808","head":{"label":"mattiashem:es_power","ref":"es_power","sha":"873cd09da404fb9a6b50c40334a8c833c2138808","user":{"login":"mattiashem","id":710338,"avatar_url":"https://avatars.githubusercontent.com/u/710338?v=3","gravatar_id":"","url":"https://api.github.com/users/mattiashem","html_url":"https://github.com/mattiashem","followers_url":"https://api.github.com/users/mattiashem/followers","following_url":"https://api.github.com/users/mattiashem/following{/other_user}","gists_url":"https://api.github.com/users/mattiashem/gists{/gist_id}","starred_url":"https://api.github.com/users/mattiashem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattiashem/subscriptions","organizations_url":"https://api.github.com/users/mattiashem/orgs","repos_url":"https://api.github.com/users/mattiashem/repos","events_url":"https://api.github.com/users/mattiashem/events{/privacy}","received_events_url":"https://api.github.com/users/mattiashem/received_events","type":"User","site_admin":false},"repo":{"id":19107179,"name":"syco","full_name":"mattiashem/syco","owner":{"login":"mattiashem","id":710338,"avatar_url":"https://avatars.githubusercontent.com/u/710338?v=3","gravatar_id":"","url":"https://api.github.com/users/mattiashem","html_url":"https://github.com/mattiashem","followers_url":"https://api.github.com/users/mattiashem/followers","following_url":"https://api.github.com/users/mattiashem/following{/other_user}","gists_url":"https://api.github.com/users/mattiashem/gists{/gist_id}","starred_url":"https://api.github.com/users/mattiashem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattiashem/subscriptions","organizations_url":"https://api.github.com/users/mattiashem/orgs","repos_url":"https://api.github.com/users/mattiashem/repos","events_url":"https://api.github.com/users/mattiashem/events{/privacy}","received_events_url":"https://api.github.com/users/mattiashem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mattiashem/syco","description":"Customized scripts for installation of services/application on linux servers.","fork":true,"url":"https://api.github.com/repos/mattiashem/syco","forks_url":"https://api.github.com/repos/mattiashem/syco/forks","keys_url":"https://api.github.com/repos/mattiashem/syco/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattiashem/syco/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattiashem/syco/teams","hooks_url":"https://api.github.com/repos/mattiashem/syco/hooks","issue_events_url":"https://api.github.com/repos/mattiashem/syco/issues/events{/number}","events_url":"https://api.github.com/repos/mattiashem/syco/events","assignees_url":"https://api.github.com/repos/mattiashem/syco/assignees{/user}","branches_url":"https://api.github.com/repos/mattiashem/syco/branches{/branch}","tags_url":"https://api.github.com/repos/mattiashem/syco/tags","blobs_url":"https://api.github.com/repos/mattiashem/syco/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattiashem/syco/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattiashem/syco/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattiashem/syco/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattiashem/syco/statuses/{sha}","languages_url":"https://api.github.com/repos/mattiashem/syco/languages","stargazers_url":"https://api.github.com/repos/mattiashem/syco/stargazers","contributors_url":"https://api.github.com/repos/mattiashem/syco/contributors","subscribers_url":"https://api.github.com/repos/mattiashem/syco/subscribers","subscription_url":"https://api.github.com/repos/mattiashem/syco/subscription","commits_url":"https://api.github.com/repos/mattiashem/syco/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattiashem/syco/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattiashem/syco/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattiashem/syco/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattiashem/syco/contents/{+path}","compare_url":"https://api.github.com/repos/mattiashem/syco/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattiashem/syco/merges","archive_url":"https://api.github.com/repos/mattiashem/syco/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattiashem/syco/downloads","issues_url":"https://api.github.com/repos/mattiashem/syco/issues{/number}","pulls_url":"https://api.github.com/repos/mattiashem/syco/pulls{/number}","milestones_url":"https://api.github.com/repos/mattiashem/syco/milestones{/number}","notifications_url":"https://api.github.com/repos/mattiashem/syco/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattiashem/syco/labels{/name}","releases_url":"https://api.github.com/repos/mattiashem/syco/releases{/id}","created_at":"2014-04-24T12:14:56Z","updated_at":"2015-02-05T09:56:48Z","pushed_at":"2015-06-02T18:56:22Z","git_url":"git://github.com/mattiashem/syco.git","ssh_url":"git@github.com:mattiashem/syco.git","clone_url":"https://github.com/mattiashem/syco.git","svn_url":"https://github.com/mattiashem/syco","homepage":"","size":133042,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"systemconsole:master","ref":"master","sha":"4cb1fee44bcd177bf534408f78712886f041a046","user":{"login":"systemconsole","id":651140,"avatar_url":"https://avatars.githubusercontent.com/u/651140?v=3","gravatar_id":"","url":"https://api.github.com/users/systemconsole","html_url":"https://github.com/systemconsole","followers_url":"https://api.github.com/users/systemconsole/followers","following_url":"https://api.github.com/users/systemconsole/following{/other_user}","gists_url":"https://api.github.com/users/systemconsole/gists{/gist_id}","starred_url":"https://api.github.com/users/systemconsole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemconsole/subscriptions","organizations_url":"https://api.github.com/users/systemconsole/orgs","repos_url":"https://api.github.com/users/systemconsole/repos","events_url":"https://api.github.com/users/systemconsole/events{/privacy}","received_events_url":"https://api.github.com/users/systemconsole/received_events","type":"Organization","site_admin":false},"repo":{"id":1439834,"name":"syco","full_name":"systemconsole/syco","owner":{"login":"systemconsole","id":651140,"avatar_url":"https://avatars.githubusercontent.com/u/651140?v=3","gravatar_id":"","url":"https://api.github.com/users/systemconsole","html_url":"https://github.com/systemconsole","followers_url":"https://api.github.com/users/systemconsole/followers","following_url":"https://api.github.com/users/systemconsole/following{/other_user}","gists_url":"https://api.github.com/users/systemconsole/gists{/gist_id}","starred_url":"https://api.github.com/users/systemconsole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemconsole/subscriptions","organizations_url":"https://api.github.com/users/systemconsole/orgs","repos_url":"https://api.github.com/users/systemconsole/repos","events_url":"https://api.github.com/users/systemconsole/events{/privacy}","received_events_url":"https://api.github.com/users/systemconsole/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/systemconsole/syco","description":"Customized scripts for installation of services/application on linux servers.","fork":false,"url":"https://api.github.com/repos/systemconsole/syco","forks_url":"https://api.github.com/repos/systemconsole/syco/forks","keys_url":"https://api.github.com/repos/systemconsole/syco/keys{/key_id}","collaborators_url":"https://api.github.com/repos/systemconsole/syco/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/systemconsole/syco/teams","hooks_url":"https://api.github.com/repos/systemconsole/syco/hooks","issue_events_url":"https://api.github.com/repos/systemconsole/syco/issues/events{/number}","events_url":"https://api.github.com/repos/systemconsole/syco/events","assignees_url":"https://api.github.com/repos/systemconsole/syco/assignees{/user}","branches_url":"https://api.github.com/repos/systemconsole/syco/branches{/branch}","tags_url":"https://api.github.com/repos/systemconsole/syco/tags","blobs_url":"https://api.github.com/repos/systemconsole/syco/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/systemconsole/syco/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/systemconsole/syco/git/refs{/sha}","trees_url":"https://api.github.com/repos/systemconsole/syco/git/trees{/sha}","statuses_url":"https://api.github.com/repos/systemconsole/syco/statuses/{sha}","languages_url":"https://api.github.com/repos/systemconsole/syco/languages","stargazers_url":"https://api.github.com/repos/systemconsole/syco/stargazers","contributors_url":"https://api.github.com/repos/systemconsole/syco/contributors","subscribers_url":"https://api.github.com/repos/systemconsole/syco/subscribers","subscription_url":"https://api.github.com/repos/systemconsole/syco/subscription","commits_url":"https://api.github.com/repos/systemconsole/syco/commits{/sha}","git_commits_url":"https://api.github.com/repos/systemconsole/syco/git/commits{/sha}","comments_url":"https://api.github.com/repos/systemconsole/syco/comments{/number}","issue_comment_url":"https://api.github.com/repos/systemconsole/syco/issues/comments{/number}","contents_url":"https://api.github.com/repos/systemconsole/syco/contents/{+path}","compare_url":"https://api.github.com/repos/systemconsole/syco/compare/{base}...{head}","merges_url":"https://api.github.com/repos/systemconsole/syco/merges","archive_url":"https://api.github.com/repos/systemconsole/syco/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/systemconsole/syco/downloads","issues_url":"https://api.github.com/repos/systemconsole/syco/issues{/number}","pulls_url":"https://api.github.com/repos/systemconsole/syco/pulls{/number}","milestones_url":"https://api.github.com/repos/systemconsole/syco/milestones{/number}","notifications_url":"https://api.github.com/repos/systemconsole/syco/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/systemconsole/syco/labels{/name}","releases_url":"https://api.github.com/repos/systemconsole/syco/releases{/id}","created_at":"2011-03-04T15:27:02Z","updated_at":"2015-05-06T07:23:59Z","pushed_at":"2015-06-03T12:47:22Z","git_url":"git://github.com/systemconsole/syco.git","ssh_url":"git@github.com:systemconsole/syco.git","clone_url":"https://github.com/systemconsole/syco.git","svn_url":"https://github.com/systemconsole/syco","homepage":"","size":134314,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":11,"forks":12,"open_issues":11,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/systemconsole/syco/pulls/169"},"html":{"href":"https://github.com/systemconsole/syco/pull/169"},"issue":{"href":"https://api.github.com/repos/systemconsole/syco/issues/169"},"comments":{"href":"https://api.github.com/repos/systemconsole/syco/issues/169/comments"},"review_comments":{"href":"https://api.github.com/repos/systemconsole/syco/pulls/169/comments"},"review_comment":{"href":"https://api.github.com/repos/systemconsole/syco/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/systemconsole/syco/pulls/169/commits"},"statuses":{"href":"https://api.github.com/repos/systemconsole/syco/statuses/873cd09da404fb9a6b50c40334a8c833c2138808"}}}}