官术网_书友最值得收藏!

  • Learning DevOps
  • Mikael Krief
  • 304字
  • 2021-06-24 12:32:10

Installing Ansible with a script

Unlike Terraform, Ansible is not multiplatform and can only be installed on the following OSes: Red Hat, Debian, CentOS, macOS, or any of the BSDs, and its installation is done by a script that differs according to your OS.

For example, to install its latest version on Ubuntu, we must run the following script in a Bash Terminal:

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

This script updates the packages, installs the software-properties-common dependency, adds the Ansible repository, and finally, installs the latest version of Ansible.

Ansible installation scripts for all distribution types are available here:  https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-the-control-machine.

To install Ansible locally on a Windows OS machine, there is no native solution, but it can be installed on the WSL. WSL allows developers who are on a Windows OS to test their scripts and applications directly on their workstation without having to install a virtual machine.

For more details about WSL, read the documentation here:  https://docs.microsoft.com/en-us/windows/wsl/about.

To test whether it has been successfully installed, we can run the following command to check its installed version:

ansible --version

The result of the execution of this command provides some information on the installed version of Ansible, like this:

To display a list of all Ansible commands and options, execute the ansible command with the --help argument:

ansible --help

The following screenshot shows the execution of this command:

The installation of Ansible on a local machine or a remote machine is therefore quite simple and can be automated by a script. If we deploy an infrastructure in Azure, we can also use Ansible as it is integrated into Azure Cloud Shell.

Let's now look at how Ansible is integrated into Azure Cloud Shell.

主站蜘蛛池模板: 大邑县| 政和县| 宁远县| 中江县| 顺平县| 略阳县| 怀化市| 襄垣县| 沛县| 延川县| 连云港市| 得荣县| 仙居县| 腾冲县| 隆林| 抚顺市| 隆德县| 红河县| 蒲江县| 南昌县| 乐清市| 社旗县| 吉安县| 陈巴尔虎旗| 汕头市| 开江县| 邮箱| 鄂托克旗| 泸溪县| 罗江县| 晋江市| 常熟市| 深泽县| 罗江县| 梅河口市| 承德市| 湟中县| 吴忠市| 高雄市| 邹城市| 旅游|