 Hello everyone, thank you for joining me for this session. It's about Ansible Console, how to debug many nodes in an emergency or not. The idea and all the slides I done by my colleague, Pierre Blanc, who is unfortunately preferred to run marathon than coming to the conference. So you are stuck with me here for today. Let's jump right into the talk. So here is Pierre, you don't see him today, but you could always join him by email if you have any follow-up questions. Today's agenda is about short story of appearance of Ansible Console, how to install it, how to use, and some benefits that you could get out of it. So in short, it's a console for executing Ansible tasks. It's an open source project, and it's another way to consume Ansible modules. You could have immediate usage as visit hook commands. It's perfect for occasional or urgent use and the really great feature, it allows you all bash short cards, and I will show it off in some moments. So a bit of history, Ansible Shell was written by another C-vocal, soon known as Dominis, and his first contribution are of 2013. So Ansible appeared in 2012. So the need of having something like Ansible Shell was immediately here, and it became a part of Ansible Code in 2016 after the acquisition of Ansible by Red Hat. It's a part of official Ansible project since version 2.1. So it's included in Ansible Code, so how to install it, it's easy, you have it with RPMs the same way as you have Ansible Dock, Ansible Galaxy, or Ansible Playbook. That's really easy, it's all in here. So concerning the place in Ansible ecosystem, okay, here is really simplified, but what I want to show you on this slide is that it's basically the same access to collections, modules, and plugins as Ansible AdHoc has, but it has some additional benefits in comparison to AdHoc, so let's compare them both. So AdHoc allows you to use a module to perform a single task, okay, so no history. Ansible console allows you to execute multiple tasks and it keeps the state of the previously executed task, so it's more extended usage in comparison with the AdHoc. So let's jump into the execution. So you execute it exactly as the same way as Ansible, you are providing the inventory, and here we have the typical prompt, okay, so what do we see here? Here we see a username demo, we see all groups selected, we see 20 nodes, and we see 10 forks, if you want to run a parallel execution. So what we could do with this inventory is here, we could list selected nodes, list available groups, and select a group of all nodes. We do it like this, so here we list all the groups backend, frontend, and ungrouped, we select frontend, and we list three machines that are in frontend. We could also come back and select all the machines, or we could just select only backend and list two backend machines. We could just select one machine, and you see the number of machines selected, this displayed right here in the console, so as the first part. So again, we are coming back to all, and we are having all five machines, three frontends and two backends selected right here. We could also list available groups, and then the rest of the part I already showed you here. So let's jump into the usage, so what we could do as a simple thing, first of all, we could just execute an unskilled task, so let's install HTTPD server on every frontend machine. So what we could do here, we could first narrow down our group to the frontend, so instead of five machines, we just keep here three frontend machines, and then we execute an unskilled task to install HTTPD server on each of them, and so here is the result, nothing to do, the everything is already installed. Okay, so that's how you execute unskilled task, here's the help of console. Let's go to a more extensive usage, what is good about unskilled console is that you can use facts, okay? So here is how you can get facts, and here is how you could just check out this fact, so again, here we are executing unskilled command, but now we are using the fact that we governed right before. So we just discussed a sort of unskilled usage of the console, let's now jump to a shell usage, so it's not only unskilled commands that are available here, the great thing is that you have also shell available, and I will show you that actually you could combine both. So for the moment, let's just check out shell, so again, we are in the frontend group, and we are just displaying a Linux release that I installed, and we also could force the execution by using the exclamation mark if needed, okay? So we discussed unskilled usage, we discussed shell usage, and now here is the more important slide in this presentation, let's discuss the combination of both, how we could use ansible facts within the shell command. So here it's a bit in the middle of the gif, so let's just wait in the beginning. So what we could do here is that we could basically execute the facts governing, okay, and get the facts for all the machines, okay? So now what we are going to do, we are going to execute a shell command, okay? So we are going to check the content of slashetct slash modtd file, and here is the best part. So we are combining here shell command with the ansible variables, which is retrieved from before. So you see we are keeping history, we are using ansible facts that were retrieved by ansible commands, and we are using it within the shell command. So it's really great, you have a huge flexibility. So you have really a combination of shell and ansible and goodies from the boss within one part. Shell, ansible, and you are keeping history of the previous command, so it's really great. It's something that I really want to promote. So this is the most important fact of the presentation. This is what I wanted to pitch here. So then, if we just speak about how to start, ansible console provides you an interactive help. So you could basically check the syntaxes of each command, you could check the execution, and you could easily get a helper and auto-complete with every modules. So here is the demo. So for example, I want to get a help of the copy command and I display what it could be done. And I also want to get an auto-complete and here is how it goes. So let's go to some bonuses. It's like real quick highlights that I personally like here. So what you could do, you could exclude a node from the selection. So it's really handy. If you want, for example, to debug all nodes, except one in which you are really sure, you could use become option. Be careful with that, but you can. And you could really trim a number of used forks. So if you want execution one by one and no parallelization, just use fork one. If you want to run everything in parallel, you could use a lot of forks. And also the story of your execution is right here, Ansible console history. So if you want to check out what was done, you could. And let's jump into the conclusion. So it's easy to access fast and intuitive. It's improved that Hoc command. So what you get in plus in comparison with that Hoc, you have history, you have Ansible variables, you have multiple tasks. It's really convenient for one time interventions like testing and debugging. It could easily replace softwares like cluster SSH, PSSH, and so on, because of its combination of shell and Ansible usage. So here you have links to the source code and to some resources. And here is a quote from the creator of the console. Hope no one accidentally nuked the entire infrastructure because it, and that's it. Thank you so much for the attention, guys. You have five minutes for the questions. Let me just go back to the most important slide of the presentation and here you go. Okay, yeah, go ahead. Can we use console to implement a custom module that I would be developing? I can write in a custom module for Ansible. Can I invoke it in the console or do I have to wire it somewhere, in some way to be able to call it? I'm not really sure to be honest. I don't know the answer to that question. I think once you publish the collection as official Ansible collection, for sure you can. Okay. If you can it during development, this I don't know exactly. I'm not really into Ansible development life cycle. You could ask Pierre. I'm sorry for not having an answer for that. No, no problem. Thank you. Yeah, do have, yeah, go ahead. In Ansible, but let's say that I wanna know, can I do that or how is, like, for me it looks like that it has a... Yeah, it's okay, sorry, I will repeat. So the question was how it's distinguished between Ansible commands and shell commands. Okay, in some obvious situations as these variables, you have Ansible syntax right in here. And I imagine that you could enforce Ansible syntax using the quotes. But to be honest, I'm not really sure about really tiny situations than the names could be mixed up. What, from what I've seen in the usage, it's basically first tries to interpret as shell and then it tries to interpret as Ansible if it's not available. But again, I'm afraid I'm not, I don't know the exact answer in all the tricky situations. Thank you. Do have any other questions we still have sometime? Do not hesitate. There is also email of Pierre on the first slide of the presentation. So if you have, like, really in-depth question to which I'm sorry I did not reply today, could reach out to him directly. So he's a really good guy and he could provide you really in-depth expertise on the subject. No questions? I think you are good then. Thank you so much.