[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

Starting Infrastructure as Code with Ansible (Introduction & Installation)

Hello everyone, this

is Okazaki from the SRE team of the System Solutions Department

I think it's common in my work to do similar tasks and build similar servers during operation.It
's very tedious to do the same tasks every time, and
I would rather be doing something else. You will have to take care of such tasks.
I would like to introduce the tool "Ansible" that I have been using recently to eliminate such routine tasks.

What is Ansible? ?

It is generally known as a configuration management tool for deployment management, infrastructure settings management, etc.
Other popular configuration management tools include Chef and Puppet.
The differences are as follows.

Chef

  • Developed by Chef
  • Agent must also be installed on the client to be executed.
  • The configuration definition file description method is Ruby and the learning cost is high.
  • Released before Ansible and still released frequently

Puppet

  • Developed by Puppet Labs
  • You can install the agent on the client to be executed or use it standalone.
  • It is the oldest released of the three introduced.
  • The configuration definition file description method is Ruby and the learning cost is high.

Ansible

  • Developed by RedHat
  • No need to install an agent on the client
  • The youngest of the three
  • The configuration definition file is written in yaml, which reduces the learning cost.

The difference is as above, but Ansible
will work if Python 2.4 or higher is installed on the client and SSH can be connected.

Features of Ansible

Other features include the following.

  • idempotency

    Ansible, like other configuration management tools, is also characterized by ensuring idempotency.
    This
    ensures that the tool will converge to the same state no matter how many times it is executed using some modules, without any user intervention.

  • module


    , you can control and execute
    various functions and platform settings with a minimum of To use them, you need to use a function called a defined module.

    are created to
    perform detailed server settings (yum, user, file), and and are used although they may or may not be compatible with each version. You can.

How to install Ansible

Now, I will introduce how to install Ansible.

First, let's check the Python version.

# python --version Python 2.7.5

Since the Python version is 2.4 or higher, you can install it without any problems.
Install to specify the epel repository

# yum install epel-release

Now let's install Ansible.

# yum install --enablerepo=epel ansible Installed: ansible.noarch 0:2.6.3-1.el7 Dependency Installed: PyYAML.x86_64 0:3.10-11.el7 libtomcrypt.x86_64 0:1.17-26.el7 libtommath.x86_64 0 :0.42.0-6.el7 libyaml.x86_64 0:0.1.4-11.el7_0 make.x86_64 1:3.82-23.el7 openssl.x86_64 1:1.0.2k-12.el7 python-babel.noarch 0:0.9 .6-8.el7 python-cffi.x86_64 0:1.6.0-5.el7 python-enum34.noarch 0:1.0.4-1.el7 python-httplib2.noarch 0:0.9.2-1.el7 python- idna.noarch 0:2.4-1.el7 python-jinja2.noarch 0:2.7.2-2.el7 python-keyczar.noarch 0:0.71c-2.el7 python-markupsafe.x86_64 0:0.11-10.el7 python -paramiko.noarch 0:2.1.1-4.el7 python-ply.noarch 0:3.4-11.el7 python-pycparser.noarch 0:2.14-1.el7 python-six.noarch 0:1.9.0-2. el7 python2-crypto.x86_64 0:2.6.1-15.el7 python2-cryptography.x86_64 0:1.7.2-2.el7 python2-jmespath.noarch 0:0.9.0-3.el7 python2-pyasn1.noarch 0: 0.1.9-7.el7 sshpass.x86_64 0:1.06-2.el7 Complete!

Installation completed! !

# ansible --version ansible 2.6.3 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/ modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

You have successfully installed Ansible 2.6.3! !

summary

This time I briefly wrote about introducing Ansible and how to install it, but

I would like to write about how to
connect to SSH from Ansible on another server and configure various settings after actually installing it I hope this article will spark your interest in Ansible and operation/construction automation.
That concludes this.

If you found this article helpful , please give it a like!
0
Loading...
0 votes, average: 0.00 / 10
554
X facebook Hatena Bookmark pocket
[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

The person who wrote this article

About the author

Junichiro Okazaki

Extensive experience in relocating and operating smartphone games.

He handles multi-cloud operations, server construction and relocation on a daily basis. As the number of cases has increased, I am considering how to improve the efficiency of my work. We often consider methods for relocating servers based on the merits of each cloud.

While we were relocating between clouds and from physical to cloud, we achieved two consecutive victories in a competition held by the Japan MSP Association.