harmonize docker names

Created containers now are named more or less in the form of

    <ansible role>-<ansible_hostname>
pull/1317/head
Tobias Florek 2017-02-20 10:03:49 +01:00
parent e874c7e8ac
commit 931027e6f7
14 changed files with 50 additions and 52 deletions

View File

@ -72,7 +72,7 @@
- name: remove ceph mds container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}"
name: "ceph-mds-{{ ansible_hostname }}"
state: absent
ignore_errors: true
@ -119,7 +119,7 @@
- name: remove ceph rgw container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}"
name: "ceph-rgw-{{ ansible_hostname }}"
state: absent
ignore_errors: true
@ -166,7 +166,7 @@
- name: remove ceph rbd-mirror container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}"
name: "ceph-rbd-mirror-{{ ansible_hostname }}"
state: absent
ignore_errors: true
@ -213,7 +213,7 @@
- name: remove ceph nfs container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}"
name: "ceph-nfs-{{ ansible_hostname }}"
state: absent
ignore_errors: true
@ -270,7 +270,7 @@
- name: remove ceph osd prepare container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}-osd-prepare-{{ item | regex_replace('/', '') }}"
name: "ceph-osd-prepare-{{ ansible_hostname }}-dev{{ item | regex_replace('/', '') }}"
state: absent
with_items: "{{ ceph_osd_docker_devices }}"
ignore_errors: true
@ -278,7 +278,7 @@
- name: remove ceph osd container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}"
name: "ceph-osd-{{ ansible_hostname }}-dev{{ item | regex_replace('/', '') }}"
state: absent
with_items: "{{ ceph_osd_docker_devices }}"
ignore_errors: true
@ -287,7 +287,7 @@
shell: |
docker run \
--privileged=true \
--name {{ ansible_hostname }}-osd-zap-{{ item | regex_replace('/', '') }} \
--name ceph-osd-zap-{{ ansible_hostname }}-dev{{ item | regex_replace('/', '') }} \
-v /dev/:/dev/ \
-e OSD_DEVICE={{ item }} \
{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
@ -298,7 +298,7 @@
- name: wait until the zap containers die
shell: |
docker ps | grep -sq {{ ansible_hostname }}-osd-zap
docker ps | grep -sq ceph-osd-zap-{{ ansible_hostname }}-dev
register: zap_alive
failed_when: false
until: zap_alive.rc != 0
@ -308,7 +308,7 @@
- name: remove ceph osd zap disk container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}-osd-zap-{{ item | regex_replace('/', '') }}"
name: "ceph-osd-zap-{{ ansible_hostname }}-dev{{ item | regex_replace('/', '') }}"
state: absent
with_items:
- "{{ ceph_osd_docker_devices }}"
@ -361,14 +361,14 @@
- name: remove ceph mon container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}"
name: "ceph-mon-{{ ansible_hostname }}"
state: absent
ignore_errors: true
- name: remove restapi container
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}-ceph-restapi"
name: "ceph-restapi-{{ ansible_hostname }}"
state: absent
ignore_errors: true

View File

