Skip to content

Instantly share code, notes, and snippets.

@medival
Last active January 4, 2023 02:50
Show Gist options
  • Save medival/d8474deb9a11c03e757120391ea79083 to your computer and use it in GitHub Desktop.
Save medival/d8474deb9a11c03e757120391ea79083 to your computer and use it in GitHub Desktop.
library:
- title: The Alchemist
author: Paulo Coelho
year: 1988
- title: Moby Dick
author: Herman Melville
year: 1851
- title: Pride and Prejudice
author: Jane Austen
year: 1813
---
## Scalar
<key>: <value>
---
## String
plaform: StudiDevOps
about: |
StudiDevOps merupakan
Sebuah Platform
Belajar tentang DevOps Stack
history: >
StudiDevOps didirikan oleh
Vicky Anggara
pada tahun 2021
materi: "[Container] & {Kubernetes} - <Nomad>"
apakahBagus: yes
---
## Comment
isYAMLSupportComment: true #Yes its
# In case you need
# Multi comment
# Use like this
---
## Implict dan Explicit type data
# Boolean Explicit
YAMLbetterthanJSON: !!bool true
isPlutoAPlane: !!bool false
# Integer
negative16: !!int -16
zero: !!int 0
positive17: !!int 17
# Float
negativePhi: !!float -3.14
zeroFloat: !!float 0
positiveFloat: !!float 16
# String
sampleNumString: !!str 8.14
sampleString: !!str StudiDevOps
sampleDate: !!str 1989-06-16
# Timestamp explicit declaration
randomDate: !!timestamp 2023-12-12 23:59:59
# Null explicit declaration
thisHasNull: !!null null
## Timestamp
canoical: 2022-12-12T23:59:59.1Z
iso8601: 2022-12-12T23:01:23.10-07:00
space separated: 2022-12-12 22:23:24.10-07
no time zone (Z): 2022-12-31 5:22:45.10
date (00:00:00Z): 2022-12-31
iso8601_string: 2022-12-12T23:01:23.10+07:00
no_time_zone": 2022-12-31 5:22:45.10 #YAML detect in UTC time zone
## SEQUENCE/COLLECTION
# List sequence with block style
cloud-provider:
- AWS
- GCP
- AZURE
# List sequence with flow style
datacenters: [singapore, jakarta, thailand]
# Nested sequence
products:
- AWS
- Elastic Kubernetes Service (EKS)
- EC2
- GCP
- Google Kubernetes Engine (GKE)
- Compute Engine
- AZURE
- Azure Kubernetes Service (AKS)
- Azure Compute
## Dictionaries
AWS:
Server:
- Nomad:
environment: development
nomad_ui: nomad-ui.development.studidevops.com
nomad_region: asia-southeast2
- Consul:
environment: development
consul_ui: consul-ui.development.studidevops.com
consul_region: asia-southeast1
- Vault:
environment: development
vault_ui: vault-ui.development.studidevops.com
vault_region: asia-southeast2
# Config
Database:
mysql:
host: 102.21.45.58
port: 3306
password: Sup3rS3cr3t
database_name: product
environment: development
datacenter: onpremise
postgresql:
host: 48.55.34.128
password: 3306
database_name: payment
environment: production
datacenter: gcp
# schema
ObjectName:
- keyObject:
componentObject1: value
componentObject2: value
- keyObject:
## Complex
? This key has
multiple lines
: and this the value
? - Development
- UAT
- Prod
: - http://dev.studidevops.com
- http://staging.studidevops.com
- http://studidevops.com
## Anchor and Alias
definitions:
days:
- weekday: &working
wakeup: 60:00 AM
activites:
- workout
- meetings
- work
- meditation
- sleep
sleeptime: 10:00 PM
schedules:
days:
weekdays:
- monday: *working
## DB Config
config:
databases:
- mysql: &mysql_db # Anchor
mysql_hostname: ifs.studidevops.com
mysql_port: 3306
mysql_username: admin
mysql_password: Sup3rS3cr3t
mysql_database: production
- postgresql: &postgre_db # Anchor
postgre_hostname: payment.studidevops.com
postgre_port: 5432
postgre_username: administrator
postgre_password: t0pS3cr3t
postgre_database: payment
datacenter:
onpremis:
- service-payment: *postgre_db # Aliases
cloud:
- service-merchant: *mysql_db # Aliases
- service-payment-va: *postgre_db #Aliases
## OVERIDE ANCHOR VALUE
override-config:
databases:
- mysql: &mysql_db # Anchor
mysql_hostname: ifs.studidevops.com
mysql_port: 3306
mysql_username: admin
mysql_password: Sup3rS3cr3t
mysql_database: production
- postgresql: &postgre_db # Anchor
postgre_hostname: payment.studidevops.com
postgre_port: 5432
postgre_username: administrator
postgre_password: t0pS3cr3t
postgre_database: payment
datacenter:
onpremis:
- service-payment: *postgre_db # Aliases
cloud:
- service-merchant: *mysql_db # Aliases
- service-payment-va:
<<: *postgre_db # Override value hostname on aliases postgre_sql
postgre_hostname: internal-payment.studidevops.com
## Multi Document Support
---
config-development:
database:
mysql_hostname: development.studidevops.com
mysql_port: 3306
mysql_username: admin
mysql_password: Sup3rS3cr3t
mysql_database: development
---
config-production:
database:
mysql_hostname: payment.studidevops.com
mysql_port: 3306
mysql_username: admin
mysql_password: IFN1cDNyUzNjcjN0
mysql_database: db-production
## YQ Tools
How to Install:
macOs: brew install yq
linux: sudo add-apt-repository ppa:rmescandon/yq && sudo apt-get install yq
alt-linux: apt-get install software-properties-common && sudo apt-get install yq
windows: download executable files at https://github.com/mikefarah/yq/releases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment