SlideShare a Scribd company logo
1 of 15
Download to read offline
Managing multiple environments
with Ansible
Jiri Tyr
About me
● Using Ansible since 2014
● Ansible contributor
○ Modules: yum_repository , jenkins_plugin , ldap_attr, ldap_entry
○ Jinja2 filter: comment
○ Bug fixing (mount module)
○ Code reviews
● Author of more than 100 publicly available Ansible roles
○ https://github.com/jtyr
○ https://galaxy.ansible.com/jtyr
The principle of managing multiple envs
The principle of managing multiple envs
● Multiple environments (DEV, QA, STG, PRD)
● The same roles, playbooks, modules, ... in different version in different envs
● Each component has different development velocity
● Shift the components from lower to higher environments in controlled manner
DEV QA STG PRD
Role 1 t22 t10 t5 t3
Role 2 t19 t16 t11 t7
Playbook t10 t7 t4 t2
How to achieve it?
How to achieve it?
● Single monolithic Git repo?
○ No way!
● Git submodules?
○ Too tricky...
● Separate Git repos?
○ Hm...
○ What tool to use?
■ ansible-galaxy?
■ But that's only for roles! What about playbooks, inventories, modules, plugins, ...?
The solution is...
Android repo script
● Tool used for managing Android repositories
● Wrapper around Git
● Fetches whatever Git repos into a single work directory
● Individual repos stay as Git repos with all their history
● Integrates with Gerrit code review system
● Using Manifest file (XML)
○ Android Repo Manifest Management tool (armm)
Manifest file
<manifest>
<remote name="jtyr-github" fetch="https://github.com/jtyr" />
<default remote="jtyr-github" revision="master" sync-j="4" />
<project name="ansible-test_playbook" path="." />
<project name="ansible-test_role1" path="roles/role1" revision="refs/tags/t1" />
<project name="ansible-test_role2" path="roles/role2" revision="b2d50df" />
<project name="ansible-yaml_inventory" path="tools/yaml_inventory" groups="base">
<linkfile src="yaml_inventory.py" dest="hosts" />
</project>
</manifest>
How to use it?
How to use it?
# Get the repo script and make it executable
sudo curl -s 'https://gerrit.googlesource.com/git-repo/+/stable/repo?format=TEXT' | 
base64 -d > /usr/local/bin/repo
chmod +x /usr/local/bin/repo
# Create the work directory and fetch all components
export ENV=dev
mkdir -p /tmp/ansible/env/$ENV
cd /tmp/ansible/env/$ENV
repo init -u https://github.com/jtyr/ansible-repo-test_manifest.git -b $ENV
repo sync --no-clone-bundle
Repo script commands
# Show all possible repo commands
repo help --all
# List all projects
repo list
# Show which files have been modified
repo status
# Show changes across all projects
repo diff
# Sync only particular project
repo sync my_project
# Run command across all projects
repo forall -p -c 'git add -A; git commit -m "My change"; git push'
Demo time...
Summary
● Keep Ansible components in separate Git repos
● Create an extra Git repo with a Manifest file for each environment
● Use the repo script to build the work directory
Thank you for your attention!
Questions?

More Related Content

What's hot

Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code baseRobert Munteanu
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsPhilip Stehlik
 
Extending php (7), the basics
Extending php (7), the basicsExtending php (7), the basics
Extending php (7), the basicsPierre Joye
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code baseRobert Munteanu
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoMatt Stine
 
Php 7.x 8.0 and hhvm and
Php 7.x 8.0 and hhvm and Php 7.x 8.0 and hhvm and
Php 7.x 8.0 and hhvm and Pierre Joye
 
Node Web Development 2nd Edition: Chapter3 Node Modules
Node Web Development 2nd Edition: Chapter3 Node ModulesNode Web Development 2nd Edition: Chapter3 Node Modules
Node Web Development 2nd Edition: Chapter3 Node ModulesRick Chang
 
Javascript asynchronous
Javascript asynchronousJavascript asynchronous
Javascript asynchronouskang taehun
 
A day in the office of a js developer
A day in the office   of a js developerA day in the office   of a js developer
A day in the office of a js developerKrešimir Antolić
 
Profile all the things! - Capital Go 2017
 Profile all the things! - Capital Go 2017 Profile all the things! - Capital Go 2017
Profile all the things! - Capital Go 2017John Potocny
 
Coding in the context era
Coding in the context eraCoding in the context era
Coding in the context eralestrrat
 
LuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for LuaLuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for LuaIgnacio Burgueño
 
Going All-In With Go For CLI Apps
Going All-In With Go For CLI AppsGoing All-In With Go For CLI Apps
Going All-In With Go For CLI AppsTom Elliott
 
Helma / RingoJS – Vienna.js Minitalk
Helma / RingoJS – Vienna.js MinitalkHelma / RingoJS – Vienna.js Minitalk
Helma / RingoJS – Vienna.js MinitalkPhilipp Naderer
 
