Disable USB device

To disable USB device (audio device from Dell WD-19TB dock station in the example) when connecting it to your laptop, find it’s ids:

sudo lsusb -v

For example:

...
Bus 005 Device 007: ID 0bda:402e Realtek Semiconductor Corp. USB Audio
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0bda Realtek Semiconductor Corp.
  idProduct          0x402e 
  bcdDevice            0.01
  iManufacturer           3 Generic
  iProduct                1 USB Audio
  iSerial                 2 200901010001
...

Save idVendor and idProduct values.

Create new file /lib/udev/rules.d/90-delldock.rules with the following content:

ACTION=="add", ATTR{idVendor}=="0bda", ATTR{idProduct}=="402e", RUN="/bin/sh -c 'echo 1 >/sys/\$devpath/remove'"

When the device is connected it will be automatically removed and your system won’t know about it

| 18 Mar 2022

Do not start LXD containers on boot

For all newly created containers:

lxc profile set default boot.autostart=false

Or for existing container:

lxc config set <container_name> boot.autostart false
| 28 Feb 2022

Profile Ansible playbooks

Install profiling module:

ansible-galaxy collection install ansible.posix

Enable profiling in ansible.cfg in [defaults] section:

callback_whitelist = ansible.posix.profile_tasks
| 14 Feb 2022

Unable to start Podman containers in LXD

[root@fe ~]# podman run hello-world
ERRO[0000] 'overlay' is not supported over extfs at "/var/lib/containers/storage/overlay" 
Error: kernel does not support overlay fs: 'overlay' is not supported over extfs at "/var/lib/containers/storage/overlay": backing file system is unsupported for this graph driver

To fix this error, you’ll need to edit /etc/containers/storage.conf file and make sure that it contains the following options:

[storage]
driver = "overlay"
[storage.options]
mount_program = "/usr/bin/fuse-overlayfs"

Run the following command to verify the result:

podman --log-level=debug ps -a
| 5 Feb 2022

How to check which cipher suites are supported by a website

sudo dnf install sslscan
sslscan example.com
| 24 Jan 2022

Ansible: List all vars of the host

ansible stag-s4 -m debug -a "var=hostvars[inventory_hostname]"
| 18 Jan 2022

Change DNS nameservers using NetworkManager

sudo nmcli connection modify <connection name> ipv4.dns "1.1.1.1 8.8.8.8"

Apply changes:

sudo nmcli dev reapply <interface>
| 30 Dec 2021

How to reload the connection with NetworkManager

Reload interface configuration:

sudo nmcli connection reload

This command will ONLY make NetworkManager aware of new configuration changes. To apply the new changes, run the following command:

sudo nmcli dev reapply <interface>
| 30 Dec 2021

Wait until DNS propagates

until [[ -n $(dig new.mydomain.com A +short @1.1.1.1) ]]; do echo "waiting..." && sleep 5; done

-n flag stands for non-empty string

| 22 Dec 2021

Install module (collection) in Ansible

ansible-galaxy collection install containers.podman
| 21 Dec 2021