install jsondiff and pyyaml for docker swarm
This commit is contained in:
parent
57d191b837
commit
3a874fa4f8
6 changed files with 31 additions and 79 deletions
|
@ -1,23 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Setup Docker Swarm primary
|
|
||||||
hosts: primary
|
|
||||||
tasks:
|
|
||||||
- name: Create Docker Swarm
|
|
||||||
docker_swarm:
|
|
||||||
|
|
||||||
- name: Get Docker Swarm primary info
|
|
||||||
docker_swarm_info:
|
|
||||||
nodes: yes
|
|
||||||
nodes_filters:
|
|
||||||
name: primary
|
|
||||||
register: swarm_info
|
|
||||||
|
|
||||||
- hosts: secondaries
|
|
||||||
tasks:
|
|
||||||
- name: Join Docker Swarm
|
|
||||||
docker_swarm:
|
|
||||||
state: join
|
|
||||||
join_token: "{{ hostvars.primary.swarm_info.swarm_facts.JoinTokens.Manager }}"
|
|
||||||
remote_addrs:
|
|
||||||
- "{{ hostvars.primary.ansible_default_ipv4.address }}"
|
|
|
@ -1,72 +1,23 @@
|
||||||
---
|
---
|
||||||
- name: Wait for Cloud-init to finish
|
|
||||||
hosts: manager, workers
|
|
||||||
gather_facts: no
|
|
||||||
roles:
|
|
||||||
- cloudinit_wait
|
|
||||||
|
|
||||||
- name: Initialize Docker Swarm nodes
|
- name: Setup Docker Swarm primary
|
||||||
hosts: manager, workers
|
hosts: primary
|
||||||
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:
|
tasks:
|
||||||
- name: Install pip packages
|
|
||||||
pip:
|
|
||||||
name:
|
|
||||||
- jsondiff
|
|
||||||
- pyyaml
|
|
||||||
|
|
||||||
- name: Create Docker Swarm
|
- name: Create Docker Swarm
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
|
|
||||||
- name: Get Docker Swarm manager info
|
- name: Get Docker Swarm primary info
|
||||||
docker_swarm_info:
|
docker_swarm_info:
|
||||||
nodes: yes
|
nodes: yes
|
||||||
nodes_filters:
|
nodes_filters:
|
||||||
name: manager
|
name: primary
|
||||||
register: swarm_info
|
register: swarm_info
|
||||||
|
|
||||||
- hosts: workers
|
- hosts: secondaries
|
||||||
tasks:
|
tasks:
|
||||||
- name: Join Docker Swarm
|
- name: Join Docker Swarm
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
state: join
|
state: join
|
||||||
join_token: "{{ hostvars.manager.swarm_info.swarm_facts.JoinTokens.Worker }}"
|
join_token: "{{ hostvars.primary.swarm_info.swarm_facts.JoinTokens.Worker }}"
|
||||||
remote_addrs:
|
remote_addrs:
|
||||||
- "{{ hostvars.manager.ansible_default_ipv4.address }}"
|
- "{{ hostvars.primary.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
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: Start Docker stacks
|
||||||
|
hosts: primary
|
||||||
|
roles:
|
||||||
|
- {role: cyberchef2, tags: cyberchef2}
|
|
@ -0,0 +1,8 @@
|
||||||
|
# vi: ft=yaml
|
||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
cyberchef:
|
||||||
|
image: mpepping/cyberchef
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
|
@ -0,0 +1,5 @@
|
||||||
|
- name: Deploy Docker stack
|
||||||
|
docker_stack:
|
||||||
|
name: cyberchef
|
||||||
|
compose:
|
||||||
|
- "{{ lookup('template', '{{ role_path }}/docker-stack.yml.j2') | from_yaml }}"
|
|
@ -120,6 +120,8 @@
|
||||||
(python311.withPackages (python-pkgs: [
|
(python311.withPackages (python-pkgs: [
|
||||||
python-pkgs.docker
|
python-pkgs.docker
|
||||||
python-pkgs.requests
|
python-pkgs.requests
|
||||||
|
python-pkgs.jsondiff
|
||||||
|
python-pkgs.pyyaml
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -154,6 +156,8 @@
|
||||||
(python311.withPackages (python-pkgs: [
|
(python311.withPackages (python-pkgs: [
|
||||||
python-pkgs.docker
|
python-pkgs.docker
|
||||||
python-pkgs.requests
|
python-pkgs.requests
|
||||||
|
python-pkgs.jsondiff
|
||||||
|
python-pkgs.pyyaml
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -188,6 +192,8 @@
|
||||||
(python311.withPackages (python-pkgs: [
|
(python311.withPackages (python-pkgs: [
|
||||||
python-pkgs.docker
|
python-pkgs.docker
|
||||||
python-pkgs.requests
|
python-pkgs.requests
|
||||||
|
python-pkgs.jsondiff
|
||||||
|
python-pkgs.pyyaml
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue