Indlæg

Viser indlæg fra 2018

Installing Ansible on Ubuntu 18.04 and running simple commands

INSTALL:
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt update
sudo apt install ansible

CONFIGURE:
*Edit '/etc/ansible/hosts'
*Define 'hosts' - or Ansible clients. Create a group called 'ahosts':

[ahosts]
host1 ansible_ssh_host=192.168.1.28

*Tell Ansible to use python interpreter in path /usr/bin/python3 (shipped with Ubuntu 18.04)

[servers:vars]
ansible_python_interpreter=/usr/bin/python3

*Tell Ansible to use username 'ak' when connecting to hosts (if not using SSH keys):
*Make dir '/etc/ansible/group_vars'
*Edit '/etc/ansible/group_vars/servers'

---
ansible_ssh_user: ak

RUN COMMAND ON HOSTS IN GROUP 'ahosts' AND ASK FOR SSH PASSWORD:
ansible --ask-pass -m ping ahosts

RUN COMMAND ON HOSTS 'host1' AND 'host2' AND ASK FOR SSH PASSWORD:
ansible --ask-pass -m ping host1:host2

RUN SHELL COMMAND ON HOSTS IN GROUP 'ahosts' AND ASK FOR SSH PASSWORD:
ansible --ask…

2 finger scroll fix on Ubuntu 17.10

2 finger scrolling stopped working on my Ubuntu 17.10. This will fix the issue, but will have to be rerun after laptop sleep or reboot:

sudo modprobe -r psmouse
sudo modprobe psmouse

Data leak prevention for Danish social security numbers (regular expression)

I've created a regular expression to prevent leaking Danish social security numbers via e-mails.

I use this filter in my SPAM filter/SMTP (outgoing and incoming) server (SpamTitan) and it will match both 123456-7890 and 1234567890:

(\W|^)[0-9][0-9][0-9][0-9][0-9][0-9](-| |)[0-9][0-9][0-9][0-9](\W|$)

Delete files older than with PowerShell

I run this script on a Windows server to delete files older than X days. The files are backup files from a LINUX/Ubuntu server.