12月 252020
 

Jenkins版本

Jenkins 2.263.1

Jenkins操作

SSH Server --> Test Configuration

错误提示

Failed to connect or change directory
jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection.

默认输出key格式

[root@iZwz92yjivclsut0awv6bjZ ~]# ssh-keygen -t ecdsa -b 256
Generating public/private ecdsa key pair.
Enter file in which to save the key (/root/.ssh/id_ecdsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_ecdsa.
Your public key has been saved in /root/.ssh/id_ecdsa.pub.
The key fingerprint is:
SHA256:bG0w07gnsQlE68UytVRe+ZlD21B9EeKN+OD4wmAf7cg root@iZwz92yjivclsut0awv6bjZ
The key's randomart image is:
+---[ECDSA 256]---+
| .o o.. .o +=|
| . = = .+ * o|
| = X oo = B.|
| . * X+ o * .|
| .oSo+o . . |
| ..=+= |
| E o |
| . |
| |
+----[SHA256]-----+
[root@iZwz92yjivclsut0awv6bjZ ~]# cat .ssh/id_ecdsa
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAaAAAABNlY2RzYS
1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQRs8Cw4Ydm7zowb4ZYpuqwqSfeaOXqw
byz0iL1KAsWJyA8swh/AG2eHW3HJd1QWYExeQBKGe/9kPBpdKP+JpVcmAAAAuO37TNHt+0
zRAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGzwLDhh2bvOjBvh
lim6rCpJ95o5erBvLPSIvUoCxYnIDyzCH8AbZ4dbccl3VBZgTF5AEoZ7/2Q8Gl0o/4mlVy
YAAAAhAOEdqVnSzZwrdb0QpuT6taMnF3LrIF+Wbo4TMMVnDcJiAAAAHHJvb3RAaVp3ejky
eWppdmNsc3V0MGF3djZialoBAgM=
-----END OPENSSH PRIVATE KEY-----
[root@iZwz92yjivclsut0awv6bjZ ~]#

指定输出key格式

[root@iZwz92yjivclsut0awv6bjZ ~]# ssh-keygen -t ecdsa -b 256 -m PEM
Generating public/private ecdsa key pair.
Enter file in which to save the key (/root/.ssh/id_ecdsa): 
/root/.ssh/id_ecdsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_ecdsa.
Your public key has been saved in /root/.ssh/id_ecdsa.pub.
The key fingerprint is:
SHA256:BsVkzYf82bO5QtF1gs85DN90JvyqGFSaMD9D2+xV+fI root@iZwz92yjivclsut0awv6bjZ
The key's randomart image is:
+---[ECDSA 256]---+
| o++ . o .|
| o+ * = +.B|
| . = X X @+|
| . O * & +|
| S. + o O |
| . . o + E|
| + . . |
| . o . |
| . |
+----[SHA256]-----+
[root@iZwz92yjivclsut0awv6bjZ ~]# cat .ssh/id_ecdsa
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIIPtHTiOHFbg0ib+xqpT/Ppu15gIVnnh1UGJjjZoiDr9oAoGCCqGSM49
AwEHoUQDQgAEp/PU4drzb49XzMmrnIa55Veb9K5coVX/67B6aNF3owQX3tCBSzFp
Y3BwI+m5jRZ8CDRwQgItF6jW6h8snr9xeg==
-----END EC PRIVATE KEY-----
[root@iZwz92yjivclsut0awv6bjZ ~]#

参数描述

-m key_format
Specify a key format for the -i (import) or -e (export) conversion options. The supported key formats are: “RFC4716” (RFC 4716/SSH2 public or private key), “PKCS8” (PEM PKCS8 public key) or “PEM” (PEM public key). The default conversion format is “RFC4716”.

 

2月 232020
 

查看系统版本和当前默认的Ansible安装版本信息

[root@ip-172-31-40-41 ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
[root@ip-172-31-40-41 ~]# yum info ansible
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * epel: mirrors.aliyun.com
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
Available Packages
Name        : ansible
Arch        : noarch
Version     : 2.9.3
Release     : 1.el7
Size        : 17 M
Repo        : epel/x86_64
Summary     : SSH-based configuration management, deployment, and task execution system
URL         : http://ansible.com
License     : GPLv3+
Description : Ansible is a radically simple model-driven configuration management,
            : multi-node deployment, and remote task execution system. Ansible works
            : over SSH and does not require any software or daemons to be installed
            : on remote nodes. Extension modules can be written in any language and
            : are transferred to managed machines automatically.

[root@ip-172-31-40-41 ~]#

Redhat Ansible 官方企业级扩展源RMP包

https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/

使用YUM安装当前最新版本2.9.5版本

[root@ip-172-31-40-41 ~]# yum install https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.9.5-1.el7.ans.noarch.rpm
Loaded plugins: fastestmirror
ansible-2.9.5-1.el7.ans.noarch.rpm                                |  17 MB  00:00:03     
Examining /var/tmp/yum-root-6qPFbn/ansible-2.9.5-1.el7.ans.noarch.rpm: ansible-2.9.5-1.el7.ans.noarch
Marking /var/tmp/yum-root-6qPFbn/ansible-2.9.5-1.el7.ans.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.9.5-1.el7.ans will be installed
--> Processing Dependency: python-paramiko for package: ansible-2.9.5-1.el7.ans.noarch
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * epel: fedora.cs.nctu.edu.tw
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
--> Processing Dependency: sshpass for package: ansible-2.9.5-1.el7.ans.noarch
--> Running transaction check
---> Package python-paramiko.noarch 0:2.1.1-9.el7 will be installed
---> Package sshpass.x86_64 0:1.06-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
 Package           Arch     Version              Repository                         Size
=========================================================================================
Installing:
 ansible           noarch   2.9.5-1.el7.ans      /ansible-2.9.5-1.el7.ans.noarch   103 M
Installing for dependencies:
 python-paramiko   noarch   2.1.1-9.el7          base                              269 k
 sshpass           x86_64   1.06-2.el7           extras                             21 k

Transaction Summary
=========================================================================================
Install  1 Package (+2 Dependent packages)

Total size: 103 M
Total download size: 290 k
Installed size: 104 M
Is this ok [y/d/N]:

查看已安装的Ansible版本信息

[root@ip-172-31-40-41 ~]# ansible --version
ansible 2.9.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
[root@ip-172-31-40-41 ~]#