Last active
April 1, 2020 10:50
-
-
Save linuxbiekaisar/d7910e36ea342de0a29416c7287b4cdc to your computer and use it in GitHub Desktop.
How to install ansible on Ubuntu 18.04 LTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Youtube: https://www.youtube.com/watch?v=StMGkxA5YnM | |
# !/bin/sh | |
# To install ansible run the following commands: | |
sudo apt-add-repository ppa:ansible/ansible | |
sudo apt update | |
sudo apt install ansible | |
# Setting Up the Inventory File. Be sure to replace the highlighted IPs with the IP addresses of your Ansible hosts. | |
sudo nano /etc/ansible/hosts | |
[servers] | |
server1 ansible_host=192.168.0.106 | |
server2 ansible_host=192.168.0.107 | |
server3 ansible_host=192.143.0.105 | |
[servers:vars] | |
ansible_python_interpreter=/usr/bin/python3 | |
#Save and Exit | |
ansible-inventory --list -y | |
ansible all -m ping -u root | |
# Running Ad-Hoc Commands | |
ansible all -a "df -h" -u root | |
ansible all -m apt -a "name=vim state=latest" -u root | |
ansible servers -a "uptime" -u root | |
ansible server1:server2 -m ping -u root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment