Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7000369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:39:42+00:00 2026-05-27T20:39:42+00:00

How can we write a puppet manifest code that identifies whether a service(httpd) is

  • 0

How can we write a puppet manifest code that identifies whether a service(httpd) is running or not on puppet clients/agents. And if not, it should start that service and send out an email ?

class apache {
    package { mysql-server: ensure => installed }
    if hasstatus == "false" {
        service { "mysql":
            ensure => running,
            require => Package["mysql-server"],
        }
    }
}

node default {
    include apache
}

I know this is not a correct code. But I want to check hasstatus first and if the service status is false then I want to start service and send out an email.

Thanks
Sanket Dangi


I have configured tagmail.conf in puppet master and have also enabled puppet reports but not able to receive mails to my gmail account. I can see puppet agent reports on puppet master but not receiving mails. Do I need to configure mail server for this ?

My Tagmail Conf : 
all: xxxxxxx@gmail.com
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:39:43+00:00Added an answer on May 27, 2026 at 8:39 pm

    Puppet isn’t an imperative shell script where you need to check the value of X before performing action Y that gets you to state Z. Instead, you specify that you want state Z and Puppet checks the current state and handles the transition.

    What this means is that you don’t need to check the status of a service before deciding whether to start it or not and instead you declare that the mysql service should be running and Puppet ensures this is the case.

    Simply have this in your manifest alongside the package line:

    service { "mysql":
      ensure  => running,
      enable  => true,
      require => Package["mysql-server"],
    }
    

    The require line ensures the package is installed before evaluating or starting the service.

    To send out notifications you can use the tagmail reporting feature in Puppet. First set up a tagmail file (reference docs) like this at /etc/puppet/tagmail.conf on the master:

    mysql, apache: wwwadmins@example.com
    

    And in the master’s puppet.conf, set:

    [master]
    reports = tagmail
    

    Ensure clients have report enabled in puppet.conf:

    [agent]
    report = true
    

    This should then trigger e-mails relating to any resources with the “mysql” or “apache” tags (class names, module names etc).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i can write methods like that public void CompareEmail() { some code } public
How can write jquery code that input just accept number. if was something except
Can someone please explain how you can write a url pattern and view that
In SQL one can write a query that searches for a name of a
When I write code in Python with exception handling I can write code like:
I can write my code logic to either buffer a polyline or to buffer
We can write a piece of python code and put it in already compiled
I can write such beatiful straightforward code: public int Delta { get; private set;
I can write: <%= debug(params) %> <%= debug(session) %> but not: <%= debug(errors) %>
I know that with mysql you can write SQL statements into a .sql file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.