Ansible Data Structures

Type of data structures Since Ansible is based on Python. There are two main data structures in Ansible: list and dictionary. List Initialization of a list - name: Initialize an empty list set_fact: list: [] Result is: {"list": []} Append element to a list - name: Append element to list set_fact: list: "{{ list + [ 'element_1' ] }}" Result is: {"list": ["element_1"]} Append multiple elements to a list - name: Get list of files in current directory shell: "ls" register: ls_files - name: Append filtered elements (only yaml file) to list set_fact: list: "{{ list + [ item ] }}" loop: "{{ ls_files.stdout_lines }}" when: "'yaml' in item" Result is: {"list": ["element_1", "list.yaml"]} if your current directory is for instance composed of: ...

December 18, 2023 · 3 min

Deploy hugo website to Github Pages

Hey! My first post is a dog eats dog post: I will give you the commands I used to deploy my blog using hugo framework to github pages. Sources: Quick start on official Hugo website Papermod Theme Installation Prerequisites git hugo cli Local setup Create a new hugo website This command will generate a template for hugo project. By default it will use .toml extension for the configuration file. You can also use .yaml extension by adding --config hugo.yaml to the first command. ...

November 28, 2023 · 3 min