ansible-tw/AMA

Install sshpass for Ansible 2.3.1 on macOS 10.11

chusiang opened this issue ยท 2 comments

I need install the sshpass for control managed nodes with passwords, but the homebrew default can't find this package.

$ ansible --version
ansible 2.3.1.0
  config file = /Users/jonny/vcs/foo.ansible.role/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Dec 17 2016, 23:03:43) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

Before 2.3.0, I didn't need installed the sshpass, but now it's not working. ๐Ÿ˜ข

$ ansible all -m ping
server1 | FAILED! => {
    "failed": true,
    "msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"
}

We can't install the sshpass with homebrew by default.

$ brew search sshpass
We won't add sshpass because it makes it too easy for novice SSH users to
ruin SSH's security.

Manual create a sshpass formula of homebrew.

$ brew create https://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz --force

Install it !

$ brew install sshpass
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from fd333392 to 3fe32053.
Updated 2 taps (caskroom/cask, homebrew/core).
==> Updated Formulae
archi-steam-farm     docutils             libbluray            ndpi                 prometheus
aws-sdk-cpp          druid                luvit                node โœ”               s6
cockroach            fd                   msgpack โœ”            node-build           translate-toolkit

==> Using the sandbox
==> Downloading https://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz
Already downloaded: /Users/jonny/Library/Caches/Homebrew/sshpass-1.06.tar.gz
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/sshpass/1.06
==> make install
๐Ÿบ  /usr/local/Cellar/sshpass/1.06: 9 files, 42.6KB, built in 7 seconds

Finally, it's working, now !!! ๐Ÿ˜Ž

$ ansible all -m ping
server1 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Reference

I can't make install the sshpass v1.06 on macOS v10.15.4, so I copy the binary from macOS v10.11.6. It's working now.

sshpass-1.06.zip

md5sum.

[ chusiang@unicorn ~ ] - 11:51
$ md5 sshpass sshpass-1.06.zip
MD5 (sshpass) = 6bbdf91b8c8fad7159a77de733a1a1eb
MD5 (sshpass-1.06.zip) = dd0c84144fcc75d6046a5627812da89d

sha256 checksum:

[ chusiang@unicorn ~ ] - 11:51
$ shasum -a 256 sshpass sshpass-1.06.zip
550b5ae614a4b0b5db7141a71908a2ef1f7dd74a753301e26668531d1beb8b0a  sshpass
0735cf3bfcc599c2da6427d4d6cee9e871535dd31bd9eea7e6bd21051661619a  sshpass-1.06.zip

brew install --build-from-source sshpass