Skip to content

Instantly share code, notes, and snippets.

@stefanotroia
Created November 5, 2019 17:15
Show Gist options
  • Save stefanotroia/7da7364af0bd5a4e7c09889396345f3b to your computer and use it in GitHub Desktop.
Save stefanotroia/7da7364af0bd5a4e7c09889396345f3b to your computer and use it in GitHub Desktop.
Ansible playbook example
- hosts: ansible_group
pre_tasks:
- name: 'System init'
include_tasks: docker-install.yml
tasks:
#[DOCKER] Create dockernetwork
- name: '[DOCKER] Create docker network'
become: yes
docker_network:
name: my_network#[NGINX] Run container
- name: '[NGINX] Running container'
become: yes
docker_container:
name: 'nginx'
recreate: true
restart_policy: unless-stopped
image: 'nginx:latest'
volumes:
- '/home/nginx/nginx.conf:/etc/nginx/nginx.conf:ro'
- '/home/nginx/myconf.conf:/etc/nginx/myconf.conf:ro'
- '/home/myapp/resources:/home/myapp/resources'
published_ports:
- '80:80'
- '443:443'
networks:
- name: "my_network"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment