Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

mantl logrotate

TanyaCouture edited this page Feb 25, 2016 · 1 revision
  • logrotate: mantl-logrotate : This role will be broken up and placed with the separate
    components. tasks/main.yml // set logrotate interval to daily // in file /etc/logrotate.conf // look for reg expression '^weekly' // replace last matching line of reg expression with "daily" packaging solutions: sed 's/(.*)^weekly/daily/' /etc/logrotate.conf

                .*// set logrotate retention period to 7 days
                // in file /etc/logrotate.conf
                // replace last matching line of reg expression '^rotate 4' with "rotate 7"
                packaging solutions:
                  sed 's/\(.*\)^rotate 4/\rotate 7/' /etc/logrotate.conf
    
                .*// copy component logrotate configurations
                // when mesos=true docker=true and in zookeeper role == 'control'
                    // copy component to logrotate configurations
                        /etc/logrotate/component
                    // set mode to 0644
                packaging solutions:
                // call on script: when mesos and docker are installed on all nodes and zookeeper is on leader nodes, copy components to logrotate
                    script:
                       #!/bin/bash
                       for component in "mesos" "docker" "zookeeper"; do
                           systemctl status component
                              if[ $? == 0 ]; then
                                  cp component /etc/logrotate/
                                  chmod 0644 /etc/logrotate/component
                              else
                                  echo component not active
                              fi
                        done
    
                // create component archives
                    // same conditions as above
                    // copy components to archives
                        // /var/log/component/archive
                packaging solutions:
                // call on script: when mesos and docker are installed on all nodes and zookeeper is on leader nodes, copy components to archive
                script:
                   #!/bin/bash
                   for component in "mesos" "docker" "zookeeper"; do
                       systemctl status component
                          if[ $? == 0 ]; then
                              sudo cp component /var/log/component/archive
                              sudo chmod 0644 /var/log/component/archive
                          else
                              echo component not active
                          fi
                    done
    
             + 3 template files
    
Clone this wiki locally