Skip to content
Snippets Groups Projects
Commit c2a90621 authored by Debian's avatar Debian
Browse files

Initial commit

parent 9d46a9f7
No related branches found
No related tags found
No related merge requests found
Showing
with 352 additions and 0 deletions
---
- name: Create containers
hosts: localhost
tasks:
- docker_container:
name: "{{ item }}"
image: "{{ base_image }}"
command: ["sleep", "1d"]
loop:
- nifi-image
- name: Configure NiFi container
hosts: nifi-image
vars:
- docker:
roles:
- name: nifi
- name: Create images
hosts: localhost
tasks:
- name: create a docker image from the container
command: "/usr/bin/docker commit
-c '{{ item.expose }}'
-c '{{ item.cmd }}'
{{ item.image }}
{{ item.name }}"
loop:
- { expose: 'EXPOSE 8080 8443 10000 8000', cmd: 'CMD [\"/opt/nifi/nifi-current/scripts/start.sh\", \"run\"]', image: 'nifi-image', name: 'nifi-soctools' }
- name: Save images to file
command: "/usr/bin/docker save -o {{ docker_image_path }}/{{ item }}.tar {{ item }}"
loop:
- nifi-soctools
\ No newline at end of file
---
- hosts: soctools_server
become: true
roles:
- soctools-server
- hosts: nifi
become: true
vars_files:
- inventories/deploy/group_vars/nifi.yml
roles:
- docker-deploy
- hosts: haproxy
become: true
vars_files:
- inventories/deploy/group_vars/haproxy.yml
roles:
- haproxy
- docker-deploy
- hosts: zookeeper
become: true
vars_files:
- inventories/deploy/group_vars/zookeeper.yml
roles:
- docker-deploy
\ No newline at end of file
---
docker_image_path: images
base_image: python:2.7-stretch
all:
hosts:
nifi-image:
ansible_connection: docker
ansible_python_interpreter: /usr/bin/python
localhost:
ansible_python_interpreter: /usr/bin/python
ansible_connection: local
children:
nifi:
hosts:
localhost:
---
index: haproxy
scale: "{{ haproxy_scale | default('1')}}"
docker:
haproxy:
image: haproxy:latest
volumes:
- /usr/local/etc/haproxy/:/usr/local/etc/haproxy:ro
ports:
- "80:80"
source: pull
\ No newline at end of file
---
index: nifi
scale: "{{ nifi_scale | default('1')}}"
docker:
nifi:
# image: nifi-soctools #For nifi image built by soctools
# source: load
image: apache/nifi:latest
source: pull
command: /opt/nifi/nifi-current/scripts/start.sh
env:
NIFI_HOME: "/opt/nifi/nifi-current"
NIFI_LOG_DIR: "/opt/nifi/nifi-current/logs"
NIFI_PID_DIR: "/opt/nifi/nifi-current/run"
NIFI_CLUSTER_IS_NODE: "true"
NIFI_ZK_CONNECT_STRING: "zookeeper_1:2181"
NIFI_CLUSTER_NODE_PROTOCOL_PORT: "8082"
NIFI_ELECTION_MAX_WAIT: "1 min"
load_path: "{{ image_location }}/nifi-soctools.tar"
---
index: zookeeper
scale: "{{ zookeeper_scale | default('1')}}"
docker:
zookeeper:
image: zookeeper:latest
source: pull
\ No newline at end of file
all:
hosts:
host1:
ansible_ssh_user: debian
ansible_python_interpreter: /usr/bin/python
become: yes
children:
soctools_server:
hosts:
host1:
nifi:
hosts:
host1:
nifi_scale: 3
haproxy:
hosts:
host1:
zookeeper:
hosts:
host1:
zookeeper_scale: 3
\ No newline at end of file
all:
hosts:
soctools.example.com:
ansible_ssh_user: debian
ansible_python_interpreter: /usr/bin/python
become: yes
children:
soctools_server:
hosts:
soctools.example.com:
nifi:
hosts:
soctools.example.com:
nifi_scale: 3
haproxy:
hosts:
soctools.example.com:
zookeeper:
hosts:
soctools.example.com:
\ No newline at end of file
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for docker-host
image_location: /tmp
\ No newline at end of file
---
# handlers file for docker-deploy
\ No newline at end of file
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
\ No newline at end of file
---
# tasks file for docker deployment
- name: Copy docker image
copy:
src: "images/{{ docker[index].image }}.tar"
dest: "{{ image_location }}/{{ docker[index].image }}.tar"
when: docker[index].source == "load"
- name: Load docker image
docker_image:
name: "{{ docker[index].image }}"
load_path: "{{ docker[index].load_path | default(omit) }}"
source: "{{ docker[index].source }}"
timeout: 120
- name: Create docker network
docker_network:
name: soctools
- name: Start docker containers {{ docker[index].image }}
docker_container:
name: "{{ index }}_{{ item }}"
image: "{{ docker[index].image }}"
command: "{{ docker[index].command | default(omit) }}"
env: "{{ docker[index].env | default(omit) }}"
working_dir: "{{ docker[index].workdir | default(omit) }}"
volumes: "{{ docker[index].volumes | default(omit) }}"
ports: "{{ docker[index].ports | default(omit) }}"
networks:
- name: soctools
networks_cli_compatible: yes
state: started
with_sequence: count={{ scale }}
\ No newline at end of file
localhost
---
- hosts: localhost
remote_user: root
roles:
- docker-deploy
\ No newline at end of file
---
# vars file for docker-deploy
\ No newline at end of file
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for haproxy
\ No newline at end of file
global
quiet
defaults
mode http
maxconn 5000
timeout connect 5s
timeout client 20s
timeout server 20s
frontend public
bind *:80
default_backend apps
backend apps
server nifi_1 nifi_1:8080 check
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment