September 2018
Beginner to intermediate
214 pages
5h 53m
English
As an example, we are going to create a simple web server. First, we need to create our Ansible Container folder and the initial configuration files:
mkdir /home/admin/Containers/webserver cd /home/admin/Containers/webserver ansible-container init
Then, we start editing the files that we have created. We start with the container.yml file and fill it with the following code:
version: '2'
settings:
conductor:
base: 'ubuntu:xenial'
project_name: webserver
services:
web:
from: centos:7
command: [nginx]
entrypoint: [/usr/bin/entrypoint.sh]
ports:
- 80:80
roles:
- nginx-server
Then, we fill in the meta.yml file in case we need to upload our container project to Ansible Galaxy. We need to add the following code to it:
Read now
Unlock full access