Gitlab optional needs

Today I learned about optional needs which a cool feature introduced to gitlab ci, months ago. If you have a job that needs another job, and the latter can be missing due to if or only directives, you can mention it as an optional dependency. This useful in a lot of usecases. I needed it for a job that depends on two others one of them is should be optional....

June 18, 2021 · 1 min · Iduoad

Ansible error handling

Today I learned how to handle errors in ansible using block/rescue blocks. block can be used to group a set of related tasks. tasks: - name: Handle the error block: - name: Print a message ansible.builtin.debug: msg: 'I execute normally' - name: Force a failure ansible.builtin.command: /bin/false - name: Never print this ansible.builtin.debug: msg: 'I never execute, due to the above task failing, :-(' rescue: - name: Print when errors ansible....

April 22, 2021 · 1 min · Iduoad

Ansible Parted Module

Today I learned how to create and manipulate partitions with ansible using the parted module. One useful tip, that is not listed in documentation, is using the device information in order to create partitions appropriately. For example to create a partition that start where the last partion begins ans space all the space left. - name: Create partition if it does not exist community.general.parted: device: /dev/vdb number: "{{ device_info.partitions | length }}" flags: [ lvm ] part_end: "100%" part_start: "{{ device_info....

April 22, 2021 · 1 min · Iduoad

LXD SQL

Today I learned how to alter lxd state by querying the internal database. lxd sql global "select * from storage_pools" lxd sql global "delete from storage_pools where id=4" ...

April 21, 2021 · 1 min · Iduoad

Ansible Dpkg Selections

Today I learned about the dpkg_selections module in ansible. It is used to mark packages as hold, install … It can be used to implement some apt mark functionalities. Docs...

April 12, 2021 · 1 min · Iduoad

Nginx regex location with proxy_pass

Today I learned, how I can use Regex in location with proxy_pass. By default it is not supported by nginx, but we can capture the url with location and then pass it to the proxy_pass. Another solution is do a rewrite...break then do a proxy_pass. Source...

March 18, 2021 · 1 min · Iduoad

Qemusystem vs Qemusession

Today I learned the difference between qemu:///system and qemu:///session. qemu:///system The system libvirtd instance qemu:///system launches the vms using the unpriviliges use qemu. And can grant the vm selective access to root owned resources. Access to qemu:///system is mediated using polkit and any user wanting to access it should provite the root password. By default users in the libvirt group have access to libvirtd (the group can be changed in polkit config) VMs are run as the default user qemu, and cannot access user files if the frontend application (virt-manager) is running another user....

March 10, 2021 · 1 min · Iduoad