Ansible: Training, schools at a glance

to providers
(2)
Infos, tips & tests Video stories
(1)

Learn Ansible: An open source automation tool for applications and IT infrastructure

Questions and answers

It is often necessary to change individual file lines. However, many lineinfile or blockinfile modules are used for this purpose. However, practical experience shows that these modules should not be used if files are to be changed with them. In this case, it is better to use the template or copy module. In particular, to manage not only individual lines, but the entire file. There are two reasons for this:

  • When using lineinfile, regex must often be used. This results in the following problems: The use of regex is often complicated and people who then use playbooks must be familiar with regex.
  • The programmer himself must know and be able to remember that this particular line in this one configuration file is managed by Ansible.

If you manage the entire file with an Ansible template, you can use theansible_managed variable to make it clear that the file is under Ansible control. Another advantage is that you can use a variable for the selinux-state and simply change it on servers where selinux should not be in the enforcing state.

The importance of Ansible for programming is:

  • Ansible is one of the preferred tools for automating processes. This refers to processes that would otherwise take a lot of time and often have to be carried out manually without professional quality control. Ansible offers several advantages over other tools of this type (e.g. Puppet, Chef, SaltStack etc.).
  • Thanks to its minimal features, Ansible is easy to use with consistent efficiency. The system status is described using easy-to-write and read YAML files (= Ansible Playbooks).
  • The tasks are controlled and grouped using playbooks. You write everything in the way you want the system to work. Frequently recurring elements are stored in playbook roles and can therefore be used multiple times.
  • You don't need to install much, because all you need on the system is an SSH server, Ansible Git (Ansible Github) and a current Python installation (a scripting language that comes with every current Linux system).
  • And the learning curve is steep. Ansible helps to retain the knowledge in the configuration (Ansible setup) so that a DevOps successor can simply continue working where they left off at any time. This is because the code serves as documentation and everything is reproducible.

With an Ansible file, you can manage files with the help of Ansible modules. Files can also be copied, edited, inserted, downloaded or replaced with Ansible. According to the Ansible tutorial, files can be copied from the "Ansible File" directory using the "copy" module. The "template" module, on the other hand, copies the Jinja2 template from the "template" directory to Ansible Playbooks. According to the Ansible tutorial, Ansible Copy is therefore only suitable for copying persistent files such as certificates. The "Template" module, on the other hand, is more suitable for reusable configurations such as virtual host configurations. The Ansible module "Fetch" is suitable for downloading a file from the remote machine to a local Ansible node. According to the Ansible tutorial, the following options are available for editing files with Ansible:

  • Insert several lines into a file with the Ansible module "blockinfile"
  • Insert several lines with the marker options with marker option "insertafter" or "insertbefore"
  • Delete/remove several lines by blocking the surroundings within the markings
  • Insert new line in file with "PermitEmptyPasswords"
  • Remove line from file with the line file module
  • Replacing pattern strings with regular expressions and replacing the module with "Replace"
  • Uncommented configurations with "server tokens"
  • Commentary on the configuration line

According to the Ansible tutorial, file attributes can be set via the file module in Ansible, e.g. via a symlink file or by creating a new directory using the file module. There are therefore numerous ways to manage files with an Ansible file.

 

To get Ansible, the most popular tool for configuration management and infrastructure automation, running on Windows, follow the Ansible documentation for "Ansible Windows". The "Ansible Install" succeeds with Cygwin - a POSIX-compatible environment that can be run on Windows. This is because you can do many things on Windows that you normally do on UNIX-based operating systems. The default installation of Cygwin does not cover Ansible, so you need to select "Download Cygwin" during installation. Using Ubuntu on Windows 10 is also an option.

Ansible is an open source automation tool. It is used for orchestration and general configuration and administration of computers. It combines software distribution, ad-hoc command execution and configuration management. Network computers are managed via SSH, among other things. The advantage of Ansible is that it does not require any additional software on the system to be managed. And modules can be written in any programming language, as they use JSON for output. The system, on the other hand, uses YAML to formulate reusable descriptions of systems. One Ansible example (Ansible Example) is Ansible Galaxy. With Ansible Galaxy, it is even possible to create your own Ansible repositories. The Ansible Galaxy source code published under a free license by Red Hat is the official community hub for sharing Ansible roles. With the Ansible Galaxy open source project, companies can set up their own Galaxy server. This allows you to use the native Ansible client for forwarding m private Galaxy repository. In addition, users and companies can now contribute new features and extensions directly to the Galaxy codebase.

