在bootstrap期间切换chef-client用户

时间:2015-01-15 19:09:36

标签: drupal-6 chef chef-recipe aegir

我已经写了安装Aegir的食谱。我想用awgir配方在aws上引导一个新实例,安装顺利但是没有执行“drush hostmaster-install”,因为它抛出“Drupal installation not found”错误。

它安装顺利当我手动进入机器并让一个厨师 - 客户端与aegir用户一起运行时。

ssh to ec2 with ubuntu user
sudo su - aegir
sudo chef-client

但是当我用ubuntu用户引导新实例时,安装失败了。我很欣赏任何改变用户运营厨师客户的想法。

execute "apt-get-update" do
  command "sudo apt-get update"
end

%w{curl apache2 php5 libapache2-mod-php5 openssl php-pear php5-cli php5-common php5-curl php5-dev php5-gd php5-imagick
php5-imap php5-intl php5-mcrypt php5-memcache php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-tidy php5-gd
php5-xmlrpc php5-xsl apache2-utils postfix rsync sudo libcurl3 libcurl3-gnutls mysql-client mysql-common}.each do |x|
    package x do
        action :install
    end
end

user "aegir" do
    action :create
    supports :manage_home => true
    comment "aegir User"
    home "#{node[:aegir][:dir]}"
    shell "/bin/bash"
    password "VenEucAf1"
end

group "www-data" do
    action :modify
    members "aegir"
    append true
end

bash "install_mysql" do
    user "root"
    code  /etc/sudoers.d/aegir
    chmod 440 /etc/sudoers.d/aegir
    EOH
    not_if { ::File.exists?("/etc/sudoers.d/aegir") }
end


bash "Install_drush" do
    user "root"
    cwd "/var/aegir"
    code  '/var/aegir', 'USER' => 'aegir' }) 
        cwd "#{node[:aegir][:dir]}"
    command  true, :restart => true, :reload => true
    action :start
end

更新了我的完整食谱。

错误:用户aegir不存在

1 个答案:

答案 0 :(得分:0)

听起来您可能需要设置HOME环境变量。您可以将其添加到执行资源:

execute 'drush hostmaster-install' do
  user 'aegir'
  environment 'HOME' => '/home/whatever'
end