LINUX.ORG.RU

История изменений

Исправление php-coder, (текущая версия) :

Я ставил почти также:

class server::java {

  # see http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
  apt::ppa { 'ppa:webupd8team/java':
  }

  # see for details:
  # http://www.markhneedham.com/blog/2013/04/18/puppet-installing-oracle-java-oracle-license-v1-1-license-could-not-be-presented/
  # http://ppa.webupd8.org/post/31403143302/oracle-java-ppa-some-info
  exec { 'Accept Oracle license':
    command => "echo 'debconf shared/accepted-oracle-license-v1-1 select true' | debconf-set-selections",
    path    => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
    unless  => "test \"$(debconf-get-selections | grep 'oracle-java7-installer\\s\\+shared/accepted-oracle-license-v1-1' | awk '{print \$4}')\" = 'true'"
  }

  class { '::java':
    distribution          => 'oracle-jdk',
    version               => 'present',
    package               => 'oracle-java7-installer',
    java_alternative      => 'java-7-oracle',
    java_alternative_path => '/usr/lib/jvm/java-7-oracle/jre/bin/java',
    require               => [
      Apt::Ppa['ppa:webupd8team/java'],
      Exec['Accept Oracle license']
    ]
  }

}

Правда понадобится puppet:

$ cat install-puppet.sh
#!/bin/sh
#
# Install puppet client from http://apt.puppetlabs.com/
# See for details: http://docs.puppetlabs.com/guides/puppetlabs_package_repositories.html#for-debian-and-ubuntu

CODENAME="$(lsb_release -c | awk '{print $2}')"
PACKAGE="puppetlabs-release-$CODENAME.deb"
wget -- "http://apt.puppetlabs.com/$PACKAGE"
dpkg -i "$PACKAGE"
rm -fv -- "$PACKAGE"
apt-get update
apt-get -y install puppet

И парочка модулей к нему:

$ cat fetch-modules.sh
#!/bin/sh

if [ ! -d "$PWD/modules" ]; then
	mkdir -p "$PWD/modules"
fi

if [ ! -d "$PWD/modules/apt" ]; then
	puppet module install --target-dir="$PWD/modules"  --version '1.4.0' puppetlabs-apt
fi

if [ ! -d "$PWD/modules/java" ]; then
	puppet module install --target-dir="$PWD/modules"  --version '1.1.0' puppetlabs-java
fi

Запускать так:

# puppet apply --modulepath="$PWD/modules" --verbose server/java.pp

Исходная версия php-coder, :

Я ставил почти также:

class server::java {

  # see http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
  apt::ppa { 'ppa:webupd8team/java':
  }

  # see for details:
  # http://www.markhneedham.com/blog/2013/04/18/puppet-installing-oracle-java-oracle-license-v1-1-license-could-not-be-presented/
  # http://ppa.webupd8.org/post/31403143302/oracle-java-ppa-some-info
  exec { 'Accept Oracle license':
    command => "echo 'debconf shared/accepted-oracle-license-v1-1 select true' | debconf-set-selections",
    path    => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
    unless  => "test \"$(debconf-get-selections | grep 'oracle-java7-installer\\s\\+shared/accepted-oracle-license-v1-1' | awk '{print \$4}')\" = 'true'"
  }

  class { '::java':
    distribution          => 'oracle-jdk',
    version               => 'present',
    package               => 'oracle-java7-installer',
    java_alternative      => 'java-7-oracle',
    java_alternative_path => '/usr/lib/jvm/java-7-oracle/jre/bin/java',
    require               => [
      Apt::Ppa['ppa:webupd8team/java'],
      Exec['Accept Oracle license']
    ]
  }

}

Правда понадобится puppet:

$ cat install-puppet.sh
#!/bin/sh
#
# Install puppet client from http://apt.puppetlabs.com/
# See for details: http://docs.puppetlabs.com/guides/puppetlabs_package_repositories.html#for-debian-and-ubuntu

CODENAME="$(lsb_release -c | awk '{print $2}')"
PACKAGE="puppetlabs-release-$CODENAME.deb"
wget -- "http://apt.puppetlabs.com/$PACKAGE"
dpkg -i "$PACKAGE"
rm -fv -- "$PACKAGE"
apt-get update
apt-get -y install puppet

И парочка модулей к нему:

$ cat fetch-modules.sh
#!/bin/sh

if [ ! -d "$PWD/modules" ]; then
	mkdir -p "$PWD/modules"
fi

if [ ! -d "$PWD/modules/apt" ]; then
	puppet module install --target-dir="$PWD/modules"  --version '1.4.0' puppetlabs-apt
fi

if [ ! -d "$PWD/modules/java" ]; then
	puppet module install --target-dir="$PWD/modules"  --version '1.1.0' puppetlabs-java
fi

Запускать так:

# puppet apply --modulepath="$PWD/modules" --verbose server/java.pp "$@"