Inscreva-se no feed

In this post:

  • Davie Street Enterprises (DSE) Senior System Administrator Randy Lu identifies a Windows use case for the fictitious company’s next phase of digital transformation.

  • See an example of how to use Ansible with Chocolatey to install and remove application packages from Windows devices.


Every morning Randy Lu, a Senior System Administrator at Davie Street Enterprises, walks by the large conference room on the 14th floor and sees his boss, Ranbir Ahuja, along with other senior members of the technology teams in their daily digital transformation stand-up meeting. 

Over the last few months Lu has heard about the major leaps many teams have taken during the company’s digital transformation, yet he hasn’t seen any changes in his area. At first, he was content with no one messing with how he runs his Windows nodes. 

However, after hearing his peers in the network and development area bragging about all the new technologies they are using, Lu is upset no one has spoken to him about modernizing his area. Today he decides to demand an explanation. 

Lu walks in and says, “I keep hearing how everyone is getting new technology and getting to go home on time while our team is here every night and weekends trying to get our work done! When are we doing something about that?” 

Identifying a use case for Red Hat Ansible Automation Platform and Chocolatey

Ahuja says, “Mr. Lu! Just the man we needed to speak with. Windows is next on our list and we need your help to decide on the best use case to start with.” 

Lu explained he needed to be able to install applications to Windows servers and desktops quickly, but without any mistakes, as that will cost his team more time if they need to redo the work. 

Lu was introduced to a Red Hat consultant to work with to be trained on the Red Hat Ansible Automation Platform, and who will also bring in help from Chocolatey—an enterprise offering to help organizations adopt a DevOps approach for their Windows environment.

After a couple of sessions getting familiar with Ansible Automation Platform and Chocolatey with the Red Hat consultant, Lu wrote a simple yet powerful playbook to carry out the installation of common applications to his Windows devices. 

Running the playbook using Chocolatey Ansible Certified Collection

Figure 1.

If you look closely, there are two components worth pointing out. The first is that the playbook uses the Chocolatey Ansible Certified Collection. 

In the playbook, you specify the collection to use under the collections section, which is a list of one or more of those collections. In this case, you can see Lu used chocolatey.chocolatey

The second item of note is under tasks. Here you can see he only needed one task which uses the win_chocolatey module. The module simply needs two parameters: one to determine the list of applications to install, update, or remove, the other to determine the state you want those applications. 

Creating a survey in Ansible Tower

Once Lu had the playbook, he went into Ansible Tower and created a job template so that the playbook can run in Tower. This gives him the opportunity to create a survey that allows others to use this job template with no knowledge of automation, Ansible, Chocolatey or Windows. Lu can set this up and allow the rest of his team, or even non-technical associates, to use it to install these applications. This figure shows what the survey will look like.

Figure 2. He loved how easy it was to fill in the fields to build out each question of the survey. As you can see, he put a user-friendly question, a description, the variable to assign the answer to, and a format to display the options. In this case, he used a multiple-choice (multiple select) type so that the user can select one or more applications. 

You will remember his playbook needed two variables to run. This question now provides the choco_packages value needed. A second question will provide the value for the app_state variable. Below is what his second question of the survey looked like.

Figure 3.

Note that beyond the difference of the variable, this question has a multiple-choice (single select) answer and it contains a default answer. This makes it easier to fill out the form in cases like this where most of the time one answer will be selected. 

Testing out the new automation capabilities

Now it was time for Lu to run the job and test out his new automation capabilities. As discussed, when he runs the job he will be prompted with the survey he set up. It will look something like this: Figure 4. In this test, he has selected to install Git and Google Chrome by selecting those and making the state present. Then he clicked next to get the following screen:
Figure 5. Here Lu is able to confirm the values of those two variables. Once everything looked good he clicked Launch to start the automation job. The playbook then runs to completion, ending with a screen that looks like the one below, letting us know that the job completed successfully. 

Figure 6. Note that the yellow color means that something has changed, in this case the successful install of those applications. If something failed, we would see red and be able to double click on those to get greater details on the error in order to troubleshoot. 

Lu is excited to see his first Ansible automation job run successfully and can now plan how to expand this across all Windows devices. 

Give it a try

Ansible has dozens of modules in the Windows Collection which can be used in Windows environments. For more information on Ansible for Windows automation, go here.  For the Chocolatey Collection, go here. Below you can see a demo video of this in action:


Sobre o autor

David Rojas is a leader with a demonstrated history of working in the information technology and services industry. He has a history in operations management, business development, IT service Management, and IT strategy. Rojas joined Red Hat in May 2019.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

Navegue por canal

automation icon

Automação

Últimas novidades em automação de TI para empresas de tecnologia, equipes e ambientes

AI icon

Inteligência artificial

Descubra as atualizações nas plataformas que proporcionam aos clientes executar suas cargas de trabalho de IA em qualquer ambiente

open hybrid cloud icon

Nuvem híbrida aberta

Veja como construímos um futuro mais flexível com a nuvem híbrida

security icon

Segurança

Veja as últimas novidades sobre como reduzimos riscos em ambientes e tecnologias

edge icon

Edge computing

Saiba quais são as atualizações nas plataformas que simplificam as operações na borda

Infrastructure icon

Infraestrutura

Saiba o que há de mais recente na plataforma Linux empresarial líder mundial

application development icon

Aplicações

Conheça nossas soluções desenvolvidas para ajudar você a superar os desafios mais complexos de aplicações

Original series icon

Programas originais

Veja as histórias divertidas de criadores e líderes em tecnologia empresarial