bodsch / ansible-container Goto Github PK
View Code? Open in Web Editor NEWansible role for docker deployment of generic container applications
License: Apache License 2.0
ansible role for docker deployment of generic container applications
License: Apache License 2.0
In a large environment, there are many containers that need to be considered during a run.
It therefore makes sense to implement a kind of filter that only targets certain containers (name, image) in order to deploy them specifically.
At present, exactly one properties file can be created:
container:
- name: hello-world
hostname: hello-world
image: hello-world:latest
properties:
#
publisher.maxRecursionDepth: 200
# user and password for login to the staging serve
replicator.user: 'replicator'
replicator.password: 'replicator'
# replicator.domain: ''
replicator.tmp_dir: 'var/tmp'
Sometimes, however, it makes sense to include a set of properties files for the container - depending on the application.
Therefore, the role should be extended to support multiple files per container.
Perhaps a new variable can be used for this purpose:
container:
- name: hello-world
hostname: hello-world
image: hello-world:latest
property_file:
- name: publisher.properties
properties:
#
publisher.maxRecursionDepth: 200
# user and password for login to the staging serve
replicator.user: 'replicator'
replicator.password: 'replicator'
# replicator.domain: ''
replicator.tmp_dir: 'var/tmp'
- name: database.properties
properties:
#
sql.storage: ...
For example:
docker_container:
name: nginx
image: nginx
state: started
restart_policy: always
memory: 128M
published_ports:
- "8080:80"
mounts:
- source: /var/tmp
target: /var/tmp
read_only: yes
For larger setups with about 20 containers and correspondingly many volumes or mounts, the runtimes are very long.
The number of loops should be reduced.
As an alternative, own modules should be programmed.
For security reasons, I would like to start the containers in the "read_only" mode.
See https://docs.ansible.com/ansible/latest/collections/community/docker/docker_container_module.html#parameter-read_only
Currently, the login is only supported in one registry.
container_registry:
host: ''
username: ''
password: ''
However, containers from different registries may be required.
In this case, the configuration should be extended accordingly.
Proposal:
container_registry:
- registry: ''
username: ''
password: ''
Please make the extension of the configuration downward compatible!
@bodsch thanks for your great work!
I have a problem, with the generated "container.env" file, which looks like
# generated by ansible
-Xmx1gSPRING_BOOT_EXPLODED_APP=true
and causes the JVM to fail at startup: Invalid maximum heap size: -Xmx1gSPRING_BOOT_EXPLODED_APP=true
The inventory looks like:
environments:
JAVA_HEAP: 1g
SPRING_BOOT_EXPLODED_APP: "true"
The porblem seems to be the non existent line break between the entries. Can you have a look? Thx!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.