<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Automatization Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/automatization/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 12 Jul 2018 13:17:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.13</generator>
	<item>
		<title>How to install Ansible on Ubuntu 18.04?</title>
		<link>https://www.osradar.com/how-to-install-ansible-on-ubuntu-18-04/</link>
					<comments>https://www.osradar.com/how-to-install-ansible-on-ubuntu-18-04/#respond</comments>
		
		<dc:creator><![CDATA[Mel]]></dc:creator>
		<pubDate>Thu, 12 Jul 2018 13:17:50 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[ansible]]></category>
		<category><![CDATA[Automatization]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=4657</guid>

					<description><![CDATA[<p>Ansible is a free software platform to configure and manage computers automatically. In other words, it allows you to automate all the tedious and repetitive tasks that system administrators encounter. Ansible is an open source project implemented in Python and has a modular architecture that can handle virtually any operating system, cloud environment and system [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-ansible-on-ubuntu-18-04/">How to install Ansible on Ubuntu 18.04?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Ansible</strong> is a free software platform to configure and manage computers automatically. In other words, <strong>it allows you to automate all the tedious and repetitive tasks</strong> that system administrators encounter.</p>
<p><strong>Ansible</strong> is an open source project implemented in Python and has a modular architecture that can handle virtually any operating system, cloud environment and system management tool or framework.</p>
<p>It is included as part of the Linux Fedora distribution, inherited from Red Hat Inc. and is also available for Red Hat Enterprise Linux, CentOS and Scientific Linux through the Enterprise Linux Extras Packages (EPELs) as well as other operating systems, for example, Ubuntu and Debian.</p>
<h2>Advantages and features</h2>
<p>One of Ansible&#8217;s thanks to the competition is that you d<strong>on&#8217;t have to install Agents or Servers</strong>. Just install ansible on your machine and you&#8217;re ready to go.</p>
<p>It does not require cumbersome and complicated configurations, its documentation is quite extensive and its configuration files explicit.</p>
<p>Another of its advantages is that it has an API and allows the development of plugins to extend its functionality.</p>
<h2>Installing Ansible</h2>
<p>Installing ansible is relatively easy as it is packaged for many of the most popular GNU/LINUX distributions. In the case of ubuntu 18.04 we have a PPA repository at our disposal that is ready to make the work even easier.</p>
<p>First of all we log in as a super user. Write in a terminal:</p>
<p><strong>               sudo -i</strong></p>
<p>Next we proceed to update the system, something always recommended to obtain even more security in our server:</p>
<figure id="attachment_4664" aria-describedby="caption-attachment-4664" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4664" src="https://www.osradar.com/wp-content/uploads/2018/07/1-1.png" alt="1.- Upgrading the system" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/1-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/1-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/1-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/1-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/1-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/1-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/1-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4664" class="wp-caption-text">1.- Upgrading the system</figcaption></figure>
<p>The next step is to install the package software-properties-common:</p>
<p><strong>                apt install software-properties-common</strong></p>
<figure id="attachment_4667" aria-describedby="caption-attachment-4667" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4667" src="https://www.osradar.com/wp-content/uploads/2018/07/2-1.png" alt="2.- Installing required packages" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/2-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/2-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/2-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/2-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/2-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/2-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/2-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4667" class="wp-caption-text">2.- Installing required packages</figcaption></figure>
<p>At the end of the installation, we have to add the PPA repository with the latest available version of Ansible.</p>
<p><strong>               apt-add-repository ppa:ansible/ansible</strong></p>
<figure id="attachment_4666" aria-describedby="caption-attachment-4666" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4666" src="https://www.osradar.com/wp-content/uploads/2018/07/3-1.png" alt="apt-add-repository ppa:ansible/ansible" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/3-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/3-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/3-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/3-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/3-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/3-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/3-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4666" class="wp-caption-text">3.- Adding PPA</figcaption></figure>
<p>The next thing to do is to install the package that contains the program:</p>
<p><strong>              apt install ansible</strong></p>
<figure id="attachment_4670" aria-describedby="caption-attachment-4670" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4670" src="https://www.osradar.com/wp-content/uploads/2018/07/Screenshot-from-2018-07-05-16-57-23.png" alt="4.- Installing the main package" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/Screenshot-from-2018-07-05-16-57-23.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/Screenshot-from-2018-07-05-16-57-23-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/Screenshot-from-2018-07-05-16-57-23-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/Screenshot-from-2018-07-05-16-57-23-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/Screenshot-from-2018-07-05-16-57-23-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/Screenshot-from-2018-07-05-16-57-23-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/Screenshot-from-2018-07-05-16-57-23-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4670" class="wp-caption-text">4.- Installing the main package</figcaption></figure>
<p>And now, that&#8217;s it.</p>
<h2><strong>Getting Started with Ansible</strong></h2>
<p>It is easy to take the first steps with Ansible, to demonstrate its use, we must have at least two machines, one that will be the main one and the other that will act as a node.</p>
<p>When Ansible is installed in one of the machines, we transform it into the main one. Remembering that there is no server as such, nor agents to configure.</p>
<p>The main machine cannot have Windows as its operating system, and must have python 2.6 or higher for effective installation.</p>
<p>For this tutorial the main machine has these features:</p>
<ul>
<li>RAM Memory: 512mb</li>
<li>OS: Ubuntu server 18.04</li>
<li>IP Address: 192.168.250.5</li>
<li>Hard Drive: 20gb</li>
<li>Hostname: osradar1</li>
</ul>
<p>And the second machine:</p>
<ul>
<li>RAM Memory: 512mb</li>
<li>OS: Ubuntu server 18.04</li>
<li>IP Address: 192.168.250.6</li>
<li>Hard Drive: 20gb</li>
<li>Hostname: osradar2</li>
</ul>
<p>Once we know this, we proceed to start the configuration process in order to execute the first command.</p>
<p>First of all we must create or modify the file /etc/ansible/hosts which is where the computers of our network are defined as well as the possibility of attaching them to groups. In this file we must place the address of the other node. To edit it, proceed to execute:</p>
<p><strong>              nano /etc/ansible/hosts</strong></p>
<figure id="attachment_4675" aria-describedby="caption-attachment-4675" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4675" src="https://www.osradar.com/wp-content/uploads/2018/07/5-1.png" alt="5.-Editing the file hosts" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/5-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/5-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/5-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/5-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/5-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/5-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/5-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4675" class="wp-caption-text">5.-Editing the file hosts</figcaption></figure>
<p>Now we must make sure that we have SSH key authentication with the node. Write in a terminal:</p>
<p><strong>              ssh-keygen</strong></p>
<figure id="attachment_4676" aria-describedby="caption-attachment-4676" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4676" src="https://www.osradar.com/wp-content/uploads/2018/07/6-1.png" alt="6.- SSH-Keygen" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/6-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/6-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/6-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/6-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/6-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/6-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/6-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4676" class="wp-caption-text">6.- SSH-Keygen</figcaption></figure>
<p>Next, copy the public key to the node.</p>
<p><strong>               ssh-copy-id -i ~/.ssh/id_rsa.pub angelo@192.168.250.6</strong></p>
<figure id="attachment_4683" aria-describedby="caption-attachment-4683" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4683" src="https://www.osradar.com/wp-content/uploads/2018/07/7-1.png" alt="7.- Copying ssh key" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/7-1.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/7-1-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/7-1-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/7-1-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/7-1-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/7-1-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/7-1-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4683" class="wp-caption-text">7.- Copying ssh key</figcaption></figure>
<p>Now we can try to perform our first command from the main machine to the node to test the installation.</p>
<p><strong>          ansible all -m ping -u angelo</strong></p>
<figure id="attachment_4685" aria-describedby="caption-attachment-4685" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4685" src="https://www.osradar.com/wp-content/uploads/2018/07/8.png" alt="8.- First command success" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/8.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/8-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/8-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/8-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/8-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/8-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/8-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4685" class="wp-caption-text">8.- First command success</figcaption></figure>
<p>We can also log in with the root user. Important if we want to execute tasks that require super user.</p>
<p><strong>               ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.250.6</strong></p>
<p>Or any user.</p>
<h2>Working with Playbooks</h2>
<p>Playbooks are configuration files that allow us to deploy various tasks to different nodes, describing the steps to follow. Its writing is based on YAML and its format is.yml</p>
<p>For this tutorial a playbook will be made to install LAMP on the other node.</p>
<p>We create a playbook called lamp.yml and copy the following text into it:</p>
<p><strong>                 nano lamp.yml</strong></p>
<p><strong>&#8212;</strong><br />
<strong>&#8211; hosts: all</strong><br />
<strong>user: root</strong></p>
<p><strong>tasks:</strong></p>
<p><strong>-name: General | Installing packages</strong><br />
<strong>action: apt pkg={{ item }} state=installed</strong><br />
<strong>with_items:</strong><br />
<strong>&#8211; php7.2</strong><br />
<strong>&#8211; apache2</strong><br />
<strong>&#8211; mariadb-server</strong><br />
<strong>&#8211; mariadb-client</strong><br />
<strong>&#8211; php7.2-mysql</strong><br />
<strong>&#8211; php-apcu</strong><br />
<strong>&#8211; php7.2-xmlrpc</strong><br />
<strong>&#8211; php7.2-soap</strong><br />
<strong>&#8211; php7.2-gd</strong><br />
<strong>&#8211; unzip</strong><br />
<strong>&#8211; python-mysqldb</strong></p>
<p><strong>&#8211; name: Apache2 |Enabling modules</strong><br />
<strong>action: command a2enmod rewrite vhost_alias</strong></p>
<p><strong>&#8211; name: Restart Apache</strong><br />
<strong>action: service name=apache2 state=restarted</strong></p>
<figure id="attachment_4689" aria-describedby="caption-attachment-4689" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4689" src="https://www.osradar.com/wp-content/uploads/2018/07/9-2.png" alt="9.- Creating the playbook" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/9-2.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/9-2-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/9-2-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/9-2-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/9-2-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/9-2-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/9-2-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4689" class="wp-caption-text">9.- Creating the playbook</figcaption></figure>
<p>Some components of the file are explained:</p>
<ul>
<li>hosts: to whom the playbook is addressed. It can be one, or a group, or in this case all.</li>
<li>user: user that will execute it. As we know to install lamp we must be root user.</li>
<li>tasks: are the instructions to be executed on the node machine. It may be one or more as in this case. The first one installs the packages, the second one enables the apache modules and the third one restarts the services.</li>
</ul>
<p>Remember that the /etc/ansible/hosts file can be used to create groups of nodes to speed up the selection process even more.</p>
<p>We proceed to run the playbook with the following command:</p>
<p><strong>             ansible-playbook lamp.yml</strong></p>
<figure id="attachment_4690" aria-describedby="caption-attachment-4690" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4690" src="https://www.osradar.com/wp-content/uploads/2018/07/10.png" alt="10.- Running playbook" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/10.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/10-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/10-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/10-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/10-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/10-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/10-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4690" class="wp-caption-text">10.- Running playbook</figcaption></figure>
<figure id="attachment_4691" aria-describedby="caption-attachment-4691" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-4691" src="https://www.osradar.com/wp-content/uploads/2018/07/11.png" alt="11.- Running the playbook" width="1368" height="710" srcset="https://www.osradar.com/wp-content/uploads/2018/07/11.png 1368w, https://www.osradar.com/wp-content/uploads/2018/07/11-300x156.png 300w, https://www.osradar.com/wp-content/uploads/2018/07/11-768x399.png 768w, https://www.osradar.com/wp-content/uploads/2018/07/11-1024x531.png 1024w, https://www.osradar.com/wp-content/uploads/2018/07/11-696x361.png 696w, https://www.osradar.com/wp-content/uploads/2018/07/11-1068x554.png 1068w, https://www.osradar.com/wp-content/uploads/2018/07/11-809x420.png 809w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-4691" class="wp-caption-text">11.- Running the playbook</figcaption></figure>
<p>As we can see, the 4 tasks were executed correctly.</p>
<p>This is just an outline of the great potential of Ansible that comes to give an open and simple solution to the world of process automation and tasks within any network.</p>
<p>Please share this article through your social networks.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-ansible-on-ubuntu-18-04/">How to install Ansible on Ubuntu 18.04?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-ansible-on-ubuntu-18-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
