Thursday, May 11, 2017

Ansible 2.3 on Solaris 11.3

Ansible 2.3 on Solaris 11.3

Let's automate some tasks we do all the time.

Yes I know, I could use Puppet, but the Puppet version bundled with Solaris 11.3 is rather old (3.6.2) and some modules are broken (e.g. "ldap provider always finds authentication_method out of sync (Bug 22166490)"). So we'll use Ansible instead.

$ wget http://releases.ansible.com/ansible/ansible-2.3.1.0.tar.gz

# cd /opt
# gzcat .../ansible-2.3.1.0.tar.gz | tar xf -
# cat ansible-2.3.1.0/requirements.txt
...
jinja2
PyYAML
paramiko
pycrypto >= 2.6
setuptools

Seems like we need some Python modules to get Ansible working. Let's install them.

# pkg install --no-backup-be jinja2 pyyaml setuptools
           Packages to install: 22
...

We don't need paramiko and pycrypto (we'll use SSH instead), see Replace PyCrypto usage with cryptography.io #13075.

To speed things up we need an SSH client that supports ControlPersist. So let's install OpenSSH as well and make it the default.

# pkg install --no-backup-be network/openssh
           Packages to install:  1
...
# pkg set-mediator --no-backup-be -I openssh ssh
            Packages to change:  3
...

Does it work?

# PYTHONPATH=/opt/ansible-2.3.1.0/lib /opt/ansible-2.3.1.0/bin/ansible --version
ansible 2.3.1.0
  config file =
  configured module search path = Default w/o overrides
  python version = 2.7.9 (default, Dec  1 2016, 10:32:39) [C]

# PYTHONPATH=/opt/ansible-2.3.1.0/lib /opt/ansible-2.3.1.0/bin/ansible localhost -m ping
 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available

localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Good. Time to write our first Playbook...

Links

No comments:

Post a Comment

389 Directory Server 1.3.x LDAP client authentication

389 Directory Server 1.3.x LDAP client authentication Last time we did a multi-master replication setup, see 389 Directory Server 1.3.x Repl...