Development with Ansible and VMs

Video in TIB AV-Portal: Development with Ansible and VMs

Formal Metadata

Development with Ansible and VMs
Title of Series
Part Number
Number of Parts
CC Attribution - ShareAlike 4.0 International:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
Release Date

Content Metadata

Subject Area
How do you set up a kick-ass dev environment? I'll share our team's setup and tools that give us a dev environment with superpowers: mirrors production; sets itself up with a single command; documented in code; repeatable and shareable. I hope you learn something you can put into action tomorrow!
Laptop Boss Corporation Standard deviation Game controller Building Code Closed set Projective plane Electronic mailing list Bit Code Power (physics) Product (business) Software bug Process (computing) Integrated development environment Term (mathematics) Cuboid Configuration space Right angle Damping Series (mathematics) Physical system Social class
Point (geometry) Closed set Gender Projective plane Virtual machine Web browser Instance (computer science) Entire function Neuroinformatik Number Revision control Mathematics Word Computer animation Integrated development environment Software Cuboid Right angle Physical system
Standard deviation Open source Virtual machine 1 (number) Set (mathematics) Bit Line (geometry) Number Neuroinformatik Revision control Medical imaging Computer animation Software Different (Kate Ryan album) Cuboid MiniDisc Energy level
Point (geometry) Computer file Code Multiplication sign Virtual machine Bit Canonical ensemble IP address Number Revision control Mathematics Arithmetic mean Computer animation Software Personal digital assistant Term (mathematics) Cuboid Configuration space
Scripting language Key (cryptography) Code Block (periodic table) Cellular automaton Execution unit Incidence algebra Configuration management Mereology Formal language Neuroinformatik Revision control Mathematics Goodness of fit Computer animation Integrated development environment Different (Kate Ryan album) Computer configuration Cuboid Quicksort Reading (process) Physical system
Group action INTEGRAL Code State of matter Multiplication sign Source code Water vapor Data dictionary Formal language Mathematics Lattice (group) Different (Kate Ryan album) Atomic number Computer configuration Cuboid Series (mathematics) Physical system File format Software developer Electronic mailing list Bit Maxima and minima Virtualization Instance (computer science) Measurement Data management Order (biology) Configuration space Right angle Quicksort Virtual reality Inverter (logic gate) Slide rule Functional (mathematics) Game controller Computer file Web browser 2 (number) Template (C++) Power (physics) Product (business) Revision control Term (mathematics) Natural number Touch typing Energy level Codierung <Programmierung> Standard deviation Multiplication Gender Idempotent Projective plane Directory service Line (geometry) Configuration management Word Kernel (computing) Integrated development environment Personal digital assistant Radio-frequency identification Video game
Evelyn Pinching Lecture/Conference Multiplication sign Office suite
the question I'm just on the National CTO Okinawa take my boss's job so small that obligation that I have that some stupid said we thank you so much for the posting legally yeah I would tell you a bit about the development of advanced low and the ends on this is useless without where we do at my company choose 1 and so I can go through how to set things up and why we think it's pretty great of so let's take a look at what we're going to learn today I was start by a try to understand what is about the environment I know only actually looking for what I wish list but in terms of what makes a really great that environment but we're going to look at some environment tools have we create the right environment for code to live that money and I wanna talk about configured tools on and how we set up that environments to run the code that we wanted to have all the packages we need to handle that up and can check in on what we learned today and so I hope you begin learn something leaving but in practice my with this we found Ansel I and developing Indians a class so purely unstressed with what is it better than environment where we looking for I'm at all on that uh in in building that that environment in running our code unsolicited wish right we started with an environment the standard that's right if we have a known baseline I had that means there are no surprises and so on so there I'm and we want to be repeatable also I for the standard environment is repeated this there's a lot of power and we can spin up and down environments I if we do some crazy to and we don't like what we've done like we install an extra package by hand and I I don't wanna do it that even possible and we created from scratch cs standardized it's repeatable I you can build to them and run them side by side if someone has to use your laptop you can just get a new laptop and with a few commands of the upper money again with here for that environment just as you left it just those 2 things together can be really powerful but is not wanted to be isolated and so this means we have complete control over what packages are running in that environment I you know let's say that you want i j 1 . 5 for a slightly older project the running and then you are an no 1 . 7 I see where on today I had for a personal passion project in a different environment with with these isolated environments you can 1 1 and 1 or the other and the other I have been known that we also wanna be allowed to isolate system packages I still etc. projects needs PostScript as 8 series A . 4 and the other 1 needs 9 . 3 I assume accomplish that as well if it's really truly fully Iceland that'll looking for it the I want all of them to be as like production as absolutely possible and with a production only bug knows the that causes I'm the best way to avoid that is you make sure that you're I don't environment is as absolutely picture but close to your production environment has as possible I'm a little bit fanatical about that myself and so that means we need we need to put in control over how our code running that means we need to control what OS it's running it we need to control what system packages are available when users a set up on that box everything so that's that's on our wish list and the the that you know you're running a production like environment you wanna use your troops right if productive maybe and that person use sublime maybe you like to run at a boon to the deadly in and then more emacs whatever it is whatever the tools that is usually use that so you can be fully productive while still running a coding in the most production like environment possible right so that's worthless and finally if we have this we also wanted to be shown all right so we have a new person joined the team that we're working on the code to do but they should benefit from all this as well as cerebellar just hand them something and go after the races I'm so that's all wishlist how are we going to do it
so the standard about environment tools has to the use of the tools that are going to consider that baseline environment and you've got a of pain
this is for installing Python packages I'm not really going to its uh because that's not really the point it upwards use it and you should keep using its projected on pair leads us to virtual and for which you also probably heard of if you have been the python word for a little while I'm going and up isolated Python versions and Python packages for those versions I so this is where I can allow you had to run in python 2 7 in 1 environment and Python 3 3 in a different environment had to run gender 1 . 5 in 1 place and 1 . 5 and 1 . 7 another place and and all that is really great but I don't do it doesn't go far enough on and that's where the civilians really come into play so let's talk about what the BN is an if you're not familiar with that of the instance for virtual machine and basically it's a little tiny computers running inside the computer and so it's all nodes ritualizing entire computer running inside a computer and I have 1 running right now on my computer and and so with this does really is In that computer inside the computer you can isolate everything right you can set up to be its own less right so we run our production environment is not going to like and so on M 1 developing is willing to bet if you can see the top of my mac book you know I'm running my stuff on Mac so doesn't have to match you get to set it up that so that the M with your own whatever you need whatever system packages you need all of that kind of stuff and this is how you isolate so the entire box I'm serious and you get your Python packages isolated year system packages isolated I get it as close to production as possible and now if you don't use and you might be wondering how does this work so only about that and you know what I want to run this on a box and then still kind of seamlessly users I my Mac system had to edit things that it sets up a really easy networking between them so they can open up a Web browser open up whatever is running on the guest on little machine inside the machine on hinted at in nearest folders so you're able to say this is my project folder I exactly neared between my machine and a machine within the machine I'm an antigen numbers reflected in so many other back and forth and which is how well you use in your edit on your or less have those changes happen literally simultaneously on the little tiny IBM and of running gender their generous use those changes reloads are happens automatically it's racing once it's it's really fun on so that the ends of immortality through a little bit kind what
our set up is I had a number of different ways to do this I'm going do what we do we use to tools here I is called virtual box and the other is vagrants under both free and open source and really wonderful and analyze ritualized pretty much anything on VirtualBox is the thing that actually runs the virtual computer the virtual machine and they provide some really nice command-line interfaces actually working with virtual box and so on that what that looks like and so
as super basic level I had this it is how you would set up your kind of babies 1st via machine and you download those 2 packages as you do I get them installed you can take the vitamins in its annual specifying press precise 64 version of 2 and they're actually hosts a bunch of these kind of basic boxes if you have a disk image that you wanna use yourself you can do that too of course but they have a bunch of standard ones and makes really easily up and running with them he did not any instead as the machine gets and without sets of all the networking of all the basic stuff and you have a running computer on and then the last 1 billion stage allows you to asses agents that box your full access to it right from the and so it's really that simple it's 3 lines and because that's just the kind of basic starting-point slowly working through a bit I have we got a the and set up on a of
line-by-line in 2nd year obstetrical thing here and this is the mean and the couple changes for you know TV magic happen basically this is all that we really have that choose to to configure virtual machine and this files columbarium file it so it's where you use to tell their kind of your configuration for that box ends this I recommend you generally want to check into version control of so you can't have 1 standard the version that you can share with your team and so at let me walk you through this so we start out with at community embarks equals that 1 that you saw that in the previous step and this is how you would specify income or canonical way I can share with your teen points to the right box if you don't have a systolic if somebody that you may just put down the code that and is using the it will know where to go and get that box entitled start for you I so that makes that really easy and those so that's a network in a host name and then on a private network with a static IP at 10 or 100 in this case I'm and that means that you can access the virtual machine and IP address and there there's all that's of for all that kind of networking anarchy stuff on the voice you on this last bit down here the axons also get into this a little bit more on that in a few minutes but basically you tell which provision means you can use any of a number of them in this case reusing and so will set up the box and you pointed to a playbook which is kind of danceable terms for at that time but the entry point for the for the orientable configuration on so it is at the top now about this but this is how I have on uh on individual value basically tell how to set up this machine I it's really that simple that really is pretty much all we have the so let's talk a
little bit about the configured tools and so this is where we talk
about configuration management on and what the configuration of if you know used any of these was before a bistable what you're doing is you're defining how the system gets set up from top to bottom I'm so that we can the onset of Canada to bootstrapped with that of last year running a box now i configuration management is that last piece where you're saying OK from the last where we had set up we impose we need this version of Python we need these users on the box we need that you know all that kind of stuff I had this is the tool that you used to do it and this is a the key for me I you write this all in code and gamble molar dance some sort of a language like that and this is really important so because it means it's documented in its versions and if you're a if if it's not clear to you in your teammates how to set up a new box uh to run in that environment everyone's running slightly different stuff you know until about is reproducible you know guarantee that your team they can help you out you have no guarantee that even you can reproduce it under different circumstances of everything's documented everyone knows exactly what's going on at its version so as you make changes to the code of the dependencies those are captured there in history it's really beautiful things I am I is also shovels now your team it can all get in on this you can share really easily and so on let's talk about and all these
tools in this ecosystem on 2 these are 2 different and sort of computing had configuration management options Shaphan part that have been around a while they're both written in Ruby that incident cells that have both written in Python and discovered the new kid on the block I am and that's just please don't it's a has better nothing against good that there were no options and is not that big a star on embarrassed scripting is in the other piece to maintain and so I can recommend that I'm not going to go away and I had to know the reasons why we're using ancillary now on that's kind of outside the scope of this talk will be my copy for that and but if you thought about that after the talk or whatever you can come by me on well I will say is answerable has been a very good to us it's written by of your need to dig into the internals for something I have that a dual I just I tried Ireland and interval is is much so we'll leave it at that for now on and there can knowing knowing you hear about at school so what's the and and go through kind of a basic example of what an bill that set up would look like I'm so don't read this units
versatility at but this is not the entirety of I also played consonant using and civil and so we split our system into multiple different things right we have 1 of these files for post as we have 1 for the i where this we have 1 your supervisor in all of these different kind of baseline things that we want to set up we have a different file foreign Ansel and you can organize things that way I to a Python 1 because this is kind of a pipe on the sort of place and because it's a really good example of how as a simple triple this can't be happening so very powerful answer so let's start looking at this 1 at baseline and is is a series of steps that you want to do that means that there's a lot of competition built around but really at the end of the day and was just a series of steps that you put into a gamble files on and these names these are just kind of human readable definitions of what you're doing step by step so these were not file that you use on long ago I'm going to go through these 1 by 1 of the the high-level what we trying to do and we're going to install some basic system of packages was going to get hit virtualenv can construct on the system that goes up to the emergence of women start reading in our requirements . txt file and invertible touch of luxury wood and couple accuracy file that that when the SSH into the box using the current and that these will activate the virtualenv and CD into the a project directory there were all kind ready to go in the right place at every time that we SSH the box so let's look at is 1 by 1 and so for instance system packages listed look at this it starts with on this line APT package equals crazy Costa and state installed I've so and so that world works is it has all these kind of our understandings of what different system as system where options or so in this case it knows what a pity is it's a package manager it knows how to interact with it so you have this really nice shorthand for saying is the package around and I want installed not just go do that and so on and it does that in a way that is a item uh if you if I have with configuration management stuff right the word I'd important is just a fancy word for saying what it will do the thing once and have a tries to do it again but knows that it's already been done it will do the work twice we right I'm surprised with this road did it make sure the packages are installed but if you go through run the configuration again it won't be in solemn or anything silly like that it's only those that of course but I'm lots of the other are in school tools will handle that item potency for you uncertain whether these double curly braces this is a really interesting thing and really powerful tool with and so if you look at this next slide up with items so basically what you're doing is you're giving a list in this case Python I found out I found that I have a maximum of that axis steep but and you're saying I do that action that APT thing with each of these items on and what is doing is actually rendering that line that as a rule of many 10 template the the APT line on and it was not like doing those template in language because it actually writing assembly-language language technically it's actually using ginger under the hood but if you know genders temple language you'll feel at all and so this is taking into those atoms number 1 the men and doing the APT installed for each on and then we see that the clan because that's what she added to I'm so that is how installing out some standard system other packages defensible pretty straightforward step 2 were going to do Chuck pick up and virtualenv and and as you can see and the same would answer well understands ready pt is insulin also build didn't understand what it is and how they interact with pet on you know as and we installed in the pit package in our last step so those are the kind of the system the system packages OPT installed its version of that and there will also don't people can update itself and we 1 of the work with the latest version of that the amount at a version of virtual and installed and we use that to do both of those things can get baseline set up on our system again so here we've got 2 options were saying being equals codebases again and I was saying because integrals codebases again so this is using without instead in a slightly more advanced format so here we're defining i'd dictionaries instead of just a straight list so that was the dictionaries as tons of power and in terms of how with items works but there are lots of create things you can do this obviously makes a pretty clean to encapsulate paying a certain package certain version and having it handle all of that so once you've done this we know we have a version of it that we expect to have the relational virtual and that we expect to have I want the next step which is to install requirements . txt and so you can see using PET again but this time the of different way have the same way you know you can start with the requirements file or you can install a straight a package using that interval understands those 2 functions as well so in this case we use it as specifying requirements filed by individual and that we want to use that it knows how to do that it does all of a thing for us and and packaging of obviously this step might take a little while and but it knows how to do that it handles everything for you so that's that's pretty straightforward 1 the the last step as a that little bit of will next have I'm willing to add a couple lines to Abacha C 5 1 and we use this new to uh and source of water ways of working with files on the system as you might you might expect this one's called my new file which does pretty much what it sounds like it make sure that this line is in this file so willing to do the destination and say we're talking about this dispatcher see file and once again we're using this kobe thing in order to make sure that this these lines are the back I and the items that were doing was going to act the virtual environment like said and when the change directories into our project directory so every time we made an SSH into this box these things happen automatically from lecture see file and like I said the idempotency applies here again when file knows how to search through that file make sure that it's not duplicating those lines so as not having those every time you figure it make sure that if they're not adds them pretty straightforward I'm so that's really all that is is I'm and I I would be I think they know that is really simple really readable and also pretty powerful right to have that now documented in code the hand that share with the rest the teams I think is really powerful thing and so we do this with postgraduate years were lattice reduces Soros supervisor a bunch of other things to get the system up and up and running around the so
let's talk uh let's let's go back and see remind show that but can how magical I feel like this is especially in our ongoing and a developer into your team that working together with them it's really important to me to make sure that they get up and running fast they can feel ownership of the code on day 1 and this makes that really possible so let's walk through just a day in the life the 1st day of someone joining RT and the standards of what's in and that takes a few minutes but no big deal you get kernel positive no big deal and you take me going up and that's Gösta would measure bed that's a really really close to all you have to do I do it on a step that step that they are not it's doing stuff it does take a lot of but it really is about as simple as that and you're up and running with a toll the working version of choose and it does everything you want like in the running you can open up in a browser uneven nature is the currency it immediately represented in a browser the working environment it's pretty so going to have a wish list and and supervision I want to be standardized so we've we stand as a set up with with code we've written in our down encodes so it's all standardized across all of our team I it's repeatable you state bigger up and you've got a new box it's isolated at the OS level of the system baggage level at the Python level and level it's a totally isolated environment that we have complete control of i is as close to production as we can possibly make it but it's still it's to use your tools as you're working you added no that's and you can show that the teeming get them up to speed in almost no time on so I think this is pretty good I would be a
great uh and Jeff uh a really you taking the time to was enormous have pinch usual quickly that paper would be and this is this is my company I we do lunches so if you have lunches at your and your office when you want to do that we cannot be do that get in touch on but that's it that you so much How clean I do I need be