Skip to content

Commit

Permalink
Fixed user recipe, php.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tavish Armstrong committed Dec 23, 2011
1 parent ff1018a commit 28670e3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
8 changes: 3 additions & 5 deletions php/recipes/default.rb
Expand Up @@ -15,11 +15,9 @@
end

packages.each do |pkg|
if File.exists? "/etc/apt/preferences.d/#{package}"
File.delete "/etc/apt/preferences.d/#{package}"
execute "aptitude --assume-yes purge #{package}" do
not_if "apt-cache policy #{package} | grep 'Installed: #{version}'"
end
if File.exists? "/etc/apt/preferences.d/#{pkg}"
File.delete "/etc/apt/preferences.d/#{pkg}"
execute "aptitude --assume-yes purge #{pkg}"
end
package pkg
end
Expand Down
4 changes: 2 additions & 2 deletions phpmyadmin/recipes/default.rb
Expand Up @@ -25,6 +25,6 @@
action :upgrade
end

link "/etc/apache2/conf.d/phpmyadmin" do
to "/etc/phpmyadmin/apache.conf"
template "/etc/apache2/conf.d/phpmyadmin" do
source "apache.conf.erb"
end
22 changes: 11 additions & 11 deletions users/metadata.json
@@ -1,32 +1,32 @@
{
"maintainer": "Opscode, Inc.",
"replacing": {
"conflicting": {
},
"long_description": "= DESCRIPTION:\n\nCreates users with authorized_keys.\n\n= REQUIREMENTS:\n\nData bag named \"users\" must exist. See USAGE.\n\n= USAGE:\n\nThis cookbook is specific for setting up sysadmin group and users for now.\n\n include_recipe \"users::sysadmins\"\n\nUse knife to create a data bag for users.\n\n knife create_data --bag=users\n\nCreate a user.\n\n knife create_item --bag=users --id bofh\n {\n \"id\": \"bofh\",\n \"ssh_keys\": \"\",\n \"groups\": \"sysadmin\",\n \"uid\": 2001,\n \"shell\": \"\\/bin\\/bash\",\n \"comment\": \"BOFH\",\n \"nagios\": {\n \"pager\": \"8005551212@txt.att.net\",\n \"email\": \"bofh@example.com\"\n },\n \"openid\": \"bofh.myopenid.com\"\n }\n\nPaste the user's public SSH key into the ssh_keys value. Also make sure the uid is unique, and if you're not using bash, that the shell is installed. Group must be sysadmin.\n\nThe recipe will also create the sysadmin group. If you're using the opscode sudo cookbook, they'll have sudo access in the default site-cookbooks template. They won't have passwords though, so the sudo cookbook's template needs to be adjusted so the sysadmin group has NOPASSWD.\n\n= LICENSE and AUTHOR:\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"description": "Creates users from a databag search",
"recipes": {
"providing": {
},
"maintainer_email": "ops@example.com",
"groupings": {
"recipes": {
},
"maintainer": "Opscode, Inc.",
"attributes": {
},
"recommendations": {
"replacing": {
},
"dependencies": {
"sudo": [

]
},
"suggestions": {
"maintainer_email": "ops@example.com",
"groupings": {
},
"recommendations": {
},
"platforms": {
},
"version": "0.2.0",
"conflicting": {
},
"license": "Apache 2.0",
"name": "users",
"long_description": "= DESCRIPTION:\n\nCreates users with authorized_keys.\n\n= REQUIREMENTS:\n\nData bag named \"users\" must exist. See USAGE.\n\n= USAGE:\n\nThis cookbook is specific for setting up sysadmin group and users for now.\n\n include_recipe \"users::sysadmins\"\n\nUse knife to create a data bag for users.\n\n knife create_data --bag=users\n\nCreate a user.\n\n knife create_item --bag=users --id bofh\n {\n \"id\": \"bofh\",\n \"ssh_keys\": \"\",\n \"groups\": \"sysadmin\",\n \"uid\": 2001,\n \"shell\": \"\\/bin\\/bash\",\n \"comment\": \"BOFH\",\n \"nagios\": {\n \"pager\": \"8005551212@txt.att.net\",\n \"email\": \"bofh@example.com\"\n },\n \"openid\": \"bofh.myopenid.com\"\n }\n\nPaste the user's public SSH key into the ssh_keys value. Also make sure the uid is unique, and if you're not using bash, that the shell is installed. Group must be sysadmin.\n\nThe recipe will also create the sysadmin group. If you're using the opscode sudo cookbook, they'll have sudo access in the default site-cookbooks template. They won't have passwords though, so the sudo cookbook's template needs to be adjusted so the sysadmin group has NOPASSWD.\n\n= LICENSE and AUTHOR:\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"providing": {
"suggestions": {
}
}
16 changes: 10 additions & 6 deletions users/recipes/root.rb
Expand Up @@ -16,11 +16,15 @@
sysadmin_keys = search(:users, 'groups:sysadmin').map{ |u| u['ssh_keys'] }
system_keys = search(:users, 'groups:system').map{ |u| u['ssh_keys'] }

# Let's make sure *somebody* can log into the machine.
if sysadmin_keys.count > 0

template "/root/.ssh/authorized_keys" do
source "authorized_keys.erb"
mode 0600
owner "root"
group "root"
variables :ssh_keys => sysadmin_keys, :system_keys => system_keys, :external_keys => node[:users][:external_keys]
end

template "/root/.ssh/authorized_keys" do
source "authorized_keys.erb"
mode 0600
owner "root"
group "root"
variables :ssh_keys => sysadmin_keys, :system_keys => system_keys, :external_keys => node[:users][:external_keys]
end

0 comments on commit 28670e3

Please sign in to comment.