Created
November 5, 2019 17:15
-
-
Save stefanotroia/7da7364af0bd5a4e7c09889396345f3b to your computer and use it in GitHub Desktop.
Ansible playbook example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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