Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Reimplement HA docker tagging
Browse files Browse the repository at this point in the history
This patch re-implements the Ansible task that does the container image
tagging for Pacemaker managed services. It's using a role in
tripleo-common, so we don't duplicate the work.

Co-Authored-By: Dan Prince <dprince@redhat.com>
Depends-On: I61039cdaa6798e8ae7c918f772d863dc1b67ae02
Change-Id: I81bc48b53068c3a5ed90266a4fd3e62bfb017835
  • Loading branch information
dprince authored and EmilienM committed Nov 6, 2018
1 parent 6cd75e7 commit ef6d7cf
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 247 deletions.
43 changes: 18 additions & 25 deletions docker/services/pacemaker/cinder-backup.yaml
Expand Up @@ -158,29 +158,6 @@ outputs:
recurse: true
docker_config_scripts: {get_attr: [ContainersCommon, docker_config_scripts]}
docker_config:
step_1:
cinder_backup_image_tag:
start_order: 1
detach: false
net: host
user: root
command:
- '/bin/bash'
- '-c'
- str_replace:
template:
"/usr/bin/docker tag 'CINDERBACKUP_IMAGE' 'CINDERBACKUP_IMAGE_PCMKLATEST'"
params:
CINDERBACKUP_IMAGE: {get_param: DockerCinderBackupImage}
CINDERBACKUP_IMAGE_PCMKLATEST: *cinder_backup_image_pcmklatest
image: {get_param: DockerCinderBackupImage}
volumes:
- /etc/hosts:/etc/hosts:ro
- /etc/localtime:/etc/localtime:ro
- /dev/shm:/dev/shm:rw
- /etc/sysconfig/docker:/etc/sysconfig/docker:ro
- /usr/bin:/usr/bin:ro
- /var/run/docker.sock:/var/run/docker.sock:rw
step_3:
cinder_backup_init_logs:
start_order: 0
Expand Down Expand Up @@ -260,6 +237,14 @@ outputs:
file:
path: /etc/ceph
state: directory
deploy_steps_tasks:
- name: Cinder Backup tag container image for pacemaker
when: step|int == 2
import_role:
name: tripleo-container-tag
vars:
container_image: {get_param: DockerCinderBackupImage}
container_image_latest: *cinder_backup_image_pcmklatest
update_tasks:
- name: Cinder-Backup fetch and retag container image for pacemaker
when: step|int == 2
Expand All @@ -286,7 +271,11 @@ outputs:
- name: Pull latest Cinder-Backup images
command: "docker pull {{docker_image}}"
- name: Retag pcmklatest to latest Cinder-Backup image
shell: "docker tag {{docker_image}} {{docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{docker_image}}"
container_image_latest: "{{docker_image_latest}}"
# Got to check that pacemaker_is_active is working fine with bundle.
# TODO: pacemaker_is_active resource doesn't support bundle.
upgrade_tasks:
Expand All @@ -311,8 +300,12 @@ outputs:
shell: "docker images | awk '/cinder-backup.* pcmklatest/{print $3}' | uniq"
register: cinder_backup_current_pcmklatest_id
- name: Temporarily tag the current cinder_backup image id with the upgraded image name
shell: "docker tag {{cinder_backup_current_pcmklatest_id.stdout}} {{cinder_backup_docker_image_latest}}"
when: cinder_backup_current_pcmklatest_id.stdout != ''
import_role:
name: tripleo-container-tag
vars:
container_image: "{{cinder_backup_current_pcmklatest_id.stdout}}"
container_image_latest: "{{cinder_backup_docker_image_latest}}"
- name: Check openstack-cinder-backup cluster resource status
pacemaker_resource:
resource: openstack-cinder-backup
Expand Down
43 changes: 18 additions & 25 deletions docker/services/pacemaker/cinder-volume.yaml
Expand Up @@ -143,29 +143,6 @@ outputs:
recurse: true
docker_config_scripts: {get_attr: [ContainersCommon, docker_config_scripts]}
docker_config:
step_1:
cinder_volume_image_tag:
start_order: 1
detach: false
net: host
user: root
command:
- '/bin/bash'
- '-c'
- str_replace:
template:
"/usr/bin/docker tag 'CINDERVOLUME_IMAGE' 'CINDERVOLUME_IMAGE_PCMKLATEST'"
params:
CINDERVOLUME_IMAGE: {get_param: DockerCinderVolumeImage}
CINDERVOLUME_IMAGE_PCMKLATEST: *cinder_volume_image_pcmklatest
image: {get_param: DockerCinderVolumeImage}
volumes:
- /etc/hosts:/etc/hosts:ro
- /etc/localtime:/etc/localtime:ro
- /dev/shm:/dev/shm:rw
- /etc/sysconfig/docker:/etc/sysconfig/docker:ro
- /usr/bin:/usr/bin:ro
- /var/run/docker.sock:/var/run/docker.sock:rw
step_3:
cinder_volume_init_logs:
start_order: 0
Expand Down Expand Up @@ -227,6 +204,14 @@ outputs:
- - 'TRIPLEO_DEPLOY_IDENTIFIER='
- {get_param: DeployIdentifier}
host_prep_tasks: {get_attr: [CinderCommon, cinder_volume_host_prep_tasks]}
deploy_steps_tasks:
- name: Cinder Volume tag container image for pacemaker
when: step|int == 2
import_role:
name: tripleo-container-tag
vars:
container_image: {get_param: DockerCinderVolumeImage}
container_image_latest: *cinder_volume_image_pcmklatest
update_tasks:
- name: Cinder-Volume fetch and retag container image for pacemaker
when: step|int == 2
Expand All @@ -253,7 +238,11 @@ outputs:
- name: Pull latest Cinder-Volume images
command: "docker pull {{docker_image}}"
- name: Retag pcmklatest to latest Cinder-Volume image
shell: "docker tag {{docker_image}} {{docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{docker_image}}"
container_image_latest: "{{docker_image_latest}}"
# Got to check that pacemaker_is_active is working fine with bundle.
# TODO: pacemaker_is_active resource doesn't support bundle.
upgrade_tasks:
Expand All @@ -278,7 +267,11 @@ outputs:
shell: "docker images | awk '/cinder-volume.* pcmklatest/{print $3}' | uniq"
register: cinder_volume_current_pcmklatest_id
- name: Temporarily tag the current cinder_volume image id with the upgraded image name
shell: "docker tag {{cinder_volume_current_pcmklatest_id.stdout}} {{cinder_volume_docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{cinder_volume_current_pcmklatest_id.stdout}}"
container_image_latest: "{{cinder_volume_docker_image_latest}}"
when: cinder_volume_current_pcmklatest_id.stdout != ''
- name: Check openstack-cinder-volume cluster resource status
pacemaker_resource:
Expand Down
42 changes: 18 additions & 24 deletions docker/services/pacemaker/database/mysql.yaml
Expand Up @@ -227,28 +227,6 @@ outputs:
passwords:
- {get_param: MysqlRootPassword}
- {get_param: [DefaultPasswords, mysql_root_password]}
mysql_image_tag:
start_order: 2
detach: false
net: host
user: root
command:
- '/bin/bash'
- '-c'
- str_replace:
template:
"/usr/bin/docker tag 'MYSQL_IMAGE' 'MYSQL_IMAGE_PCMKLATEST'"
params:
MYSQL_IMAGE: {get_param: DockerMysqlImage}
MYSQL_IMAGE_PCMKLATEST: *mysql_image_pcmklatest
image: {get_param: DockerMysqlImage}
volumes:
- /etc/hosts:/etc/hosts:ro
- /etc/localtime:/etc/localtime:ro
- /dev/shm:/dev/shm:rw
- /etc/sysconfig/docker:/etc/sysconfig/docker:ro
- /usr/bin:/usr/bin:ro
- /var/run/docker.sock:/var/run/docker.sock:rw
step_2:
mysql_restart_bundle:
start_order: 0
Expand Down Expand Up @@ -319,6 +297,14 @@ outputs:
ignore_errors: true
metadata_settings:
get_attr: [MysqlPuppetBase, role_data, metadata_settings]
deploy_steps_tasks:
- name: MySQL tag container image for pacemaker
when: step|int == 2
import_role:
name: tripleo-container-tag
vars:
container_image: {get_param: DockerMysqlImage}
container_image_latest: *mysql_image_pcmklatest
update_tasks:
- name: Mariadb fetch and retag container image for pacemaker
when: step|int == 2
Expand All @@ -345,7 +331,11 @@ outputs:
- name: Pull latest Mariadb images
command: "docker pull {{docker_image}}"
- name: Retag pcmklatest to latest Mariadb image
shell: "docker tag {{docker_image}} {{docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{docker_image}}"
container_image_latest: "{{docker_image_latest}}"
# Got to check that pacemaker_is_active is working fine with bundle.
# TODO: pacemaker_is_active resource doesn't support bundle.
upgrade_tasks:
Expand Down Expand Up @@ -374,7 +364,11 @@ outputs:
shell: "docker images | awk '/mariadb.* pcmklatest/{print $3}' | uniq"
register: galera_current_pcmklatest_id
- name: Temporarily tag the current galera image id with the upgraded image name
shell: "docker tag {{galera_current_pcmklatest_id.stdout}} {{mysql_docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{galera_current_pcmklatest_id.stdout}}"
container_image_latest: "{{mysql_docker_image_latest}}"
when: galera_current_pcmklatest_id.stdout != ''
- name: Check galera cluster resource status
pacemaker_resource:
Expand Down
43 changes: 18 additions & 25 deletions docker/services/pacemaker/database/redis.yaml
Expand Up @@ -186,29 +186,6 @@ outputs:
optional: true
docker_config_scripts: {get_attr: [ContainersCommon, docker_config_scripts]}
docker_config:
step_1:
redis_image_tag:
start_order: 1
detach: false
net: host
user: root
command:
- '/bin/bash'
- '-c'
- str_replace:
template:
"/usr/bin/docker tag 'REDIS_IMAGE' 'REDIS_IMAGE_PCMKLATEST'"
params:
REDIS_IMAGE: {get_param: DockerRedisImage}
REDIS_IMAGE_PCMKLATEST: *redis_image_pcmklatest
image: {get_param: DockerRedisImage}
volumes:
- /etc/hosts:/etc/hosts:ro
- /etc/localtime:/etc/localtime:ro
- /dev/shm:/dev/shm:rw
- /etc/sysconfig/docker:/etc/sysconfig/docker:ro
- /usr/bin:/usr/bin:ro
- /var/run/docker.sock:/var/run/docker.sock:rw
step_2:
map_merge:
- redis_restart_bundle:
Expand Down Expand Up @@ -299,6 +276,14 @@ outputs:
Log files from redis containers can be found under
/var/log/containers/redis.
ignore_errors: true
deploy_steps_tasks:
- name: Redis tag container image for pacemaker
when: step|int == 2
import_role:
name: tripleo-container-tag
vars:
container_image: {get_param: DockerRedisImage}
container_image_latest: *redis_image_pcmklatest
update_tasks:
- name: Redis fetch and retag container image for pacemaker
when: step|int == 2
Expand All @@ -325,7 +310,11 @@ outputs:
- name: Pull latest Redis images
command: "docker pull {{docker_image}}"
- name: Retag pcmklatest to latest Redis image
shell: "docker tag {{docker_image}} {{docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{docker_image}}"
container_image_latest: "{{docker_image_latest}}"
# Got to check that pacemaker_is_active is working fine with bundle.
# TODO: pacemaker_is_active resource doesn't support bundle.
upgrade_tasks:
Expand Down Expand Up @@ -354,7 +343,11 @@ outputs:
shell: "docker images | awk '/redis.* pcmklatest/{print $3}' | uniq"
register: redis_current_pcmklatest_id
- name: Temporarily tag the current redis image id with the upgraded image name
shell: "docker tag {{redis_current_pcmklatest_id.stdout}} {{redis_docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{redis_current_pcmklatest_id.stdout}}"
container_image_latest: "{{redis_docker_image_latest}}"
when: redis_current_pcmklatest_id.stdout != ''
- name: Check redis-bundle cluster resource status
pacemaker_resource:
Expand Down
44 changes: 18 additions & 26 deletions docker/services/pacemaker/haproxy.yaml
Expand Up @@ -210,30 +210,6 @@ outputs:
optional: true
docker_config_scripts: {get_attr: [ContainersCommon, docker_config_scripts]}
docker_config:
step_1:
haproxy_image_tag:
start_order: 1
detach: false
net: host
user: root
command:
- '/bin/bash'
- '-c'
- str_replace:
template:
"/usr/bin/docker tag 'HAPROXY_IMAGE' 'HAPROXY_IMAGE_PCMKLATEST'"
params:
HAPROXY_IMAGE: {get_param: DockerHAProxyImage}
HAPROXY_IMAGE_PCMKLATEST: *haproxy_image_pcmklatest
image: {get_param: DockerHAProxyImage}
volumes:
- /etc/hosts:/etc/hosts:ro
- /etc/localtime:/etc/localtime:ro
- /dev/shm:/dev/shm:rw
- /etc/sysconfig/docker:/etc/sysconfig/docker:ro
- /usr/bin:/usr/bin:ro
- /var/run/docker.sock:/var/run/docker.sock:rw
image: {get_param: DockerHAProxyImage}
step_2:
haproxy_restart_bundle:
start_order: 2
Expand Down Expand Up @@ -305,6 +281,14 @@ outputs:
- { 'path': /var/lib/haproxy, 'setype': svirt_sandbox_file_t }
metadata_settings:
get_attr: [HAProxyBase, role_data, metadata_settings]
deploy_steps_tasks:
- name: HAproxy tag container image for pacemaker
when: step|int == 2
import_role:
name: tripleo-container-tag
vars:
container_image: {get_param: DockerHAProxyImage}
container_image_latest: *haproxy_image_pcmklatest
update_tasks:
- name: Set HAProxy upgrade facts
block: &haproxy_update_upgrade_facts
Expand Down Expand Up @@ -383,7 +367,11 @@ outputs:
- name: Pull latest Haproxy images
command: "docker pull {{docker_image}}"
- name: Retag pcmklatest to latest Haproxy image
shell: "docker tag {{docker_image}} {{docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{ docker_image }}"
container_image_latest: "{{ docker_image_latest }}"
# Got to check that pacemaker_is_active is working fine with bundle.
# TODO: pacemaker_is_active resource doesn't support bundle.
upgrade_tasks:
Expand All @@ -402,7 +390,11 @@ outputs:
shell: "docker images | awk '/haproxy.* pcmklatest/{print $3}' | uniq"
register: haproxy_current_pcmklatest_id
- name: Temporarily tag the current haproxy image id with the upgraded image name
shell: "docker tag {{haproxy_current_pcmklatest_id.stdout}} {{haproxy_docker_image_latest}}"
import_role:
name: tripleo-container-tag
vars:
container_image: "{{haproxy_current_pcmklatest_id.stdout}}"
container_image_latest: "{{haproxy_docker_image_latest}}"
when: haproxy_current_pcmklatest_id.stdout != ''
- name: Check haproxy-bundle cluster resource status
pacemaker_resource:
Expand Down

0 comments on commit ef6d7cf

Please sign in to comment.