Posts tagged python3

ansible, python3, ubuntu16.04

posted on 2017-08-21 00:19

ansible by default always runs with /usr/bin/env python.

Discussions with the devs lead nowhere as can be seen when looking for this, mpdehaan always seems to live up to his reputation of very being difficult to talk to.

To have a setup that is eventually working for testing purposes without having to resort to making the original symlinks to point to python3, using python's virtual environment framework seemed a rather good idea at the beginning. Little did I know.

To also not running into ugly issues with zipfiles like I did with earlier verions of the 2.x series, another step was to run directly the git version. Since the versions in there are tagged, changing versions via git checkout is possible, compared to the buggy pip versions or the outdated package from the distribution's upstream (tested with debians and earlier ubuntus)... right?

Wrong, the current version when writing this is almost 2.4 and somewhere along the way the devs obviously stopped tagging:

(playbooks) root@ss-ansible:/opt/ansible# PAGER=cat git log --oneline --decorate=full | grep tag:
07b588f (tag: refs/tags/v2.0.0-0.5.beta3) Version bump for new beta 2.0.0-0.5.beta3
de54f26 (tag: refs/tags/v2.0.0-0.4.beta2) Update submodule refs
5ae74f7 (tag: refs/tags/v2.0.0-0.3.beta1) Version bump for 2.0.0-0.3.beta1
70677b0 (tag: refs/tags/v2.0.0-0.2.alpha2) Version bump for 2.0.0-0.2.alpha2
2df6513 (tag: refs/tags/v2.0.0-0.1.alpha1) Version bump for v2.0.0-0.1.alpha1 and submodule updates
ab55000 (tag: refs/tags/v1.6.0) Update packaging dates for the 1.6.0 release
16c05cb (tag: refs/tags/v1.5.1) Update files for 1.5.1 release.
6221a27 (tag: refs/tags/v1.5.0, refs/remotes/origin/release1.5.0) Updating files for new upstream release 1.5.0
2a58c2b (tag: refs/tags/v1.4.0) Update files for 1.4 release
f67c13f (tag: refs/tags/v1.2) Update packaging dates in preparation for release.
2f944d8 (tag: refs/tags/v1.1) Merge pull request #2547 from jsmartin/cloudformation
6a64e9f (tag: refs/tags/v1.0) Update changelog
2bf9a92 (tag: refs/tags/0.7) Don't load plugins starting with "_".
4d62510 (tag: refs/tags/0.3) Version bump for 0.3 release
09e690f (tag: refs/tags/0.0.2) Indentation error causing forks to not be parallel.  Ahem :)
2e1b59a (tag: refs/tags/0.0.1) restructure the examples directory
56de2e1 (tag: refs/tags/0.01) Update

Be that as it may, I still may need to use ansible at work when writing this. After 1,5 years using it, I actually want to change from it for various reasons, but sadly I can't, so here we go.

Complete script to install:


## python3 + ubuntu16.04 + ansible = steaming pile of shit
## but after this you have a complete environment as of 8/2017
## all needed software will be installed, plus env vars be fixed, too

#virtualenv plus ansible dependencies
apt install python-minimal python-pip -y
export LC_ALL=C
pip install --upgrade pip
pip install virtualenv
pip install virtualenvwrapper

echo "export WORKON_HOME=$HOME/.virtualenvs
export LC_ALL=C
. /usr/local/bin/" >> ~/.bashrc

export WORKON_HOME=$HOME/.virtualenvs
export LC_ALL=C
. /usr/local/bin/

mkproject -p python3 playbooks
echo "workon playbooks" >> ~/.bashrc
workon playbooks
pip install pyyaml
pip install jinja2

cd /opt
apt install git -y
git clone --progress
echo '. /opt/ansible/hacking/env-setup' >> ~/.bashrc

cd ~/playbooks

echo "[defaults]
hostfile = inventory/hosts
host_key_checking = False
ansible_ssh_user = root
ansible_ssh_port = 22
ansible_connection = smart
ansible_shell_type = sh" > ansible.cfg

echo logout and login again, or you don\'t have a fixed environment!

