Why do these feel like homework questions?  :D


You can add logic to your manifest  based on what environment the agent is 
running under using simple if statements.  For example:


if $facts['environment'] != 'production' {

    notify { 'This is a non-production node!': }

}


If you're not familiar with writing puppet manifests the Puppet Learning VM 
would be a good place to start.


https://puppet.com/try-puppet/puppet-learning-vm/



On Sunday, August 2, 2020 at 9:30:41 AM UTC-4, Md Juyel Haque wrote:
>
> Hi y tickets are these
> I am struggling with to write scripts
>
> another two scripts I need please 
> 1 ) 
> In the Puppet scripts, create a script which is active on every 
> environment *except for prod and is only installed on the SSH servers*. 
> This script should run via cron every 5 minutes, which can be installed via 
> Puppet (see common::cronjob).  
>
> 2) Create a script in Puppet which is installed in the Tomcat servers *only 
> for non-production environments and is not available in production* and 
> runs via cron every 5 minutes. The script will install the DB backup when 
> it is found in the IAM user’s directory  
>
>
>
>
>
> On Sat, Aug 1, 2020 at 3:38 AM Md Juyel Haque <[email protected] 
> <javascript:>> wrote:
>
>> okay Thank You 
>>
>> On Sat, Aug 1, 2020 at 3:17 AM Chris <[email protected] <javascript:>> 
>> wrote:
>>
>>> You put the perl script and backup scripts in a module, and deploy as 
>>> files.  In my case, they are part of a private module called bayhosting:
>>>
>>> file {
>>>     "/var/local/backups/mysql":
>>>       ensure  => directory,
>>>       mode  =>  '0700',
>>>       owner  =>  'root',
>>>       group  =>  'root',
>>>       require => File['/var/local/backups'];
>>>
>>>     "/opt/bin/MySQLBackup.pl":
>>>       source => "puppet:///modules/bayhosting/opt/bin/MySQLBackup.pl",
>>>       owner   => 'root',
>>>       group   => 'root',
>>>       mode    => '0555';
>>>
>>>     "/root/backup.sh":
>>>       source => "puppet:///modules/bayhosting/root/backup.sh",
>>>       owner   => 'root',
>>>       group   => 'root',
>>>       mode    => '0555';
>>>  }
>>>
>>> And then you set up a cron job:
>>>
>>> cron {
>>>     cron_mysqlbackup:
>>>       command  =>  "/root/backup.sh",
>>>       user  =>  root,
>>>       hour  => 0,
>>>       minute  => 0,
>>>       require => 
>>> File['/opt/bin/MySQLBackup.pl',"/var/local/backups/mysql", 
>>> "/root/backup.sh"];
>>> }
>>>
>>> On Sat, Aug 1, 2020 at 9:31 AM Md Juyel Haque <[email protected] 
>>> <javascript:>> wrote:
>>>
>>>> if I write this code how will I run it from puppet
>>>>
>>>> On Sat, Aug 1, 2020 at 1:39 AM Chris <[email protected] <javascript:>> 
>>>> wrote:
>>>>
>>>>> I use this as my mysql backup script:  
>>>>> https://github.com/ghstwhl/MySQLBackup
>>>>>
>>>>> It expects that the credentials for the database are in ~/.my.cnf for 
>>>>> the user running the script.  If you are using puppetlabs/mysql to manage 
>>>>> your mysql database then this is already set up for you and you just need 
>>>>> to run your cron job as root.  Right now it assumes it is running on the 
>>>>> DB 
>>>>> server itself, but the ParseMyCnf function could be easily tweaked to 
>>>>> read the server address from ~/.my.cnf if it exists and only default to 
>>>>> localhost if a host isn't specified.
>>>>>
>>>>> It doesn't currently send emails on errors, but you can fork the repo 
>>>>> and submit a PR and I'd be happy to merge.
>>>>>
>>>>>
>>>>> -Chris
>>>>>
>>>>> On Sat, Aug 1, 2020 at 5:17 AM Md Juyel Haque <[email protected] 
>>>>> <javascript:>> wrote:
>>>>>
>>>>>> Please help me.I want to create  script database backup. This should 
>>>>>> be deployed with the puppet scripts on the Tomcat server.
>>>>>> Errors from the dump should be noted and an email sent to particular 
>>>>>> email address in case of errors/failure.
>>>>>> The script should also take the IP addresses from the Cloudformation 
>>>>>> template specified and SCP the backup to each of these servers.
>>>>>>
>>>>>> -- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Puppet Users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to [email protected] <javascript:>.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/puppet-users/74ab9a41-6043-42db-8e25-68ec2adaa998o%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/puppet-users/74ab9a41-6043-42db-8e25-68ec2adaa998o%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Puppet Users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected] <javascript:>.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/puppet-users/CAABnqB8rJDhgQFUrmGsnLTOuj6h15Q9ZaDjzBC%2BHJR%3DRi-8iLQ%40mail.gmail.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/puppet-users/CAABnqB8rJDhgQFUrmGsnLTOuj6h15Q9ZaDjzBC%2BHJR%3DRi-8iLQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>>>
>>>> -- 
>>>>
>>>> Thanks & Regards,
>>>> Md Juyel Haque | Sr. DevOps Engineer 
>>>> Phone No: 7047906982 
>>>> Email: [email protected] <javascript:>
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Puppet Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected] <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/puppet-users/CAH_OGbb0g3aZkoQ%2BRvcph5am_JbER73H3sXwCz%2BS%2BW3k%3Dj_%2BFQ%40mail.gmail.com
>>>>  
>>>> <https://groups.google.com/d/msgid/puppet-users/CAH_OGbb0g3aZkoQ%2BRvcph5am_JbER73H3sXwCz%2BS%2BW3k%3Dj_%2BFQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Puppet Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected] <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/puppet-users/CAABnqB-H3dhEx2bf0rL0iLgXSzqf0oi9prij_6S93bZqDO6D8g%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/puppet-users/CAABnqB-H3dhEx2bf0rL0iLgXSzqf0oi9prij_6S93bZqDO6D8g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> -- 
>>
>> Thanks & Regards,
>> Md Juyel Haque | Sr. DevOps Engineer 
>> Phone No: 7047906982 
>> Email: [email protected] <javascript:>
>>
>
>
> -- 
>
> Thanks & Regards,
> Md Juyel Haque | Sr. DevOps Engineer 
> Phone No: 7047906982 
> Email: [email protected] <javascript:>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/561f580f-1b7e-4454-975d-90e4583d92dbo%40googlegroups.com.

Reply via email to