Httpd is not running, when I do chef-client on the centos node

I’m unable to run httpd using chef cookbook.

Here’s the error I’m getting;

Starting Chef Client, version 12.10.24
resolving cookbooks for run list: [“security”, “apache”, “lamp-stack::apache”]
Synchronizing Cookbooks:

  • apache (0.1.0)
  • security (0.1.0)
  • lamp-stack (0.1.0)
    Installing Cookbook Gems:
    Compiling Cookbooks…
    [2016-05-23T03:42:13+00:00] WARN: Cloning resource attributes for service[httpd] from prior resource (CHEF-3694)
    [2016-05-23T03:42:13+00:00] WARN: Previous service[httpd]: /var/chef/cache/cookbooks/apache/recipes/default.rb:13:in from_file' [2016-05-23T03:42:13+00:00] WARN: Current service[httpd]: /var/chef/cache/cookbooks/lamp-stack/recipes/apache.rb:6:infrom_file’
    Converging 9 resources
    Recipe: security::default
  • file[/etc/chef/validation.pem] action delete (up to date)
    Recipe: apache::default

  • yum_package[httpd] action install (up to date)

  • service[httpd] action start

    ================================================================================
    Error executing action start on resource ‘service[httpd]’

    Mixlib::ShellOut::ShellCommandFailed

    Expected process to exit with [0], but received ‘1’
    ---- Begin output of /usr/bin/systemctl --system start httpd ----
    STDOUT:
    STDERR: Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.
    ---- End output of /usr/bin/systemctl --system start httpd ----
    Ran /usr/bin/systemctl --system start httpd returned 1

    Resource Declaration:

    In /var/chef/cache/cookbooks/apache/recipes/default.rb

    13: service “httpd” do
    14: action :start
    15: end
    16:

    Compiled Resource:

    Declared in /var/chef/cache/cookbooks/apache/recipes/default.rb:13:in `from_file’

    service(“httpd”) do
    action [:start]
    supports {:restart=>nil, :reload=>nil, :status=>nil}
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    service_name "httpd"
    pattern "httpd"
    declared_type :service
    cookbook_name "apache"
    recipe_name "default"
    end

    Platform:

    x86_64-linux

Running handlers:
[2016-05-23T03:42:21+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-05-23T03:42:21+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 13 seconds
[2016-05-23T03:42:22+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-05-23T03:42:22+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-05-23T03:42:22+00:00] ERROR: service[httpd] (apache::default line 13) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’
---- Begin output of /usr/bin/systemctl --system start httpd ----
STDOUT:
STDERR: Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.
---- End output of /usr/bin/systemctl --system start httpd ----
Ran /usr/bin/systemctl --system start httpd returned 1
[2016-05-23T03:42:22+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1

Sounds like the apache configuration is wrong. Try looking at the apache error.log and see what it says or try starting the service manually as indicated by the error.

Get Outlook for Androidhttps://aka.ms/ghei36

There nothing much added into the cookbook, I’m just doing a basic apache installation and running it.

Here’s the code in the recipe;
package “httpd” do
action :install
end

service “httpd” do
action [:enable, :start]
end

Hi,

As the error report suggests, please provide the output of “systemctl status httpd.service” and “journalctl -xe”.
The error does not seem to be chef related, so we need this output to know what is actually going on.