This blog covers .csv, .htaccess, .pfx, .vmx, /etc/crypttab, /etc/network/interfaces, /etc/sudoers, /proc, 10.04, 14.04, 16.04, AS, ASA, ControlPanel, DS1054Z, GPT, HWR, Hyper-V, IPSEC, KVM, LSI, LVM, LXC, MBR, MTU, MegaCli, PHP, PKI, PS1, R, RAID, S.M.A.R.T., SNMP, SSD, SSL, TLS, TRIM, VEEAM, VMware, VServer, VirtualBox, Virtuozzo, XenServer, acpi, adaptec, algorithm, ansible, apache, apache2.4, apachebench, apple, applet, arcconf, arch, architecture, areca, arping, asa, asdm, autoconf, awk, backup, bandit, bar, bash, benchmarking, binding, bitrate, blackarmor, blockdev, blowfish, bochs, bond, bonding, booknotes, bootable, bsd, btrfs, buffer, c-states, cache, caching, ccl, centos, certificate, certtool, cgdisk, cheatsheet, chrome, chroot, cisco, clamav, cli, clp, clush, cluster, cmd, coleslaw, colorscheme, common lisp, configuration management, console, container, containers, controller, cron, cryptsetup, csync2, cu, cups, cygwin, d-states, database, date, db2, dcfldd, dcim, dd, debian, debug, debugger, debugging, decimal, desktop, df, dhclient, dhcp, diff, dig, display manager, dm-crypt, dmesg, dmidecode, dns, docker, dos, drivers, dtrace, dtrace4linux, du, dynamictracing, e2fsck, eBPF, ebook, efi, egrep, emacs, encoding, env, error, ess, esx, esxcli, esxi, ethtool, evil, expect, exportfs, factory reset, factory_reset, factoryreset, fail2ban, fakeroot, fbsd, fdisk, fedora, file, files, filesystem, find, fio, firewall, firmware, fish, flashrom, forensics, free, freebsd, freedos, fritzbox, fsck, fstrim, ftp, ftps, g-states, gentoo, ghostscript, git, git-filter-branch, gitbucket, github, gitolite, global, gnutls, gradle, grep, grml, grub, grub2, guacamole, hardware, haskell, hdd, hdparm, hellowor, hex, hexdump, history, howto, htop, htpasswd, http, httpd, https, i3, icmp, ifenslave, iftop, iis, imagemagick, imap, imaps, init, innoDB, innodb, inodes, intel, ioncube, ios, iostat, ip, iperf, iphone, ipmi, ipmitool, iproute2, ipsec, iptables, ipv6, irc, irssi, iw, iwconfig, iwlist, iwlwifi, jailbreak, jails, java, javascript, javaws, js, juniper, junit, kali, kde, kemp, kernel, keyremap, kill, kpartx, krypton, lacp, lamp, languages, ldap, ldapsearch, less, leviathan, liero, lightning, links, linux, linuxin3months, lisp, list, livedisk, lmctfy, loadbalancing, locale, log, logrotate, looback, loopback, losetup, lsblk, lsi, lsof, lsusb, lsyncd, luks, lvextend, lvm, lvm2, lvreduce, lxc, lxde, macbook, macro, magento, mailclient, mailing, mailq, make-jpkg, manpages, markdown, mbr, mdadm, megacli, micro sd, microsoft, minicom, mkfs, mktemp, mod_pagespeed, mod_proxy, modbus, modprobe, mount, mouse, movement, mpstat, multitasking, myISAM, mysql, mysql 5.7, mysql workbench, mysqlcheck, mysqldump, nagios, nas, nat, nc, netfilter, networking, nfs, nginx, nmap, nocaps, nodejs, numberingsystem, numbers, od, onyx, opcode-cache, openVZ, openlierox, openssl, openvpn, openvswitch, openwrt, oracle linux, org-mode, os, oscilloscope, overview, parallel, parameter expansion, parted, partitioning, passwd, patch, pct, pdf, performance, pfsense, php, php7, phpmyadmin, pi, pidgin, pidstat, pins, pkill, plasma, plesk, plugin, posix, postfix, postfixadmin, postgres, postgresql, poudriere, powershell, preview, profiling, prompt, proxmox, ps, puppet, pv, pveam, pvecm, pvesm, pvresize, python, python3, qemu, qemu-img, qm, qmrestore, quicklisp, quickshare, r, racktables, raid, raspberry pi, raspberrypi, raspbian, rbpi, rdp, redhat, redirect, registry, requirements, resize2fs, rewrite, rewrites, rhel, rigol, roccat, routing, rs0485, rs232, rsync, s-states, s_client, samba, sar, sata, sbcl, scite, scp, screen, scripting, seafile, seagate, security, sed, serial, serial port, setup, sftp, sg300, shell, shopware, shortcuts, showmount, signals, slattach, slip, slow-query-log, smbclient, snmpget, snmpwalk, software RAID, software raid, softwareraid, sophos, spacemacs, spam, specification, speedport, spi, sqlite, squid, ssd, ssh, ssh-add, sshd, ssl, stats, storage, strace, stronswan, su, submodules, subzone, sudo, sudoers, sup, swaks, swap, switch, switching, synaptics, synergy, sysfs, systemd, systemtap, tar, tcpdump, tcsh, tee, telnet, terminal, terminator, testdisk, testing, throughput, tmux, todo, tomcat, top, tput, trafficshaping, ttl, tuning, tunnel, tunneling, typo3, uboot, ubuntu, ubuntu 16.04, ubuntu16.04, udev, uefi, ulimit, uname, unetbootin, unit testing, upstart, uptime, usb, usbstick, utf8, utm, utm 220, ux305, vcs, vgchange, vim, vimdiff, virtualbox, virtualization, visual studio code, vlan, vmstat, vmware, vnc, vncviewer, voltage, vpn, vsphere, vzdump, w, w701, wakeonlan, wargames, web, webdav, weechat, wget, whois, wicd, wifi, windowmanager, windows, wine, wireshark, wpa, wpa_passphrase, wpa_supplicant, x11vnc, x2x, xfce, xfreerdp, xmodem, xterm, xxd, yum, zones, zsh

Unless otherwise credited all material Creative Commons License by sjas