This page contains some useful snippets to get started when writing a DevOps as Code YAML file for XL Deploy.

Create infrastructure

Use the Infrastructure kind to set up servers and cloud / container endpoints. You can specify a list of servers in the spec section.

apiVersion: xl-deploy/v1
kind: Infrastructure
spec:
- name: Infrastructure/Apache  host
  type: overthere.SshHost
  os: UNIX
  address: tomcat-host.local
  username: tomcatuser
- name: Infrastructure/local-docker
  type: docker.Engine
  dockerHost: http://dockerproxy:2375
- name: aws
  type: aws.Cloud
  accesskey: YOUR ACCESS KEY
  accessSecret: YOUR SECRET

Create environments with dictionary

Create environments and dictionaries.

apiVersion: xl-deploy/v1
kind: Environments
spec:
- name: AWS Dictionary
  type: udm.Dictionary
  entries:
    region: eu-west-1
    username: aws-user
- name: AWS
  type: udm.Environment
  members:
  - ~Infrastructure/aws
  dictionaries:
  - ~Environments/AWS Dictionary

Create a deployment package with an artifact

Creates a deployment package for a war file:

apiVersion: xl-deploy/v1
kind: Applications
spec:
- name: Applications/MyApp
  type: udm.Application
  lastVersion: "1.0"
  children:
  - name: "1.0"
    type: udm.DeploymentPackage
    deployables:
    - name: Server
      type: jee.War
      file: !file server.war

Group multiple YAML files

Groups YAML files for sequential execution:

apiVersion: xl/v1
kind: Import
metadata:
 imports:
   - create/create-homes.yaml
   - create/create-files.yaml
   - create/create-docker.yaml
   - create/create-k8s.yaml

Define home directories

Use -home to indicate home directories:

apiVersion: xl-deploy/v1
kind: Environments
metadata:
 Environments-home: Environments/XL
 Configuration-home: Configuration/XL
 Infrastructure-home: Infrastructure/XL
spec:
 - directory: k8s
   children:
     - name: Local
       type: udm.Environment
       triggers:
         - ~Configuration/t1
         - Configuration/XL/t2
       members:
         - ~Infrastructure/k8s/Minukube/default
       dictionaries:
         - ../../dict2
 - name: dict
   type: udm.Dictionary
   entries:
     user: admin
     password: qwerty
   encryptedEntries:
     user: admin
     password: qwerty
 - name: dict2
   type: udm.Dictionary