An Ansible Collection can contain various Ansible components: Ansible Roles, Ansible Modules or Ansible Plugins. You can make content available by installing the Ansible Collections (collection of your own Ansible environment). The "Namespace" form prevents naming collisions with Ansible Collections and namespaces have no relation to Ansible Github handles. Ansible Collections are packed and pushed to Ansible Galaxy and can be hosted on any Git respostory - private or public. The namespace is defined in the galaxy.yml metafile. Ansible Galaxy is usually covered in an Ansible course.

Redaktionelle Leitung:

Stefan Schmidlin, Bildungsberatung, Content-Team Modula AG

Quellen

Website des Schweizerischen Sekretariats für Bildung, Forschung und Innovation SBFI , Website www.berufsberatung.ch (offizielles schweizerisches Informationsportal der Studien-, Berufs- und Laufbahnberatung) sowie Websites und anderweitige Informationen der Berufsverbände und Bildungsanbieter.

Erfahrungen, Bewertungen und Meinungen zur Ausbildung / Weiterbildung

Preview of the video «4 Schritte zur richtigen Weiterbildung»

Haven't found the right training or further education yet? Benefit from educational advice now!

Further training is not only important in order to maintain or increase professional attractiveness, investing in training or further training is still the most efficient way to increase the chances of a pay rise.

The Swiss education system offers a wide range of individual training and further education opportunities - depending on your personal level of education, professional experience and educational goals.

Choosing the right educational offer is not easy for many prospective students.

Which training and further education is the right one for my path?

Our education advisory team will guide you through the "education jungle", providing specific input and relevant background information to help you choose the right offer.

Your advantages:

You will receive

  • Suggestions for suitable courses, seminars or training programs based on the information you provide in the questionnaire
  • An overview of the different levels and types of education
  • Information about the Swiss education system

We offer our educational counseling in the following languages on request: French, Italian, English

Register now and concretize your training plans.

Sofort zur richtigen Weiterbildung

Filter by teaching method:
Other (0)
Address:
Hofwiesenstrasse 350
8050 Zürich Oerlikon
AnyWeb Training
(5.5) Excellent 39 39 Ratings (97% )
AnyWeb is the largest Cisco Learning Partner in Switzerland and THE competence center when it comes to Cisco Networking Training, as well as general and specific continuing education, further training in the field of IT network technologies. With us you can attend standard courses, workshops or company courses at a career-enhancing level.

Start your career in networking today!
Strengths: Cisco-certified training of network engineers; instructors qualified by experience from daily project work; excellent public transportation connections in ZH-Oerlikon; No. 1 in Switzerland since 1996.
Region: Aargau, Basel, Bern, Ostschweiz, Zentralschweiz, Zürich
Sites: Zürich
Next start date
Certifications, Memberships, Qualifications:
Cisco Learning
Download info
Address:
Kronenstrasse 11
8735 St. Gallenkappel
ExperTeach AG
We support the ICT world with training, certification and consulting services. We offer courses from manufacturers such as Cisco or Trend Micro and in the field of IT management. With our own ExperTeach Networking seminar series, we provide you with technology know-how on all important ICT topics and current industry trends.
Region: Aargau, Basel, Bern, Liechtenstein, Ostschweiz, Tessin, Westschweiz, Zentralschweiz, Zürich
Sites: Zürich, Frankfurt/Dietzenbach, Wien, Düsseldorf, Hamburg, München
Download info

Schulen mit zertifizierter Bildungsberatung

Attraktive Services für SKO Mitglieder

Kostenlose Services

» Bildungsberatung (Wert: CHF 150.–)
Bildungs- und Businessratgeber (Wert: CHF 175.–)

» Rabatte

Attraktive Rabattierungen seitens der Bildungsanbieter.

Massgeschneiderte Bildungsangebote

Ohne grossen Zeitaufwand den besten Trainer, Coach oder Schulungsanbieter finden

Bildungsangebot Schweiz

Aus über 700 Bildungsanbietern das richtige Bildungsangebot finden