The pip
and virtualenv
are already included as part of python's default
recipe. By specifying recipe[python]
you effectively loaded recipe recipe[python::default]
which includes respective install method, pip and virtualenv.
In order to use python_pip
and python_virtualenv
providers (as name suggest they provide the functionality) you just add them to your custom application recipe like suggested in cookbook's README file
python_pip "gunicorn"
python_virtualenv "/home/ubuntu/my_cool_ve" do
owner "ubuntu"
group "ubuntu"
action :create
end
you need to create own cookbook/recipe. I would recommend to first understand the logic of the cookbooks, but if you want a kick start you can use something like
cd to/your/cookbooks/directory
mkdir mycookbook
cd mycookbook
mkdir recipes
touch README.md
cat >recipes/default.rb <<-EOF
# create sample directory
directory "/tmp/xx"
python_pip "gunicorn"
python_virtualenv "/home/ubuntu/my_cool_ve" do
owner "ubuntu"
group "ubuntu"
action :create
end
EOF
and add this cookbook to run list recipe[mycookbook]
.
chef.run_list = ["recipe[python]", "recipe[mycookbook]"]
Don't forget to check resources like Cookbooks and Getting started with Chef