User Tools

Site Tools


devops:puppet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devops:puppet [2016/04/18 09:21] – [Glossary] skipidardevops:puppet [2023/11/01 07:15] (current) – ↷ Page moved from camunda:devops:puppet to devops:puppet skipidar
Line 1: Line 1:
 ===== Puppet ===== ===== Puppet =====
  
-a==== Glossary ====+The Learning VM TUtorial is here: https://kjhenner.gitbooks.io/puppet-quest-guide/content/quests/application_orchestrator.html 
 + 
 +Te learning VM is available here: https://puppet.com/download-learning-vm 
 + 
 + 
 +==== Glossary ====
  
  
Line 43: Line 48:
  
 </WRAP>| </WRAP>|
 +| defined resource types | like classes, but appliable to nodes multiple times  |
 |node definition | The task of configuring which classes will be applied to a given node - is called **node classification**. \\ Node definitions are a puppet concept to write node classification down. | |node definition | The task of configuring which classes will be applied to a given node - is called **node classification**. \\ Node definitions are a puppet concept to write node classification down. |
 |.pp manifests|<WRAP>  |.pp manifests|<WRAP> 
Line 177: Line 183:
 </code> </code>
  
 +
 +==== Defined Resource types ====
 +
 +  * Use **define** keyword instead of **class**
 +  * **$title** is a special variable, which must be unique on a node and is mandatory
 +  * Binding of parameter variables ($content, $password) to values happens in parallel, meaning that you cannot use the value of one parameter to set another. The exception is the $title variable.
 +
 +
 +# /etc/puppetlabs/code/environments/production/modules/web_user/manifests/user.pp
 +<code>
 +define web_user::user (
 +  $content  = "<h1>Welcome to ${title}'s home page!</h1>",
 +  $password = undef,
 +) {
 +  $home_dir    = "/home/${title}"
 +  $public_html = "${home_dir}/public_html"
 +  user { $title:
 +    ensure   => present,
 +    password => $password,
 +  }
 +  file { [$home_dir, $public_html]:
 +    ensure => directory,
 +    owner  => $title,
 +    group  => $title,
 +    mode    => '0755',
 +  }
 +  file { "${public_html}/index.html":
 +    ensure  => file,
 +    owner   => $title,
 +    group   => $title,
 +    replace => false,
 +    content => $content,
 +    mode    => '0644',
 +  }
 +}
 +</code>
 +
 +**Declaration** of users on a node. \\
 +'shelob', 'frodo' are the titles of the users, which may be references via the **$title** variable
 +
 +# /etc/puppetlabs/code/environments/production/modules/web_user/examples/user.pp
 +<code>
 +web_user::user { 'shelob': }
 +web_user::user { 'frodo':
 +  content  => 'Custom Content!',
 +  password => pw_hash('sting', 'SHA-512', 'mysalt'),
 +}
 +</code>
  
 ==== Classes Metaparameter ==== ==== Classes Metaparameter ====
Line 270: Line 324:
 defines the default node configuration. defines the default node configuration.
  
 +==== Node setup ====
 +
 +Puppet master provides a bash script for setting up nodes:
 +<code>
 +curl -k https://<master.example.com>:8140/packages/current/install.bash | sudo bash
 +</code>
 +
 +Puppet MASTER keeps signed certificates of each Node, which is a part of the infrastructure.
 +To involve a node - sighn its certificate.
 +
 +List all unsigned certificates of Nodes. Executable on master.
 +<code>
 +puppet cert list
 +</code>
 +
 +Sign a certificate of node named **webserver.learning.puppetlabs.vm **
 +<code>
 +puppet cert sign webserver.learning.puppetlabs.vm
 +</code>
  
 ==== Variables ==== ==== Variables ====
Line 600: Line 673:
 yamldir = /opt/puppetlabs/puppet/cache/yaml yamldir = /opt/puppetlabs/puppet/cache/yaml
 </code> </code>
 +
 +
 +
 +===== Orchestration =====
 +
 +Details are here: https://kjhenner.gitbooks.io/puppet-quest-guide/content/quests/application_orchestrator.html
 +
 +Orchestration allows to install dependent applications in the right order.
 +
 +It works as following:
 +  - setup the node to know the orchestrator
 +  - create an Application, which may combine multiple nodes to a single semantical unit (MySQL Server, Apache with PHP application )
 +    - setup orchestrator user with the rights
 +    - setup an **artificial, public resource** to share the data between nodes (**in ruby**)
 +    - define, which node **produces** data to fill artificial, public resource. Which node consumes data from artificial, public resource.
 +    - declare the resource
 +    - in site.pp declare - which part of the application will be installed on which node.
 +
 +{{http://i520.photobucket.com/albums/w327/schajtan/2016-04-25_14-27-49_zpsphhbuy9w.png}}
devops/puppet.1460971284.txt.gz · Last modified: (external edit)