Some Example Ansible Loops
Having been using Ansible for a bit now I’ve found these loops quite useful. Installing multiple packages: – name: Install
Ctrl-Alt-Del to shutdown Ubuntu server.
ln -s /lib/systemd/system/poweroff.target /etc/systemd/system/ctrl-alt-del.target then reset systemd daemon: systemctl daemon-reload
autodiscover.xml & /mail/config-v1.1.xml for Outlook & Thunderbird email clients using postfixadmin
Postfixadmin setup https://www.exratione.com/2016/05/a-mailserver-on-ubuntu-16-04-postfix-dovecot-mysql/ Autoconfiguration of email clients: The Perl Script: https://github.com/virtualmin/virtualmin-gpl/blob/master/autoconfig.cgi The Apache config: https://serverfault.com/questions/829260/block-requests-from-bots-by-pattern-in-apache-with-mod-rewrite-mod-rewrite-not The STARTTLS problem https://www.virtualmin.com/node/52609 The
Networking bug upgrading Ubuntu LTS-14 to LTS-16
virsh and lxc cannot access their interfaces? touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf to create a new empty config file then reboot. Details here:
Making an ISO of a CD
isoinfo -d -i /dev/cdrom Make note of “blocksize” and “count” dd if=/dev/cdrom bs=blocksize count=count of=/path/to/image.iso
When X applications refused to connect over ssh
Check xauth is installed Connection to localhost failing: Add “X11UseLocalHost no” to /etc/ssh/sshd_config (common if ipv6 localhost exists but IPv6
Outlook with email, calendar & contact sync
https://sourceforge.net/projects/outlookcaldavsynchronizer/ is an Outlook plugin that will sync with gmail or any other calDAV server. eg: https://www.cyrusimap.org/ (Email, contacts & calendar server)
To create a Samba PDC on a Ubuntu VM
Add server to /etc/hosts & /etc/hostname. eg: 172.16.0.1 pdc.WINDOMAIN.domain.org.uk WINDOMAIN.domain.org.uk pdc /etc/network/interfaces to contains: * dns-nameservers 172.16.0.1 208.67.222.222 208.67.220.220 (Open
How to bounce a tcp port to another server using iptables
/sbin/iptables -A PREROUTING -t nat -p tcp -d oldIP –dport oldport -j DNAT –to newIP:newport /sbin/iptables -A FORWARD
How to add smart relay to exim on cPanel server
edit /etc/exim.conf.local Add the following lines: @ROUTERSTART@ smart_route: driver = manualroute domains = !+local_domains transport = remote_smtp route_list = *