@ -158,7 +158,7 @@
- name: waiting for the containerized monitor to join the quorum...
shell: |
docker exec {{ hostvars[mon_host]['ansible_hostname'] }} ceph -s --cluster {{ cluster }} | grep quorum | sed 's/.*quorum//' | egrep -sq {{ ansible_hostname }}
docker exec ceph-mon-{{ hostvars[mon_host]['ansible_hostname'] }} ceph -s --cluster {{ cluster }} | grep quorum | sed 's/.*quorum//' | egrep -sq {{ ansible_hostname }}
register: result
until: result.rc == 0
retries: "{{ health_mon_check_retries }}"
@ -193,7 +193,7 @@
- name: set containerized osd flags
command: |
docker exec {{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph osd set {{ item }} --cluster {{ cluster }}
docker exec ceph-osd-{{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph osd set {{ item }} --cluster {{ cluster }}
with_items:
- noout
- noscrub
@ -283,7 +283,7 @@
- name: container - waiting for clean pgs...
shell: |
test "$(docker exec {{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph pg stat --cluster {{ cluster }} | sed 's/^.*pgs://;s/active+clean.*//;s/ //')" -eq "$(docker exec {{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph pg stat --cluster {{ cluster }} | sed 's/pgs.*//;s/^.*://;s/ //')" && docker exec {{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph health --cluster {{ cluster }} | egrep -sq "HEALTH_OK|HEALTH_WARN"
test "$(docker exec ceph-osd-{{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph pg stat --cluster {{ cluster }} | sed 's/^.*pgs://;s/active+clean.*//;s/ //')" -eq "$(docker exec {{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph pg stat --cluster {{ cluster }} | sed 's/pgs.*//;s/^.*://;s/ //')" && docker exec {{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph health --cluster {{ cluster }} | egrep -sq "HEALTH_OK|HEALTH_WARN"
register: result
until: result.rc == 0
retries: "{{ health_osd_check_retries }}"
@ -302,7 +302,7 @@
- name: unset containerized osd flags
command: |
docker exec {{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph osd unset {{ item }} --cluster {{ cluster }}
docker exec ceph-osd-{{ hostvars[groups.mons[0]]['ansible_hostname'] }} ceph osd unset {{ item }} --cluster {{ cluster }}
with_items:
- noout
- noscrub

View File

@ -163,7 +163,7 @@
- name: start ceph mon container image
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}"
name: "ceph-mon-{{ ansible_hostname }}"
net: "host"
state: "running"
privileged: "{{ mon_docker_privileged }}"
@ -266,7 +266,7 @@
- name: start ceph osd container image(s)
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}"
name: "ceph-osd-{{ ansible_hostname }}-dev{{ item | regex_replace('/', '') }}"
net: host
pid: host
state: started
@ -339,7 +339,7 @@
- name: start ceph metadata container image
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: ceph-{{ ansible_hostname }}-mds
name: ceph-mds-{{ ansible_hostname }}
net: host
state: running
env: "CEPH_DAEMON=MDS,CEPHFS_CREATE=1,{{ ceph_mds_docker_extra_env }}"
@ -399,7 +399,7 @@
- name: start ceph rados gateway container image
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: ceph-{{ ansible_hostname }}-rgw
name: ceph-rgw-{{ ansible_hostname }}
expose: "{{ ceph_rgw_civetweb_port }}"
ports: "{{ ceph_rgw_civetweb_port }}:{{ ceph_rgw_civetweb_port }}"
state: running
@ -460,7 +460,7 @@
- name: start ceph rbd mirror container image
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}"
name: "ceph-rbd-mirror-{{ ansible_hostname }}"
net: host
state: running
volumes: "/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro"
@ -519,7 +519,7 @@
- name: start ceph nfs container image
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}"
name: "ceph-nfs-{{ ansible_hostname }}"
net: "host"
state: "running"
privileged: true

View File

@ -4,8 +4,8 @@ After=docker.service
[Service]
EnvironmentFile=-/etc/environment
ExecStartPre=-/usr/bin/docker stop {{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker rm {{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker stop ceph-mds-{{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker rm ceph-mds-{{ ansible_hostname }}
ExecStart=/usr/bin/docker run --rm --net=host \
{% if not mds_containerized_deployment_with_kv -%}
-v /var/lib/ceph:/var/lib/ceph \
@ -15,13 +15,12 @@ ExecStart=/usr/bin/docker run --rm --net=host \
-e KV_IP={{kv_endpoint}} \
{% endif -%}
-v /etc/localtime:/etc/localtime:ro \
--privileged \
-e CEPH_DAEMON=MDS \
-e CEPHFS_CREATE=1 \
{{ ceph_mds_docker_extra_env }} \
--name={{ ansible_hostname }} \
--name=ceph-mds-{{ ansible_hostname }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
ExecStopPost=-/usr/bin/docker stop {{ ansible_hostname }}
ExecStopPost=-/usr/bin/docker stop ceph-mds-{{ ansible_hostname }}
Restart=always
RestartSec=10s
TimeoutStartSec=120

View File

@ -59,14 +59,14 @@
- include: start_docker_monitor.yml
- name: wait for monitor socket to exist
command: docker exec {{ ansible_hostname }} stat /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok
command: docker exec ceph-mon-{{ ansible_hostname }} stat /var/run/ceph/{{ cluster }}-mon.{{ ansible_fqdn }}.asok
register: monitor_socket
retries: 5
delay: 10
until: monitor_socket.rc == 0
- name: force peer addition as potential bootstrap peer for cluster bringup
command: docker exec {{ ansible_hostname }} ceph --admin-daemon /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok add_bootstrap_peer_hint {{ hostvars[item]['ansible_' + ceph_mon_docker_interface].ipv4.address }}
command: docker exec ceph-mon-{{ ansible_hostname }} ceph --admin-daemon /var/run/ceph/{{ cluster }}-mon.{{ ansible_fqdn }}.asok add_bootstrap_peer_hint {{ hostvars[item]['ansible_' + ceph_mon_docker_interface].ipv4.address }}
with_items: "{{ groups.mons }}"
changed_when: false
failed_when: false
@ -78,7 +78,7 @@
when: not mon_containerized_deployment_with_kv
- name: create ceph rest api keyring when mon is containerized
command: docker exec {{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/{{ cluster }}.client.restapi.keyring
command: docker exec ceph-mon-{{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/{{ cluster }}.client.restapi.keyring
args:
creates: /etc/ceph/{{ cluster }}.client.restapi.keyring
changed_when: false

View File

@ -4,9 +4,9 @@ After=docker.service
[Service]
EnvironmentFile=-/etc/environment
ExecStartPre=-/usr/bin/docker rm %i
ExecStartPre=-/usr/bin/docker rm ceph-mon-%i
ExecStartPre=$(command -v mkdir) -p /etc/ceph /var/lib/ceph/mon
ExecStart=/usr/bin/docker run --rm --name %i --net=host \
ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i --net=host \
{% if not mon_containerized_deployment_with_kv -%}
-v /var/lib/ceph:/var/lib/ceph \
-v /etc/ceph:/etc/ceph \
@ -27,7 +27,7 @@ ExecStart=/usr/bin/docker run --rm --name %i --net=host \
-e CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }} \
{{ ceph_mon_docker_extra_env }} \
{{ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
ExecStopPost=-/usr/bin/docker stop %i
ExecStopPost=-/usr/bin/docker stop ceph-mon-%i
Restart=always
RestartSec=10s
TimeoutStartSec=120

View File

@ -10,7 +10,7 @@
- name: create the nfs rgw user
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: ceph-{{ ansible_hostname }}-rgw-user
name: ceph-rgw-user-{{ ansible_hostname }}
hostname: "{{ ansible_hostname }}"
expose: "{{ ceph_rgw_civetweb_port }}"
ports: "{{ ceph_rgw_civetweb_port }}:{{ ceph_rgw_civetweb_port }}"
@ -20,7 +20,7 @@
when: nfs_obj_gw
- name: get user create output
command: docker logs ceph-{{ ansible_hostname }}-rgw-user
command: docker logs ceph-rgw-user-{{ ansible_hostname }}
always_run: true
register: rgwuser

View File

@ -5,7 +5,7 @@ After=docker.service
[Service]
EnvironmentFile=-/etc/environment
ExecStartPre=-/usr/bin/docker rm %i
ExecStartPre=-/usr/bin/docker rm ceph-nfs-%i
ExecStartPre=/usr/bin/mkdir -p /etc/ceph /etc/ganesha /var/lib/nfs/ganesha
ExecStart=/usr/bin/docker run --rm --net=host \
{% if not mon_containerized_deployment_with_kv -%}
@ -19,9 +19,9 @@ ExecStart=/usr/bin/docker run --rm --net=host \
--privileged \
-e CEPH_DAEMON=NFS \
{{ ceph_nfs_docker_extra_env }} \
--name=nfs-{{ ansible_hostname }} \
--name=ceph-nfs-{{ ansible_hostname }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
ExecStopPost=-/usr/bin/docker stop %i
ExecStopPost=-/usr/bin/docker stop ceph-nfs-%i
Restart=always
RestartSec=10s
TimeoutStartSec=120

View File

@ -24,7 +24,7 @@
docker run --net=host \
--pid=host \
--privileged=true \
--name="{{ ansible_hostname }}-osd-prepare-{{ item.0 | regex_replace('/', '') }}" \
--name="ceph-osd-prepare-{{ ansible_hostname }}-dev{{ item.0 | regex_replace('/', '') }}" \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /dev:/dev \
@ -47,7 +47,7 @@
docker run --net=host \
--pid=host \
--privileged=true \
--name="{{ ansible_hostname }}-osd-prepare-{{ item.0 | regex_replace('/', '') }}" \
--name="ceph-osd-prepare-{{ ansible_hostname }}-dev-{{ item.0 | regex_replace('/', '') }}" \
-v /dev:/dev \
-v /etc/localtime:/etc/localtime:ro \
-e "OSD_DEVICE={{ item.0 }}" \

View File

@ -46,5 +46,5 @@ fi
-e CEPH_DAEMON=OSD_CEPH_DISK_ACTIVATE \
-e OSD_DEVICE=/dev/${1} \
{{ ceph_osd_docker_extra_env }} \
--name={{ ansible_hostname }}-osd-dev${1} \
--name=ceph-osd-{{ ansible_hostname }}-dev${1} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}

View File

@ -6,9 +6,9 @@ After=docker.service
[Service]
EnvironmentFile=-/etc/environment
ExecStartPre=-/usr/bin/docker stop {{ ansible_hostname }}-osd-dev%i
ExecStartPre=-/usr/bin/docker rm -f {{ ansible_hostname }}-osd-dev%i
ExecStartPre=-/usr/bin/docker rm -f ceph-osd-{{ ansible_hostname }}-dev%i
ExecStart={{ ceph_osd_docker_run_script_path }}/ceph-osd-run.sh %i
ExecStop=-/usr/bin/docker stop {{ ansible_hostname }}-osd-dev%i
ExecStop=-/usr/bin/docker stop ceph-osd-{{ ansible_hostname }}-dev%i
Restart=always
RestartSec=10s
TimeoutStartSec=120

View File

@ -4,8 +4,8 @@ After=docker.service
[Service]
EnvironmentFile=-/etc/environment
ExecStartPre=-/usr/bin/docker stop {{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker rm {{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker stop ceph-rdb-mirror-{{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker rm ceph-rdb-mirror-{{ ansible_hostname }}
ExecStart=/usr/bin/docker run --rm --net=host \
{% if not rbd_mirror_containerized_deployment_with_kv -%}
-v /etc/ceph:/etc/ceph \
@ -14,11 +14,10 @@ ExecStart=/usr/bin/docker run --rm --net=host \
-e KV_IP={{kv_endpoint}} \
{% endif -%}
-v /etc/localtime:/etc/localtime:ro \
--privileged \
-e CEPH_DAEMON=RBD_MIRROR \
--name={{ ansible_hostname }} \
--name=ceph-rdb-mirror-{{ ansible_hostname }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
ExecStopPost=-/usr/bin/docker stop {{ ansible_hostname }}
ExecStopPost=-/usr/bin/docker stop ceph-rdb-mirror-{{ ansible_hostname }}
Restart=always
RestartSec=10s
TimeoutStartSec=120

View File

@ -2,7 +2,7 @@
- name: run the ceph rest api docker image
docker:
image: "{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}-ceph-restapi"
name: "ceph-restapi-{{ ansible_hostname }}"
net: host
expose: "{{ ceph_restapi_port }}"
state: running

View File

@ -4,8 +4,8 @@ After=docker.service
[Service]
EnvironmentFile=-/etc/environment
ExecStartPre=-/usr/bin/docker stop {{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker rm {{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker stop ceph-rgw-{{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker rm ceph-rgw-{{ ansible_hostname }}
ExecStart=/usr/bin/docker run --rm --net=host \
{% if not rgw_containerized_deployment_with_kv -%}
-v /var/lib/ceph:/var/lib/ceph \
@ -18,9 +18,9 @@ ExecStart=/usr/bin/docker run --rm --net=host \
--privileged \
-e CEPH_DAEMON=RGW \
{{ ceph_rgw_docker_extra_env }} \
--name={{ ansible_hostname }} \
--name=ceph-rgw-{{ ansible_hostname }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
ExecStopPost=-/usr/bin/docker stop {{ ansible_hostname }}
ExecStopPost=-/usr/bin/docker stop ceph-rgw-{{ ansible_hostname }}
Restart=always
RestartSec=10s
TimeoutStartSec=120