19
Deployment orchestration Jan Collijs February 2, 2015

Deployment orchestration

Embed Size (px)

Citation preview

Page 1: Deployment orchestration

;

Deployment orchestrationJan Collijs

February 2, 2015

Page 2: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

Table of contents

1 Introductionwhoami

2 Backgroundprojectversioningcontinuous integrationpackagingrepository management

3 Configuration managementpuppetpuppetdb

4 Orchestrationansibleautomationonline-material

5 Questions

Jan Collijs Deployment orchestration

Page 3: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

whoami

Profile

SysadminLinux & Open-Source enthusiastConsultant for inuits.eu

@visibilityspots

Jan Collijs Deployment orchestration

Page 4: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

projectversioningcontinuous integrationpackagingrepository management

University library of Ghent

• 5 developers• devops integration• New website• 2 environments: dev/prod

Jan Collijs Deployment orchestration

Page 5: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

projectversioningcontinuous integrationpackagingrepository management

Versioning

• Software code is based into a repository• History of changes is available• Collaboration• Hooks• Many tools available (git, redmine, gitlab, chili project, . . . )

Jan Collijs Deployment orchestration

Page 6: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

projectversioningcontinuous integrationpackagingrepository management

Jenkins

• Automation tool• Triggered by hooks• Custom scripts

Jan Collijs Deployment orchestration

Page 7: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

projectversioningcontinuous integrationpackagingrepository management

Jenkins flow example

Jan Collijs Deployment orchestration

Page 8: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

projectversioningcontinuous integrationpackagingrepository management

fpm/rpmbuild

• fpm• spec file• rpmbuild

Jan Collijs Deployment orchestration

Page 9: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

projectversioningcontinuous integrationpackagingrepository management

Yum-repo-server

• Repository management• One repository per environment (dev/prod)• Only used for own software• Vagrant setup

Jan Collijs Deployment orchestration

Page 10: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

puppetpuppetdb

Puppet

• Configures ALL servers and services• Hiera• Roles & profiles• Custom module for every piece of software• Cron based runs

Jan Collijs Deployment orchestration

Page 11: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

puppetpuppetdb

Puppetdb

• Consists puppet data (postgresql DB)• Query API (experimental v4)

Jan Collijs Deployment orchestration

Page 12: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

puppetpuppetdb

Query puppetdb

# Look up the nodes which have the given resource type and name declaredfor NODE in $(curl --silent -G https://PUPPETDB_HOST:PUPPETDB_PORT/v4/ \environments/ENVIRONMENT/resources/TYPE/RESOURCENAME | grep certname | \awk -F ’:’ ’{print $2 }’ | cut -d ’‘‘’ -f2)

donodes=(’’${nodes[@]}" $NODE)

done

Jan Collijs Deployment orchestration

Page 13: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

ansibleautomationonline-material

Ansible

• Based on ssh• No agent on the servers• User on the clients with public key and sudo rights

Jan Collijs Deployment orchestration

Page 14: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

ansibleautomationonline-material

Dynamic inventory script

• Static inventory• Dynamic inventory(https://github.com/visibilityspots/ansible-puppet-inventory)

• Pypuppetdb lib(https://github.com/puppet-community/pypuppetdb/pull/34)

• Dynamic inventory ansible core(https://github.com/ansible/ansible/pull/9593)

Jan Collijs Deployment orchestration

Page 15: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

ansibleautomationonline-material

Deploy puppet run

• Jenkins• puppet-check script (https://github.com/visibilityspots/ci-scripts/blob/master/puppet/puppet-check.sh)

Jan Collijs Deployment orchestration

Page 16: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

ansibleautomationonline-material

Code

for NODE in "${nodes[@]}"do

echo "Process $NODE:"echo ""ansible $NODE -a "puppet agent --test" --sudo;echo "======================================="

done

Jan Collijs Deployment orchestration

Page 17: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

ansibleautomationonline-material

Console output

Jan Collijs Deployment orchestration

Page 18: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

ansibleautomationonline-material

online material

• http://visibilityspots.com/ansible-orchestration.html• https://github.com/visibilityspots/ansible-puppet-inventory• https://github.com/visibilityspots/ci-scripts

Jan Collijs Deployment orchestration

Page 19: Deployment orchestration

;

IntroductionBackground

Configuration managementOrchestration

Questions

Questions

Jan Collijs Deployment orchestration