Pim Kunis
111bf68a0a
move docker swarm ansible to this repo move thecloud ansible to this repo support data disks in terraform
72 lines
1.6 KiB
YAML
72 lines
1.6 KiB
YAML
---
|
|
- name: Wait for Cloud-init to finish
|
|
hosts: manager, workers
|
|
gather_facts: no
|
|
roles:
|
|
- cloudinit_wait
|
|
|
|
- name: Initialize Docker Swarm nodes
|
|
hosts: manager, workers
|
|
pre_tasks:
|
|
- name: Delete externally managed environment file
|
|
shell:
|
|
cmd: "rm /usr/lib/python*/EXTERNALLY-MANAGED"
|
|
register: rm
|
|
changed_when: "rm.rc == 0"
|
|
failed_when: "false"
|
|
|
|
roles:
|
|
- setup_apt
|
|
|
|
post_tasks:
|
|
- name: Install Docker
|
|
include_role:
|
|
name: docker
|
|
vars:
|
|
docker_daemon_config: {}
|
|
# log-driver: fluentd
|
|
# log-opts:
|
|
# fluentd-address: "localhost:22222"
|
|
# tag: "docker.{{ '{{' }}.Name{{ '}}' }}"
|
|
|
|
- name: Setup Docker Swarm manager
|
|
hosts: manager
|
|
tasks:
|
|
- name: Install pip packages
|
|
pip:
|
|
name:
|
|
- jsondiff
|
|
- pyyaml
|
|
|
|
- name: Create Docker Swarm
|
|
docker_swarm:
|
|
|
|
- name: Get Docker Swarm manager info
|
|
docker_swarm_info:
|
|
nodes: yes
|
|
nodes_filters:
|
|
name: manager
|
|
register: swarm_info
|
|
|
|
- hosts: workers
|
|
tasks:
|
|
- name: Join Docker Swarm
|
|
docker_swarm:
|
|
state: join
|
|
join_token: "{{ hostvars.manager.swarm_info.swarm_facts.JoinTokens.Worker }}"
|
|
remote_addrs:
|
|
- "{{ hostvars.manager.ansible_default_ipv4.address }}"
|
|
|
|
- hosts: manager
|
|
tasks:
|
|
- name: Add concourse to authorized keys
|
|
authorized_key:
|
|
user: root
|
|
key: "{{ concourse_public_key }}"
|
|
|
|
- hosts: manager, workers
|
|
tasks:
|
|
- name: Increase vm.max_map_count
|
|
sysctl:
|
|
name: vm.max_map_count
|
|
value: 262144
|