Ansible: Difference between revisions

From Network Security Wiki
Content added Content deleted
m (Protected "Ansible" ([Edit=Allow only logged in users] (indefinite) [Move=Allow only logged in users] (indefinite) [Delete=Allow only logged in users] (indefinite)))
No edit summary
Line 1: Line 1:
[[Category:Scripting]]
__TOC__
<br />


= Installation =
= Installation =


Line 34: Line 39:
ansible -m ping all
ansible -m ping all
ansible -m shell -a 'free -m' host1
ansible -m shell -a 'free -m' host1

= Notebooks =
{{UC}}


<br />
;References
<references/>
<br />
<br />
<br />


{{DISQUS}}

Revision as of 11:56, 6 February 2018



Installation

Adding Repository:

sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible

Installation:

sudo apt-get update
sudo apt-get install ansible

Prepare the Remote Host

Generate SSH Key on the Ansible Server:

ssh-keygen

Copy the keys to the Remote Server:

ssh-copy-id -i ~/.ssh/id_rsa.pub aman@10.100.8.103

Test the Connection using SSH Keys:

ssh aman@10.100.8.103

Configure Ansible

Edit Ansible Hosts File:

sudo nano /etc/ansible/hosts

Create a Host:

my_server ansible_ssh_host=10.100.8.103

Or Create a Group:

[my_web_servers]
host1 ansible_ssh_host=192.0.2.1
host2 ansible_ssh_host=192.0.2.2
host3 ansible_ssh_host=192.0.2.3

Execute Commands

ansible -m ping all
ansible -m shell -a 'free -m' host1

Notebooks

        This section is under construction.



References





{{#widget:DISQUS |id=networkm |uniqid=Ansible |url=https://aman.awiki.org/wiki/Ansible }}