Skip to content

Instantly share code, notes, and snippets.

@carthik
Last active December 23, 2015 11:19
Show Gist options
  • Select an option

  • Save carthik/6627923 to your computer and use it in GitHub Desktop.

Select an option

Save carthik/6627923 to your computer and use it in GitHub Desktop.

Revisions

  1. Carthik Sharma revised this gist Sep 19, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -33,9 +33,9 @@ use:
    # to purge
    class { 'yum::repos':
    purge_everything => true,
    $config => <something>,
    $config => 'foo',
    }
    # to not purge
    class { 'yum::repos':
    $config => <something>,
    $config => 'foo',
    }
  2. Carthik Sharma revised this gist Sep 19, 2013. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -26,4 +26,16 @@ class yum::repos (
    }

    create_resources(yumrepo, $repo_config, $defaults)
    }

    =========
    use:
    # to purge
    class { 'yum::repos':
    purge_everything => true,
    $config => <something>,
    }
    # to not purge
    class { 'yum::repos':
    $config => <something>,
    }
  3. Carthik Sharma revised this gist Sep 19, 2013. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    class yum::repos (
    $config = undef,
    $purge_everything = false,
    ) {

    $defaults = {
    @@ -9,10 +10,12 @@ class yum::repos (
    'require' => File['/etc/yum.repos.d'],
    }

    # Remove all unmanaged repos
    file {'/etc/yum.repos.d':
    recurse => true,
    purge => true,
    # Remove all unmanaged repos if we want to purge everything
    if $purge_everything {
    file {'/etc/yum.repos.d':
    recurse => true,
    purge => true,
    }
    }

    if $config == undef {
  4. @jsabo jsabo created this gist Sep 19, 2013.
    26 changes: 26 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    class yum::repos (
    $config = undef,
    ) {

    $defaults = {
    enabled => '1',
    gpgcheck => '0',
    priority => '20',
    'require' => File['/etc/yum.repos.d'],
    }

    # Remove all unmanaged repos
    file {'/etc/yum.repos.d':
    recurse => true,
    purge => true,
    }

    if $config == undef {
    $repo_config = hiera_hash('yum::repos', undef)
    }
    else {
    $repo_config = $config
    }

    create_resources(yumrepo, $repo_config, $defaults)
    }