Add rancher
This commit is contained in:
parent
8179374266
commit
51f2c21899
8
hosts
8
hosts
@ -3,7 +3,15 @@
|
|||||||
|
|
||||||
[docker]
|
[docker]
|
||||||
192.168.2.5
|
192.168.2.5
|
||||||
|
10.0.0.181
|
||||||
#10.0.0.36
|
#10.0.0.36
|
||||||
|
|
||||||
[edge]
|
[edge]
|
||||||
192.168.2.5
|
192.168.2.5
|
||||||
|
|
||||||
|
[nfs]
|
||||||
|
10.0.0.180 nfs_exports='[ "/mnt/kube *(rw,sync,no_subtree_check)" ]'
|
||||||
|
10.0.0.181
|
||||||
|
|
||||||
|
[rancher]
|
||||||
|
10.0.0.181
|
@ -1,6 +1,7 @@
|
|||||||
- src: geerlingguy.docker
|
- src: geerlingguy.docker
|
||||||
- src: geerlingguy.security
|
- src: geerlingguy.security
|
||||||
- src: geerlingguy.ntp
|
- src: geerlingguy.ntp
|
||||||
|
- src: geerlingguy.nfs
|
||||||
- src: grog.package
|
- src: grog.package
|
||||||
- src: ironicbadger.ansible_role_docker_compose_generator
|
- src: ironicbadger.ansible_role_docker_compose_generator
|
||||||
- src: ironicbadger.ansible_role_nginx_configs
|
- src: ironicbadger.ansible_role_nginx_configs
|
14
roles/dock-rancher/files/docker-compose.yml
Normal file
14
roles/dock-rancher/files/docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Ansible managed
|
||||||
|
---
|
||||||
|
version: "2"
|
||||||
|
services:
|
||||||
|
rancher:
|
||||||
|
image: rancher/rancher
|
||||||
|
container_name: rancher
|
||||||
|
#network_mode: bridge
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
volumes:
|
||||||
|
- "{{ appdata_path }}/rancher:/var/lib/rancher"
|
||||||
|
restart: unless-stopped
|
29
roles/dock-rancher/tasks/main.yml
Normal file
29
roles/dock-rancher/tasks/main.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
- name: Create rancher directory
|
||||||
|
file:
|
||||||
|
path: "{{ appdata_path }}/rancher"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ main_username }}"
|
||||||
|
mode: "{{ docker_compose_directory_mask }}"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Install rancher compose file
|
||||||
|
template:
|
||||||
|
src: files/docker-compose.yml
|
||||||
|
dest: "{{ appdata_path }}/rancher/docker-compose.yml"
|
||||||
|
mode: "{{ docker_compose_file_mask }}"
|
||||||
|
owner: "{{ main_username }}"
|
||||||
|
validate: docker-compose -f %s config
|
||||||
|
register: compose_file
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Cycle rancher container
|
||||||
|
docker_compose:
|
||||||
|
project_src: "{{ appdata_path }}/rancher"
|
||||||
|
pull: true
|
||||||
|
remove_orphans: true
|
||||||
|
remove_volumes: true
|
||||||
|
state: "{{ item }}"
|
||||||
|
when: compose_file.changed
|
||||||
|
loop:
|
||||||
|
- absent
|
||||||
|
- present
|
19
run.yml
19
run.yml
@ -25,6 +25,11 @@
|
|||||||
become: yes
|
become: yes
|
||||||
vars_files:
|
vars_files:
|
||||||
- "vars/vault.yaml"
|
- "vars/vault.yaml"
|
||||||
|
tasks:
|
||||||
|
- pip:
|
||||||
|
name: docker
|
||||||
|
- pip:
|
||||||
|
name: docker-compose
|
||||||
roles:
|
roles:
|
||||||
- role: geerlingguy.docker
|
- role: geerlingguy.docker
|
||||||
|
|
||||||
@ -35,3 +40,17 @@
|
|||||||
roles:
|
roles:
|
||||||
- role: ironicbadger.ansible_role_docker_compose_generator
|
- role: ironicbadger.ansible_role_docker_compose_generator
|
||||||
- role: dock-cfddns
|
- role: dock-cfddns
|
||||||
|
|
||||||
|
- hosts: rancher
|
||||||
|
become: yes
|
||||||
|
vars_files:
|
||||||
|
- "vars/vault.yaml"
|
||||||
|
roles:
|
||||||
|
- role: dock-rancher
|
||||||
|
|
||||||
|
- hosts: nfs
|
||||||
|
become: yes
|
||||||
|
vars_files:
|
||||||
|
- "vars/vault.yaml"
|
||||||
|
roles:
|
||||||
|
- role: geerlingguy.nfs
|
Loading…
Reference in New Issue
Block a user