Javascript robotics
Javascript roboticsJavascript robotics
Javascript roboticsIbnu Triyono
 

What's hot (20)

Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code base
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
 
Extending php (7), the basics
Extending php (7), the basicsExtending php (7), the basics
Extending php (7), the basics
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code base
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
Php 7.x 8.0 and hhvm and
Php 7.x 8.0 and hhvm and Php 7.x 8.0 and hhvm and
Php 7.x 8.0 and hhvm and
 
Node Web Development 2nd Edition: Chapter3 Node Modules
Node Web Development 2nd Edition: Chapter3 Node ModulesNode Web Development 2nd Edition: Chapter3 Node Modules
Node Web Development 2nd Edition: Chapter3 Node Modules
 
Javascript asynchronous
Javascript asynchronousJavascript asynchronous
Javascript asynchronous
 
A day in the office of a js developer
A day in the office   of a js developerA day in the office   of a js developer
A day in the office of a js developer
 
Profile all the things! - Capital Go 2017
 Profile all the things! - Capital Go 2017 Profile all the things! - Capital Go 2017
Profile all the things! - Capital Go 2017
 
Coding in the context era
Coding in the context eraCoding in the context era
Coding in the context era
 
LuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for LuaLuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for Lua
 
node ffi
node ffinode ffi
node ffi
 
Modern frontend in react.js
Modern frontend in react.jsModern frontend in react.js
Modern frontend in react.js
 
Going All-In With Go For CLI Apps
Going All-In With Go For CLI AppsGoing All-In With Go For CLI Apps
Going All-In With Go For CLI Apps
 
Elastic search
Elastic searchElastic search
Elastic search
 
Node intro
Node introNode intro
Node intro
 
Helma / RingoJS – Vienna.js Minitalk
Helma / RingoJS – Vienna.js MinitalkHelma / RingoJS – Vienna.js Minitalk
Helma / RingoJS – Vienna.js Minitalk
 
Javascript robotics
Javascript roboticsJavascript robotics
Javascript robotics
 

Similar to Managing multiple environments with Ansible

Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansiblejtyr
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsGR8Conf
 
Puppet managed loadays
Puppet managed loadaysPuppet managed loadays
Puppet managed loadaysloadays
 
Puppet managed loadays
Puppet managed loadaysPuppet managed loadays
Puppet managed loadaysYankee Nemoy
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGlobalLogic Ukraine
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet systemrkhatibi
 
Creating a Mature Puppet System
Creating a Mature Puppet SystemCreating a Mature Puppet System
Creating a Mature Puppet SystemPuppet
 
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...Nicolas Brousse
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetNicolas Brousse
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansibleGeorge Shuklin
 
Drupalhagen 2014 kiss omg ftw
Drupalhagen 2014   kiss omg ftwDrupalhagen 2014   kiss omg ftw
Drupalhagen 2014 kiss omg ftwArne Jørgensen
 
Scaling Django with gevent
Scaling Django with geventScaling Django with gevent
Scaling Django with geventMahendra M
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
7 tools for your devops stack
7 tools for your devops stack7 tools for your devops stack
7 tools for your devops stackKris Buytaert
 
11 tools for your PHP devops stack
11 tools for your PHP devops stack11 tools for your PHP devops stack
11 tools for your PHP devops stackKris Buytaert
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with pythonroskakori
 
Plone Intranet under the hood
Plone Intranet under the hoodPlone Intranet under the hood
Plone Intranet under the hoodGuido Stevens
 
[scala.by] Launching new application fast
[scala.by] Launching new application fast[scala.by] Launching new application fast
[scala.by] Launching new application fastDenis Karpenko
 

Similar to Managing multiple environments with Ansible (20)

Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansible
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails Projects
 
Puppet managed loadays
Puppet managed loadaysPuppet managed loadays
Puppet managed loadays
 
Puppet managed loadays
Puppet managed loadaysPuppet managed loadays
Puppet managed loadays
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
 
Creating a Mature Puppet System
Creating a Mature Puppet SystemCreating a Mature Puppet System
Creating a Mature Puppet System
 
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with Puppet
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Drupalhagen 2014 kiss omg ftw
Drupalhagen 2014   kiss omg ftwDrupalhagen 2014   kiss omg ftw
Drupalhagen 2014 kiss omg ftw
 
Scaling Django with gevent
Scaling Django with geventScaling Django with gevent
Scaling Django with gevent
 
Go at Skroutz
Go at SkroutzGo at Skroutz
Go at Skroutz
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
7 tools for your devops stack
7 tools for your devops stack7 tools for your devops stack
7 tools for your devops stack
 
11 tools for your PHP devops stack
11 tools for your PHP devops stack11 tools for your PHP devops stack
11 tools for your PHP devops stack
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with python
 
Frameworks choice
Frameworks choiceFrameworks choice
Frameworks choice
 
Plone Intranet under the hood
Plone Intranet under the hoodPlone Intranet under the hood
Plone Intranet under the hood
 
