Ansible is a multiplier, a tool that automates and scales infrastructure of every size. It is considered to be a configuration management, orchestration, and deployment tool. It is easy to get up and running with Ansible. Even a new sysadmin could start automating with Ansible in a matter of a few hours.
Ansible automates using the SSH protocol. The control machine uses an SSH connection to communicate with its target hosts, which are typically Linux hosts. If you’re a Windows sysadmin, you can still use Ansible to automate your Windows environments using WinRM as opposed to SSH. Presently, though, the control machine still needs to run Linux.
As a new sysadmin, you might start with just a few playbooks. But as your automation skills continue to grow, and you become more familiar with Ansible, you will learn best practices and further realize that as your playbooks increase, using Ansible Galaxy becomes invaluable.
In this article, you will learn a bit about Ansible Galaxy, its structure, and how and when you can put it to use.
What Ansible does
Common sysadmin tasks that can be performed with Ansible include patching, updating systems, user and group management, and provisioning. Ansible presently has a huge footprint in IT Automation—if not the largest presently—and is considered to be the most popular and widely used configuration management, orchestration, and deployment tool available today.
One of the main reasons for its popularity is its simplicity. It’s simple, powerful, and agentless. Which means a new or entry-level sysadmin can hit the ground automating in a matter of hours. Ansible allows you to scale quickly, efficiently, and cross-functionally.
Create roles with Ansible Galaxy
Ansible Galaxy is essentially a large public repository of Ansible roles. Roles ship with READMEs detailing the role’s use and available variables. Galaxy contains a large number of roles that are constantly evolving and increasing.
Galaxy can use git to add other role sources, such as GitHub. You can initialize a new galaxy role using ansible-galaxy init
, or you can install a role directly from the Ansible Galaxy role store by executing the command ansible-galaxy install <name of role>
.
Here are some helpful ansible-galaxy
commands you might use from time to time:
-
ansible-galaxy list
displays a list of installed roles, with version numbers. -
ansible-galaxy remove <role>
removes an installed role. -
ansible-galaxy info
provides a variety of information about Ansible Galaxy. -
ansible-galaxy init
can be used to create a role template suitable for submission to Ansible Galaxy.
To create an Ansible role using Ansible Galaxy, we need to use the ansible-galaxy
command and its templates. Roles must be downloaded before they can be used in playbooks, and they are placed into the default directory /etc/ansible/roles
. You can find role examples at https://galaxy.ansible.com/geerlingguy:

Create collections
While Ansible Galaxy has been the go-to tool for constructing and managing roles, with new iterations of Ansible you are bound to see changes or additions. On Ansible version 2.8 you get the new feature of collections.
What are collections and why are they worth mentioning? As the Ansible documentation states:
Collections are a distribution format for Ansible content. They can be used to package and distribute playbooks, roles, modules, and plugins.
Collections follow a simple structure:
collection/
├── docs/
├── galaxy.yml
├── plugins/
│ ├── modules/
│ │ └── module1.py
│ ├── inventory/
│ └── .../
├── README.md
├── roles/
│ ├── role1/
│ ├── role2/
│ └── .../
├── playbooks/
│ ├── files/
│ ├── vars/
│ ├── templates/
│ └── tasks/
└── tests/

The ansible-galaxy-collection
command implements the following commands. Notably, a few of the subcommands are the same as used with ansible-galaxy
:
-
init
creates a basic collection skeleton based on the default template included with Ansible, or your own template. -
build
creates a collection artifact that can be uploaded to Galaxy, or your own repository. -
publish
publishes a built collection artifact to Galaxy. -
install
installs one or more collections.
In order to determine what can go into a collection, a great resource can be found here.
Conclusion
Establish yourself as a stellar sysadmin with an automation solution that is simple, powerful, agentless, and scales your infrastructure quickly and efficiently. Using Ansible Galaxy to create roles is superb thinking, and an ideal way to be organized and thoughtful in managing your ever-growing playbooks.
The only way to improve your automation skills is to work with a dedicated tool and prove the value and positive impact of automation on your infrastructure.
저자 소개
Tonya Brown, is a Scrum/Agile Practitioner and Technical Product Manager working with DevOps and Software Development teams. She is an avid writer and speaker with a diverse background in Scrum, Agile, digital product management, Linux systems engineering, management and deployment of DevOps solutions. She now focuses on making software development teams high performing through the practice of Scrum and other agile methodologies. She truly believes in being a servant leader and mentoring, coaching, and facilitating with the ultimate purpose to create cross-functional, self-organizing, self-managed teams.
She has more than 17 years of IT experience working with companies like MasterCard, Nestle Purina, Centurylink, Ameren, which have involved large scale infrastructure adoptions involving CI/CD pipeline implementations and implementing cloud solutions.
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
오리지널 쇼
엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리
제품
- Red Hat Enterprise Linux
- Red Hat OpenShift Enterprise
- Red Hat Ansible Automation Platform
- 클라우드 서비스
- 모든 제품 보기
툴
체험, 구매 & 영업
커뮤니케이션
Red Hat 소개
Red Hat은 Linux, 클라우드, 컨테이너, 쿠버네티스 등을 포함한 글로벌 엔터프라이즈 오픈소스 솔루션 공급업체입니다. Red Hat은 코어 데이터센터에서 네트워크 엣지에 이르기까지 다양한 플랫폼과 환경에서 기업의 업무 편의성을 높여 주는 강화된 기능의 솔루션을 제공합니다.