aws Profiles

Today I learned about aws named profiles. They are defined as follows: [user1] aws_access_key_id=AKIAI44QH8DHBEXAMPLE aws_secret_access_key=je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY and used as follows aws ec2 describe-instances --profile user1 More here...

December 13, 2021 · 1 min · Iduoad

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