honomoa.docker_deployment

Ansible Role: docker_deployment

Easily deploy your Docker images.

Docker Website

Role Variables

registry_type: aws-ecr

This defines the type of registry to use.

Possible options:

  • aws-ecr (Amazon Elastic Container Registry)
  • self-hosted (like Nexus Docker Registry or Docker's official registry)
  • archive-tar (a tar file created by using docker save)
  • dockerhub (self-hosted), you can set registry_url to registry.hub.docker.com and team to library for official images.
registry_region: us-west-1

The AWS region for ECR, only needed if the registry_type is set to aws-ecr.

aws_access_key_id: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"

The Access Key ID from AWS IAM. Set the environment variable AWS_ACCESS_KEY_ID. Required for aws-ecr.

aws_secret_access_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"

The Secret Access Key from AWS IAM. Set the environment variable AWS_SECRET_ACCESS_KEY. Required for aws-ecr.

registry_username: "{{ lookup('env', 'REGISTRY_USERNAME') }}"

Username for the registry. Set the environment variable REGISTRY_USERNAME. Required for self-hosted.

registry_password: "{{ lookup('env', 'REGISTRY_PASSWORD') }}"

Password for the registry. Set the environment variable REGISTRY_PASSWORD. Required for self-hosted.

archive_username: "{{ lookup('env', 'ARCHIVE_USERNAME') }}"

Username for the archive URL. Set the environment variable ARCHIVE_USERNAME. Required for archive-tar.

archive_password: "{{ lookup('env', 'ARCHIVE_PASSWORD') }}"

Password for the archive URL. Set the environment variable ARCHIVE_PASSWORD. Required for archive-tar.

archive_url: "{{ lookup('env', 'ARCHIVE_URL') }}"

URL for the archive server, without a specific tar.gz file name. Set the environment variable ARCHIVE_URL. Required for archive-tar.

registry_scheme: https

The type of scheme for the registry.

Possible options:

  • https (default)
  • http
registry_url: dockerhub.com

The URL for the Docker registry.

image_team: moa

The name of the team that owns the image.

image_project: caddy

The name of the project for the image.

image_tag: latest

The tag of the image to deploy.

container_name: caddy-server-1

The name assigned to the container.

container_ports: []

Ports to expose from the container.

container_restart_policy: always

Policy for restarting the container.

container_environment: {}

Container environment variables, defined as key-value pairs.

container_env_file: ''

Path to a file containing environment variables (e.g., FOO=BAR) on the target machine.

container_volumes: []

Volumes to mount for the container.

container_extra_hosts:

Add hostname mappings, similar to Docker's --add-host option.

container_command: ''

Command to execute when starting the container.

See: Docker Compose Command

container_privileged: no

Whether to give extended privileges to this container.

container_dns_servers: []

Custom DNS server list.

container_dns_search_domains: []

Custom DNS search domain list.

container_network_mode: ''

Network mode for the container. Options include "bridge", "host", "none", or "container:<name|id>".

container_capabilities: []

List of additional capabilities to add to the container.

container_log_driver: json-file

Specifies the logging driver. Options include "none", "json-file", "syslog", "journald", "gelf", "fluentd", "awslogs", "splunk".

container_log_options:

Example Playbook

- hosts: server
  vars:
    registry_url: dockerhub.com
    image_team: moa
    image_project: caddy
    image_tag: latest
    container_name: caddy-server-01
    container_ports:
      - 80:80
      - 443:443
    container_restart_policy: always
    container_environment:
      HOST_ID: 100
    container_env_file: xxx.env
    container_volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - ${PWD}/data:/data
    container_privileged: no
    container_network_mode: 'bridge'
    container_capabilities: 
      - NET_ADMIN
    container_log_driver: json-file
    container_log_options:
      max-size: 10m
      max-file: 3
  roles:
    - { role: honomoa.docker_deployment }

License

CC BY-SA 3.0

Informazioni sul progetto

Deploy your docker images.

Installa
ansible-galaxy install honomoa.docker_deployment
Licenza
Unknown
Download
3k
Proprietario