云网牛站
所在位置:首页 > Linux教程 > 在Ubuntu 18.04系统中安装Ansible 2.7.5的方法

在Ubuntu 18.04系统中安装Ansible 2.7.5的方法

2019-01-13 22:06:40作者:AK蜗牛稿源:LINUX站

本文介绍快速安装Ansible的方法,目前安装的版本是2.7.5,Ubuntu系统版本是18.04,其它Linux版本的安装方法请参考在RHEL 8/CentOS 8系统上安装和配置Ansible

 

总结起来就下面几条命令

注:安装Ansible 2.7.5只需要在Ubuntu 18.04系统终端中输入以下五个命令:

sudo apt install software-properties-common

sudo apt-add-repository ppa:ansible/ansible

sudo apt update

sudo apt install ansible

ansible --version

在Ubuntu 18.04系统中安装Ansible 2.7.5的方法

 

第一步、增加软件源

###如果你没有安装的话,请运行以下命令:

axing@Docker_LD8:~$ sudo apt install software-properties-common

Reading package lists... Done

Building dependency tree

Reading state information... Done

software-properties-common is already the newest version (0.96.20.7).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

###增加Ansible软件源:

axing@Docker_LD8:~$ sudo apt-add-repository ppa:ansible/ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.

[http://ansible.com/](http://ansible.com/)

More info: [https://launchpad.net/~ansible/+archive/ubuntu/ansible](https://launchpad.net/~ansible/+archive/ubuntu/ansible)

Press [ENTER] to continue or ctrl-c to cancel adding it

###按回车继续安装:

gpg: keyring `/tmp/tmpzzsbegma/secring.gpg' created

gpg: keyring `/tmp/tmpzzsbegma/pubring.gpg' created

gpg: requesting key 7BB9C367 from hkp server [keyserver.ubuntu.com](http://keyserver.ubuntu.com/)

gpg: /tmp/tmpzzsbegma/trustdb.gpg: trustdb created

gpg: key 7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported

gpg: Total number processed: 1

gpg: imported: 1  (RSA: 1)

OK

 

第二步、更新软件,然后安装Ansible

axing@Docker_LD8:~$ sudo apt update

Get:1 [http://security.ubuntu.com/ubuntu](http://security.ubuntu.com/ubuntu) xenial-security InRelease [107 kB]

Hit:2 [http://gb.archive.ubuntu.com/ubuntu](http://gb.archive.ubuntu.com/ubuntu) xenial InRelease

Hit:3 [http://ppa.launchpad.net/ansible/ansible/ubuntu](http://ppa.launchpad.net/ansible/ansible/ubuntu) xenial InRelease

Get:4 [http://gb.archive.ubuntu.com/ubuntu](http://gb.archive.ubuntu.com/ubuntu) xenial-updates InRelease [109 kB]

Get:5 [http://gb.archive.ubuntu.com/ubuntu](http://gb.archive.ubuntu.com/ubuntu) xenial-backports InRelease [107 kB]

Get:6 [https://download.docker.com/linux/ubuntu](https://download.docker.com/linux/ubuntu) xenial InRelease [66.2 kB]

Hit:7 [https://packages.microsoft.com/repos/vscode](https://packages.microsoft.com/repos/vscode) stable InRelease

Get:8 [http://security.ubuntu.com/ubuntu](http://security.ubuntu.com/ubuntu) xenial-security/multiverse amd64 Packages [3,724 B]

Get:9 [http://security.ubuntu.com/ubuntu](http://security.ubuntu.com/ubuntu) xenial-security/multiverse i386 Packages [3,888 B]

Err:6 [https://download.docker.com/linux/ubuntu](https://download.docker.com/linux/ubuntu) xenial InRelease

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8

Reading package lists... Done

W: GPG error: [https://download.docker.com/linux/ubuntu](https://download.docker.com/linux/ubuntu) xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8

E: The repository '[https://download.docker.com/linux/ubuntu](https://download.docker.com/linux/ubuntu) xenial InRelease' is not signed.

N: Updating from such a repository can't be done securely, and is therefore disabled by default.

N: See apt-secure(8) manpage for repository creation and user configuration details.

###安装Ansible,我装好了,为了拷屏又装了一次,提示已经是最新版了。

axing@Docker_LD8:~$ sudo apt install ansible

Reading package lists... Done

Building dependency tree

Reading state information... Done

ansible is already the newest version (2.7.5-1ppa~xenial).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

 

第三步、查看Ansible版本

axing@Docker_LD8:~$ ansible --version

ansible 2.7.5

config file = /etc/ansible/ansible.cfg

configured module search path = [u'/home/axing/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']

ansible python module location = /usr/lib/python2.7/dist-packages/ansible

executable location = /usr/bin/ansible

python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]

根据上面信息得出的结论:在Ubuntu 18.04系统中安装Ansible 2.7.5成功。

 

相关主题

详细介绍使用Ansible来实现网络自动化

精选文章
热门文章