[scala.by] Launching new application fast
[scala.by] Launching new application fast[scala.by] Launching new application fast
[scala.by] Launching new application fast
 

More from jtyr

Ansible Callback Plugins
Ansible Callback PluginsAnsible Callback Plugins
Ansible Callback Pluginsjtyr
 
Make the prompt great again
Make the prompt great againMake the prompt great again
Make the prompt great againjtyr
 
Development of Ansible modules
Development of Ansible modulesDevelopment of Ansible modules
Development of Ansible modulesjtyr
 
Best practices for ansible roles development
Best practices for ansible roles developmentBest practices for ansible roles development
Best practices for ansible roles developmentjtyr
 
Overcoming problems of the standard Ansible inventory file
Overcoming problems of the standard Ansible inventory fileOvercoming problems of the standard Ansible inventory file
Overcoming problems of the standard Ansible inventory filejtyr
 
LEGO IR Controller
LEGO IR ControllerLEGO IR Controller
LEGO IR Controllerjtyr
 

More from jtyr (6)

Ansible Callback Plugins
Ansible Callback PluginsAnsible Callback Plugins
Ansible Callback Plugins
 
Make the prompt great again
Make the prompt great againMake the prompt great again
Make the prompt great again
 
Development of Ansible modules
Development of Ansible modulesDevelopment of Ansible modules
Development of Ansible modules
 
Best practices for ansible roles development
Best practices for ansible roles developmentBest practices for ansible roles development
Best practices for ansible roles development
 
Overcoming problems of the standard Ansible inventory file
Overcoming problems of the standard Ansible inventory fileOvercoming problems of the standard Ansible inventory file
Overcoming problems of the standard Ansible inventory file
 
LEGO IR Controller
LEGO IR ControllerLEGO IR Controller
LEGO IR Controller
 

Recently uploaded

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Managing multiple environments with Ansible

  • 2. About me ● Using Ansible since 2014 ● Ansible contributor ○ Modules: yum_repository , jenkins_plugin , ldap_attr, ldap_entry ○ Jinja2 filter: comment ○ Bug fixing (mount module) ○ Code reviews ● Author of more than 100 publicly available Ansible roles ○ https://github.com/jtyr ○ https://galaxy.ansible.com/jtyr
  • 3. The principle of managing multiple envs
  • 4. The principle of managing multiple envs ● Multiple environments (DEV, QA, STG, PRD) ● The same roles, playbooks, modules, ... in different version in different envs ● Each component has different development velocity ● Shift the components from lower to higher environments in controlled manner DEV QA STG PRD Role 1 t22 t10 t5 t3 Role 2 t19 t16 t11 t7 Playbook t10 t7 t4 t2
  • 6. How to achieve it? ● Single monolithic Git repo? ○ No way! ● Git submodules? ○ Too tricky... ● Separate Git repos? ○ Hm... ○ What tool to use? ■ ansible-galaxy? ■ But that's only for roles! What about playbooks, inventories, modules, plugins, ...?
  • 8. Android repo script ● Tool used for managing Android repositories ● Wrapper around Git ● Fetches whatever Git repos into a single work directory ● Individual repos stay as Git repos with all their history ● Integrates with Gerrit code review system ● Using Manifest file (XML) ○ Android Repo Manifest Management tool (armm)
  • 9. Manifest file <manifest> <remote name="jtyr-github" fetch="https://github.com/jtyr" /> <default remote="jtyr-github" revision="master" sync-j="4" /> <project name="ansible-test_playbook" path="." /> <project name="ansible-test_role1" path="roles/role1" revision="refs/tags/t1" /> <project name="ansible-test_role2" path="roles/role2" revision="b2d50df" /> <project name="ansible-yaml_inventory" path="tools/yaml_inventory" groups="base"> <linkfile src="yaml_inventory.py" dest="hosts" /> </project> </manifest>
  • 10. How to use it?
  • 11. How to use it? # Get the repo script and make it executable sudo curl -s 'https://gerrit.googlesource.com/git-repo/+/stable/repo?format=TEXT' | base64 -d > /usr/local/bin/repo chmod +x /usr/local/bin/repo # Create the work directory and fetch all components export ENV=dev mkdir -p /tmp/ansible/env/$ENV cd /tmp/ansible/env/$ENV repo init -u https://github.com/jtyr/ansible-repo-test_manifest.git -b $ENV repo sync --no-clone-bundle
  • 12. Repo script commands # Show all possible repo commands repo help --all # List all projects repo list # Show which files have been modified repo status # Show changes across all projects repo diff # Sync only particular project repo sync my_project # Run command across all projects repo forall -p -c 'git add -A; git commit -m "My change"; git push'
  • 14. Summary ● Keep Ansible components in separate Git repos ● Create an extra Git repo with a Manifest file for each environment ● Use the repo script to build the work directory
  • 15. Thank you for your attention! Questions?