Introduction to Ansible Transcripts
Lecture: Working with Ansible
0:00 Like any software development tool
0:01 Ansible pairs really well with strong reference material.
0:04 I keep a few tabs open whenever I'm developing
0:07 my Ansible playbooks.
0:08 I'll show them to you now.
0:09 You shouldn't need them while you're working
0:11 through these videos, but if you want to take a breather
0:13 or want to dive deeper into a subject
0:15 find out more about a module
0:16 it can be really handy to keep these open.
0:18 We just looked at the Github repository for Ansible
0:21 at github.com/ansible/ansible.
0:24 I bring it up again now because there are a few
0:26 directories that are more important than the other ones.
0:30 Specifically, lib/ansible - this is where the majority
0:33 of the source code for Ansible lives and in particular
0:37 you'll want to look under the modules directory
0:39 because these modules are going to be what's doing the work
0:42 every time you write a playbook.
0:43 For example, if you want to send notifications
0:45 when you hit a certain step
0:47 or something happens in your playbook
0:48 take a look under the notification module
0:50 and you'll see all the source code
0:52 for every different type of notification and integration
0:54 that you can apply in your playbook.
0:56 I'm constantly referencing the Ansible source code
0:58 not because the documentation isn't good
1:00 but just because sometimes its easiest
1:02 to read the source code
1:03 especially if you're a Python developer.
1:05 Speaking of Ansible documentation, it's fantastic
1:07 and you can access it at docs.ansible.com.
1:10 It's broken into many areas
1:11 the one that can be most useful to you right now
1:13 is under 'Getting Started.'
1:16 You can read this to get some context
1:17 about how Ansible works over SSH.
1:20 It's handy just in case you want a secondary resource.
1:21 Also under 'Documentation,'
1:23 you can gain additional context about
1:24 playbooks, inventory files, and developing your own modules.
1:28 The one option that I always keep opened though
1:31 is the module index.
1:33 This is the master guide
1:35 for everything you can implement with Ansible
1:37 without having to write your own custom modules.
1:39 We saw how to create directories and files
1:41 with an example Ansible playbook.
1:43 If you want to learn more about file module
1:46 you go under 'Files modules,'
1:48 and select 'File.'
1:50 My favorite part of the Ansible modules documentation
1:53 is that it follows a very clear boiler plate pattern
1:56 you've got a quick synopsis
1:57 all of the parameters that are available to you
1:59 some notes just in case there are exceptions
2:02 or things you need to be aware of
2:04 with different operating systems
2:05 and then he handiest bit of all
2:07 I'm actually surprised every single bit of documentation
2:10 for every project does not contain this
2:11 example code.
2:12 Example code, you can copy and paste
2:14 by highlighting, copying, putting it into your playbook
2:17 customizing it for your own purposes.
2:19 If you scroll down a little further
2:20 you'll see the status of the module.
2:22 The main reason why this is important is because
2:24 stable modules guarantee backwards compatibility.
2:27 For most modules, you won't have to worry about this
2:29 but if you see a new module in a new Ansible release
2:31 you'll just want to check the status to make sure
2:33 that it's not going to have some backwards breaking changes.
2:36 One more bit of documentation
2:37 if you want to get a high level overview of
2:39 Ansible configuration management, deployments
2:42 web server configuration
2:43 take a look at the table of contents page at
2:47 The 2 chapters that'll be most applicable to you
2:49 are going to be 'Chapter 5: Web App Deployments'
2:53 and 'Chapter 6: DevOps,' and where possible
2:56 I try to give plain language explanation along with diagrams
2:59 to show you how deployments work
3:01 or how configuration management tools like Ansible work
3:03 along with the best resources that I've found
3:05 to accomplish your objectives.
3:07 So the two mandatory tabs
3:10 the second one docs.ansible.com
3:13 and optionally, if you need a higher level overview
3:15 the table of contents page on fullstackpython.com.