Difference between revisions of "Ansible"
(49 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[https://www.ansible.com Ansible] is an automation tool for IT professionals for managing software in a network environment, particularly designed to apply repetitive changes to a large number of machines. | {{WikiEntry|key=Ansible (software)|qCode=2852503}}, official website: [https://www.ansible.com Ansible.com]. is an automation tool for IT professionals for managing software in a network environment, particularly designed to apply repetitive changes to a large number of machines. It can be used in conjunction with [[Terraform]]. A critical notion in Ansible is [[Ansible Roles]]. This helps the organization of tasks to be done in a highly modularized way. The vocabulary of [[Ansible Roles]] can also be leveraged in organizational [[governance]]. | ||
=Installation for Ubuntu= | =Installation for Ubuntu= | ||
This is the [https://docs.ansible.com/ansible_community.html community documentation landing page] for Ansible. | This is the [https://docs.ansible.com/ansible_community.html community documentation landing page] for Ansible. | ||
If you must ask, the answer is '''Yes''', Ansible has a Windows implementation: [https://www.ansible.com/for/windows Ansible for Windows]. | |||
==Ubuntu Installation== | ==Ubuntu Installation== | ||
Line 12: | Line 13: | ||
sudo apt install ansible | sudo apt install ansible | ||
{{:Installing Kubernetes with Ansible}} | |||
==Ansible Agent== | |||
[https://github.com/jsternberg/ansible-agent Ansible agent] is a simple daemon used as a transport for [[Ansible]]. | |||
==Running PHP code with Ansible == | |||
# [https://www.digitalocean.com/community/tutorials/how-to-deploy-a-basic-php-application-using-ansible-on-ubuntu-14-04 Deploy Basic PHP Application using Ansible] | |||
==Ansible Books== | |||
There are a few books on Ansible: | |||
# Ansible for DevOps<ref>{{:Book/Ansible for DevOps}}</ref> | |||
# Ansible for Kubernetes<ref>{{:Book/Ansible for Kubernetes}}</ref> | |||
==Ansible Tips== | |||
# [https://riptutorial.com/ansible RIP Tutorial on Ansible] | |||
# Ansible Tutorial at TutorialPoint: [https://www.tutorialspoint.com/ansible/index.htm Ansible for Beginners] | |||
# Ansible: [https://crunchify.com/ansible-how-to-accept-user-input-using-vars_prompt-and-command-line/ How to accept user input using var_prompt and command line] | |||
# Cron Jobs: [https://www.edureka.co/community/86794/how-to-run-a-cron-job-using-ansible-playbook Run Cron Job using Ansible Playbook] | |||
# [https://www.youtube.com/watch?v=kkazBPHc4bk How to Build Docker Images with Ansible on Ubuntu 20.04] | |||
# Ansible module: '''expect''' [https://docs.ansible.com/ansible/2.8/modules/expect_module.html#expect-executes-a-command-and-responds-to-prompts Executes a command and responds to prompts] | |||
# Ansible module: Network commands and responses [https://cn-ansibledoc.readthedocs.io/zh_CN/latest/network/user_guide/network_working_with_command_output.html Working with command output and prompts in network modules] | |||
# [https://www.redhat.com/sysadmin/playing-ansible-facts An introduction to Ansible facts] | |||
# [https://www.redhat.com/sysadmin/navigate-ansible-documentation How to navigate Ansible documentation?] | |||
# [https://www.talkingquickly.co.uk/2021/01/macos-setup-with-ansible/ Mac OS Setup with Ansible] | |||
# [https://wilsonmar.github.io/ansible-mac-osx-setup/ Ansible Mac OSX Setup] | |||
==Ansible Tutorials== | |||
{{:Video/Create docker containers using Ansible}} | |||
{{:Video/Getting started with Ansible Series}} | |||
{{:Video/How to write your first Ansible playbook}} | |||
{{:Video/You should automate your Mac with Ansible!}} | |||
=Installation on MacOS= | |||
The preferred way to install Ansible on a Mac is with pip. | |||
The instructions can be found in Installing and upgrading Ansible with pip. If you are running macOS version 10.12 or older, then you should upgrade to the latest pip to connect to the Python Package Index securely. It should be noted that pip must be run as a module on macOS. | |||
'''Note''': | |||
macOS by default is configured for a small number of file handles, so if you want to use 15 or more forks you’ll need to raise the ulimit with sudo launchctl limit maxfiles unlimited. This command can also fix any “Too many open files” errors. | |||
Once pip is installed, please put below command to install ansible. | |||
python -m pip install --user ansible | |||
'''Paramiko''' is a Python (2.7, 3.4+) implementation of the SSHv2 protocol [1], providing both client and server functionality. While it leverages a Python C extension for low level cryptography (Cryptography), Paramiko itself is a pure Python interface around SSH networking concepts. Detailed usage and API documentation can be found at our code documentation site, docs.paramiko.org. In order to use the paramiko connection plugin or modules that require paramiko, install the required module 2: | |||
python -m pip install --user paramiko | |||
Ansible can also be installed inside a new or existing virtualenv: | |||
python -m virtualenv ansible | |||
This command will create new folder 'ansible' inside home folder, ~/ | |||
source ansible/bin/activate | |||
And, this command will activate them | |||
python -m pip install ansible | |||
And, finally, install ansible inside the virtual environment. | |||
'''Note''': | |||
Default inventory folder in MacOS is in /usr/local/etc/ansible/hosts, but, you may just want to change the defauly by issuing export command as below | |||
export ANSIBLE_HOSTS=/path/to/your/folder | |||
One can also write above command into ~/.bash_profile, to make the configuration persistence. | |||
To install docker_compose module for ansible, please issue below command | |||
pip install docker-compose | |||
=Ansible for Windows= | |||
There is a video<ref>{{:Video/Manage Windows like Linux with Ansible}}</ref> from RedHat on this subject. | |||
<noinclude> | <noinclude> | ||
=References= | |||
<references/> | |||
=Related Pages= | |||
{{#ask: [[Category:Ansible]] | |||
|format=category | |||
|mainLabel=Content Link | |||
}} | |||
[[Category:Ansible]] | [[Category:Ansible]] | ||
[[Category:Programming language]] | |||
</noinclude> | </noinclude> |
Latest revision as of 07:52, 2 March 2022
Ansible (software)(Q2852503), official website: Ansible.com. is an automation tool for IT professionals for managing software in a network environment, particularly designed to apply repetitive changes to a large number of machines. It can be used in conjunction with Terraform. A critical notion in Ansible is Ansible Roles. This helps the organization of tasks to be done in a highly modularized way. The vocabulary of Ansible Roles can also be leveraged in organizational governance.
Installation for Ubuntu
This is the community documentation landing page for Ansible. If you must ask, the answer is Yes, Ansible has a Windows implementation: Ansible for Windows.
Ubuntu Installation
The original documentation on Ansible's Ubuntu installation can be found here: The actual installation commands are:
sudo apt update sudo apt install software-properties-common sudo add-apt-repository --yes --update ppa:ansible/ansible sudo apt install ansible
Installing Kubernetes with Ansible
Ansible is ideal for automating the process of installing Kubernetes software, partially because Kubernetes is a technology for managing replicated computing services in a network cluster. There are many resources that explains how to use Ansible for installing Kubernetes, we provide links to the following tutorials to get started:
- Create Kubernetes Cluster Using Ansible Playbook Automation
- Installing Kubernetes with Ansible on AWS
- Kubernetes setup using Ansible and Vagrant
- Video/Kubernetes Cluster Installation using Ansible
Ansible Agent
Ansible agent is a simple daemon used as a transport for Ansible.
Running PHP code with Ansible
Ansible Books
There are a few books on Ansible:
Ansible Tips
- RIP Tutorial on Ansible
- Ansible Tutorial at TutorialPoint: Ansible for Beginners
- Ansible: How to accept user input using var_prompt and command line
- Cron Jobs: Run Cron Job using Ansible Playbook
- How to Build Docker Images with Ansible on Ubuntu 20.04
- Ansible module: expect Executes a command and responds to prompts
- Ansible module: Network commands and responses Working with command output and prompts in network modules
- An introduction to Ansible facts
- How to navigate Ansible documentation?
- Mac OS Setup with Ansible
- Ansible Mac OSX Setup
Ansible Tutorials
Video/Create docker containers using Ansible
LaCroix, Jay (Jul 31, 2020). Getting started with Ansible Series. local page: Learn Linux TV.
Valaxy Technologies
{{#ev:youtube |1VhPVu5EK5o }}
Installation on MacOS
The preferred way to install Ansible on a Mac is with pip.
The instructions can be found in Installing and upgrading Ansible with pip. If you are running macOS version 10.12 or older, then you should upgrade to the latest pip to connect to the Python Package Index securely. It should be noted that pip must be run as a module on macOS.
Note: macOS by default is configured for a small number of file handles, so if you want to use 15 or more forks you’ll need to raise the ulimit with sudo launchctl limit maxfiles unlimited. This command can also fix any “Too many open files” errors.
Once pip is installed, please put below command to install ansible.
python -m pip install --user ansible
Paramiko is a Python (2.7, 3.4+) implementation of the SSHv2 protocol [1], providing both client and server functionality. While it leverages a Python C extension for low level cryptography (Cryptography), Paramiko itself is a pure Python interface around SSH networking concepts. Detailed usage and API documentation can be found at our code documentation site, docs.paramiko.org. In order to use the paramiko connection plugin or modules that require paramiko, install the required module 2:
python -m pip install --user paramiko
Ansible can also be installed inside a new or existing virtualenv:
python -m virtualenv ansible
This command will create new folder 'ansible' inside home folder, ~/
source ansible/bin/activate
And, this command will activate them
python -m pip install ansible
And, finally, install ansible inside the virtual environment. Note: Default inventory folder in MacOS is in /usr/local/etc/ansible/hosts, but, you may just want to change the defauly by issuing export command as below
export ANSIBLE_HOSTS=/path/to/your/folder
One can also write above command into ~/.bash_profile, to make the configuration persistence. To install docker_compose module for ansible, please issue below command
pip install docker-compose
Ansible for Windows
There is a video[3] from RedHat on this subject.
References
- ↑ Geerling, Jeff (August 5, 2020). Ansible for DevOps (2nd ed.). local page: Midwestern Mac, LLC. ISBN 978-0986393426.
- ↑ Geerling, Jeff (August 5, 2020). Ansible for Kubernetes. local page: Midwestern Mac, LLC.
- ↑ Davis, Matt (May 11, 2018). Manage Windows like Linux with Ansible. local page: Red Hat Summit.
Related Pages
- Content Link Video/Getting started with Ansible 02 - SSH Overview & Setup
- Content Link Video/Getting started with Ansible Series
- Content Link Video/Kubernetes Cluster Installation using Ansible