Ask Your Question
0

file vs File and changing several lines in a exclude file

asked 2016-12-02 07:59:46 -0500

jrbast gravatar image

updated 2016-12-02 10:36:20 -0500

lupin gravatar image

When I run this, it works on those directories that exist, but fails dependency on missing directories.

Notice: /Stage[main]/Profile::Baseline::Tsm_oracle_audit_exclude/Exec[Recycle TSM]: Dependency File[/app/grid/product/11.2.0.3/rdbms/audit] has failures: true
Warning: /Stage[main]/Profile::Baseline::Tsm_oracle_audit_exclude/Exec[Recycle TSM]: Skipping because of failed dependencies

If I run a second time I get even more failed messages?

    class profile::baseline::tsm_oracle_audit_exclude {
      case $::osfamily {
        /AIX/:    { $iepath = '/usr/tivoli/tsm/client/ba/bin64/dsm.inclexcl.opt' }
        default:  { $iepath = '/opt/tivoli/tsm/client/ba/bin/dsm.inclexcl.opt' }
      }
      file { $iepath :
        ensure  => present,
      }
      $check_dirs = [
        '/opt/oracle/diag/asm',
        '/opt/oracle/diag/rdbms',
        '/app/oracle/diag/asm',
      ]
      file { $check_dirs:
        ensure  => present,
      }
      file_line { '/opt/oracle/diag/asm' :
        path        => $iepath,
        line        => 'exclude /opt/oracle/product/diag/.../*.aud',
        require     => [ File['/opt/oracle/diag/asm'], File['/opt/oracle/diag/rdbms'] ],
        notify      => Exec['Recycle TSM'],

  }
  file_line { '/app/oracle/product/diag':
    path        => $iepath,
    line        => 'exclude /app/oracle/product/diag/.../*.aud',
    require     => File['/app/oracle/product/diag'],
    notify      => Exec['Recycle TSM'],
  }
  exec { 'Recycle TSM':
    command     => '/etc/init.d/dsmmgr stop; /etc/init.d/dsmmgr start ',
    timeout     => 0,
    subscribe   => File[$iepath],
    provider    => shell,
    refreshonly => true,
  }
}
edit retag flag offensive close merge delete

Comments

`File` can only reference things that exist in your catalog.. it can not be used to find actual directories on your system. `file` is how you declare resources. I'm not 100% sure exactly what you are asking.

DarylW gravatar imageDarylW ( 2016-12-02 13:03:52 -0500 )edit

I want to add lines to a configuration file ( ie an exclude list for backup) if a directory exists

jrbast gravatar imagejrbast ( 2016-12-02 14:11:15 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-12-03 12:43:42 -0500

I want to add lines to a configuration file ( ie an exclude list for backup) if a directory exists

You have to generate your configuration file e.g. via a (shell) script.

Puppet is a declarative language. All the time you write, what state a machine is supposed to have. It's a monologue. The node itself only supplies some facts.

PS: Does stating exclude rules for non-existent files break the configuration?

edit flag offensive delete link more
0

answered 2016-12-02 14:10:18 -0500

jrbast gravatar image

I want to add lines to a configuration file ( ie an exclude list for backup) if a directory exists

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-02 07:59:46 -0500

Seen: 35 times

Last updated: Dec 03 '16