Thursday 13 April 2017

Chef-Cookbooks

For Django

yum_repository 'epel' do
   action :create
end


######  Global Install django through pip
package "python-pip" do
action :install
end

package "django" do
action :install
end

######  Set up directories to create a virtual environment
execute "Start project and create virtual environment" do
  command "mkdir /root/project; cd /root/project"
end


For Memcached cookbook:
------------------------------

package "memcached" do
  action :upgrade
end

##### 2: Make sure memcached is running
service "memcached" do
 enabled true
 running true
 action [:enable, :start]
end

-------------

yum_repository 'epel' do
   action :create
end
execute "update package" do
 command "yum update"
 ignore_failure true
 action :nothing
end.run_action(:run)

###### Set up Postgresql with psycopg2 and python django required packages #######
%w{postgresql postgresql-server postgresql-contrib python-django python-pip python-psycopg2}.each do |pkg|
package pkg do
     action :install
  end
end

######  Make sure postgresql service working and running fine
execute "Start Postgres daemon and enable it to start on boot" do
  command "service postgresql initdb; service postgresql start; chkconfig postgresql on"
end

No comments:

Post a Comment