피드 구독

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:


저자 소개

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

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Original series icon

오리지널 쇼

엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리