Skip to content
Snippets Groups Projects
nginx.pp 1.28 KiB
Newer Older
  • Learn to ignore specific revisions
  • Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
    # intelligent comment here
    class egg::nginx () {
      $hostname = fact( 'networking.fqdn' )
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
      $hostalias = ['teman.it.liu.se', 'ntadigital.it.liu.se', 'egg.it.liu.se']
      profiles::letsencrypt::cert { $hostname :
        addn_domains => $hostalias
      }
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
      package { 'nginx':
        ensure => 'installed',
      }
      # inserf conf. files here
    
      file { '/etc/nginx/nginx.conf':
        ensure => 'file',
        source => "puppet:///modules/${module_name}/nginx.conf",
        notify => Service['nginx'],
      }
    
    Henry Fröcklin's avatar
    Henry Fröcklin committed
      file { '/etc/nginx/conf.d/egg.conf':
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
        ensure   => 'present',
        content  => epp("${module_name}/egg.conf.epp", {
          cert_name => $hostname,
        }),
        notify   => Service['nginx'],
        require  => Package['nginx'],
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
      }
    
      # Housekeeping
      service { 'nginx':
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
        ensure => 'stopped',
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
        enable => true,
      }
      firewalld_service { 'Allow http in the liu Zone':
        ensure  => present,
        zone    => 'liu',
        service => 'http',
      }
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
      firewalld_service { 'Allow https from liu Zone':
        ensure  => present,
        zone    => 'liu',
        service => 'https',
      }
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
      firewalld_service { 'Allow http in the public Zone':
        ensure  => present,
        zone    => 'public',
        service => 'http',
      }
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
      firewalld_service { 'Allow https from public Zone':
        ensure  => present,
        zone    => 'public',
        service => 'https',
      }
    
    Nils Olof Paulsson's avatar
    Nils Olof Paulsson committed
    }