Merge "Add a role to cleanup containers after deployment"
This commit is contained in:
commit
a22b7714e3
4
ansible/cleanup.yml
Normal file
4
ansible/cleanup.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
roles:
|
||||||
|
- cleanup
|
3
ansible/roles/cleanup/tasks/cleanup_containers.yml
Normal file
3
ansible/roles/cleanup/tasks/cleanup_containers.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- name: Cleaning all containers and volumes
|
||||||
|
command: /tmp/kolla-cleanup/tools/cleanup-containers
|
6
ansible/roles/cleanup/tasks/cleanup_host.yml
Normal file
6
ansible/roles/cleanup/tasks/cleanup_host.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Cleaning host
|
||||||
|
command: /tmp/kolla-cleanup/tools/cleanup-host
|
||||||
|
|
||||||
|
- name: Removing kolla-cleanup folder
|
||||||
|
command: rm -rf /tmp/kolla-cleanup
|
23
ansible/roles/cleanup/tasks/copy_tools.yml
Normal file
23
ansible/roles/cleanup/tasks/copy_tools.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
- name: Creating /kolla-cleanup/tools directory on node
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: /tmp/kolla-cleanup/tools
|
||||||
|
|
||||||
|
- name: Copying validate-docker-execute.sh file
|
||||||
|
copy:
|
||||||
|
src: ../tools/validate-docker-execute.sh
|
||||||
|
dest: /tmp/kolla-cleanup/tools
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Copying cleanup-containers file
|
||||||
|
copy:
|
||||||
|
src: ../tools/cleanup-containers
|
||||||
|
dest: /tmp/kolla-cleanup/tools
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Copying cleanup-host file
|
||||||
|
copy:
|
||||||
|
src: ../tools/cleanup-host
|
||||||
|
dest: /tmp/kolla-cleanup/tools
|
||||||
|
mode: 0755
|
6
ansible/roles/cleanup/tasks/main.yml
Normal file
6
ansible/roles/cleanup/tasks/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- include: copy_tools.yml
|
||||||
|
|
||||||
|
- include: cleanup_containers.yml
|
||||||
|
|
||||||
|
- include: cleanup_host.yml
|
@ -22,6 +22,9 @@ packages =
|
|||||||
data_files =
|
data_files =
|
||||||
share/kolla/ansible = ansible/*
|
share/kolla/ansible = ansible/*
|
||||||
share/kolla/docker = docker/*
|
share/kolla/docker = docker/*
|
||||||
|
share/kolla/tools = tools/validate-docker-execute.sh
|
||||||
|
share/kolla/tools = tools/cleanup-containers
|
||||||
|
share/kolla/tools = tools/cleanup-host
|
||||||
share/kolla/doc = doc/*
|
share/kolla/doc = doc/*
|
||||||
share/kolla/etc_examples = etc/*
|
share/kolla/etc_examples = etc/*
|
||||||
share/kolla = tools/init-runonce
|
share/kolla = tools/init-runonce
|
||||||
|
@ -41,6 +41,7 @@ Commands:
|
|||||||
prechecks Do pre-deployment checks for hosts
|
prechecks Do pre-deployment checks for hosts
|
||||||
mariadb_recovery Recover a completely stopped mariadb cluster
|
mariadb_recovery Recover a completely stopped mariadb cluster
|
||||||
deploy Deploy and start all kolla containers
|
deploy Deploy and start all kolla containers
|
||||||
|
cleanup Cleanup containers, volumes and host
|
||||||
post-deploy Do post deploy on deploy node
|
post-deploy Do post deploy on deploy node
|
||||||
pull Pull all images for containers (only pulls, no running container changes)
|
pull Pull all images for containers (only pulls, no running container changes)
|
||||||
reconfigure Reconfigure OpenStack service
|
reconfigure Reconfigure OpenStack service
|
||||||
@ -132,6 +133,10 @@ case "$1" in
|
|||||||
EXTRA_OPTS="$EXTRA_OPTS -e action=deploy"
|
EXTRA_OPTS="$EXTRA_OPTS -e action=deploy"
|
||||||
PLAYBOOK="${BASEDIR}/ansible/mariadb_recovery.yml"
|
PLAYBOOK="${BASEDIR}/ansible/mariadb_recovery.yml"
|
||||||
;;
|
;;
|
||||||
|
(cleanup)
|
||||||
|
ACTION="Cleanup containers, volumes and host"
|
||||||
|
PLAYBOOK="${BASEDIR}/ansible/cleanup.yml"
|
||||||
|
;;
|
||||||
(deploy)
|
(deploy)
|
||||||
ACTION="Deploying Playbooks"
|
ACTION="Deploying Playbooks"
|
||||||
EXTRA_OPTS="$EXTRA_OPTS -e action=deploy"
|
EXTRA_OPTS="$EXTRA_OPTS -e action=deploy"
|
||||||
|
Loading…
Reference in New Issue
Block a user