From 2ea7f287fa156560c57682cc89deaedc632c247d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 31 Aug 2017 12:04:40 +0200 Subject: [PATCH] docker: simplify variable declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Less configuration for the user, the container inherit from the global variables. No more container specific variables. Signed-off-by: Sébastien Han --- group_vars/mdss.yml.sample | 7 ++++--- group_vars/mgrs.yml.sample | 2 +- group_vars/mons.yml.sample | 7 ++----- group_vars/nfss.yml.sample | 2 -- group_vars/restapis.yml.sample | 2 -- group_vars/rgws.yml.sample | 2 -- roles/ceph-mds/defaults/main.yml | 7 ++++--- roles/ceph-mds/templates/ceph-mds.service.j2 | 3 ++- roles/ceph-mgr/defaults/main.yml | 2 +- roles/ceph-mgr/templates/ceph-mgr.service.j2 | 1 + roles/ceph-mon/defaults/main.yml | 7 ++----- roles/ceph-mon/templates/ceph-mon.service.j2 | 6 ++++-- roles/ceph-nfs/defaults/main.yml | 2 -- roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 | 2 ++ roles/ceph-restapi/defaults/main.yml | 2 -- roles/ceph-rgw/defaults/main.yml | 2 -- 16 files changed, 23 insertions(+), 33 deletions(-) diff --git a/group_vars/mdss.yml.sample b/group_vars/mdss.yml.sample index 4dbf4e795..3bfab9769 100644 --- a/group_vars/mdss.yml.sample +++ b/group_vars/mdss.yml.sample @@ -13,8 +13,6 @@ dummy: # GENERAL # ########### -#fetch_directory: fetch/ - # Even though MDS nodes should not have the admin key # at their disposal, some people might want to have it # distributed on MDS nodes. Setting 'copy_admin_key' to 'true' @@ -32,7 +30,10 @@ dummy: #ceph_mds_docker_memory_limit: 1g #ceph_mds_docker_cpu_limit: 1 -#ceph_mds_docker_extra_env: -e CLUSTER={{ cluster }} -e MDS_NAME={{ ansible_hostname }} +# we currently for MDS_NAME to hostname because of a bug in ceph-docker +# fix here: https://github.com/ceph/ceph-docker/pull/770 +# this will go away soon. +#ceph_mds_docker_extra_env: -e MDS_NAME={{ ansible_hostname }} #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/group_vars/mgrs.yml.sample b/group_vars/mgrs.yml.sample index d82d3b067..a7f10dbef 100644 --- a/group_vars/mgrs.yml.sample +++ b/group_vars/mgrs.yml.sample @@ -18,7 +18,7 @@ dummy: #ceph_mgr_docker_memory_limit: 1g #ceph_mgr_docker_cpu_limit: 1 -#ceph_mgr_docker_extra_env: -e CLUSTER={{ cluster }} -e MGR_NAME={{ ansible_hostname }} +#ceph_mgr_docker_extra_env: #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/group_vars/mons.yml.sample b/group_vars/mons.yml.sample index ccdaa177d..2f73d2b82 100644 --- a/group_vars/mons.yml.sample +++ b/group_vars/mons.yml.sample @@ -113,7 +113,6 @@ dummy: ########## # DOCKER # ########## -#ceph_mon_docker_subnet: "{{ public_network }}"# subnet of the monitor_interface # Resource limitation # For the whole list of limits you can apply see: docs.docker.com/engine/admin/resource_constraints @@ -122,12 +121,10 @@ dummy: #ceph_mon_docker_memory_limit: 1g #ceph_mon_docker_cpu_limit: 1 -# ceph_mon_docker_extra_env: -# # Use this variable to add extra env configuration to run your mon container. # If you want to set a custom admin keyring you can set this variable like following: -# ceph_mon_docker_extra_env: -e CLUSTER={{ cluster }} -e FSID={{ fsid }} -e MON_NAME={{ monitor_name }} -e ADMIN_SECRET={{ admin_secret }} -#ceph_mon_docker_extra_env: -e CLUSTER={{ cluster }} -e FSID={{ fsid }} -e MON_NAME={{ monitor_name }} +# ceph_mon_docker_extra_env: -e ADMIN_SECRET={{ admin_secret }} +#ceph_mon_docker_extra_env: #mon_docker_privileged: false #mon_docker_net_host: true #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/group_vars/nfss.yml.sample b/group_vars/nfss.yml.sample index af8dfafa0..556501c2d 100644 --- a/group_vars/nfss.yml.sample +++ b/group_vars/nfss.yml.sample @@ -13,8 +13,6 @@ dummy: # GENERAL # ########### -#fetch_directory: fetch/ - # Even though NFS nodes should not have the admin key # at their disposal, some people might want to have it # distributed on RGW nodes. Setting 'copy_admin_key' to 'true' diff --git a/group_vars/restapis.yml.sample b/group_vars/restapis.yml.sample index 034b936cc..a7b935eb0 100644 --- a/group_vars/restapis.yml.sample +++ b/group_vars/restapis.yml.sample @@ -12,8 +12,6 @@ dummy: # GENERAL # ########### -#fetch_directory: fetch/ - ########## # DOCKER # ########## diff --git a/group_vars/rgws.yml.sample b/group_vars/rgws.yml.sample index 164e51016..38b7e3cf7 100644 --- a/group_vars/rgws.yml.sample +++ b/group_vars/rgws.yml.sample @@ -13,8 +13,6 @@ dummy: # GENERAL # ########### -#fetch_directory: fetch/ - # Even though RGW nodes should not have the admin key # at their disposal, some people might want to have it # distributed on RGW nodes. Setting 'copy_admin_key' to 'true' diff --git a/roles/ceph-mds/defaults/main.yml b/roles/ceph-mds/defaults/main.yml index 9d8fbbd43..b065bc7b6 100644 --- a/roles/ceph-mds/defaults/main.yml +++ b/roles/ceph-mds/defaults/main.yml @@ -5,8 +5,6 @@ # GENERAL # ########### -fetch_directory: fetch/ - # Even though MDS nodes should not have the admin key # at their disposal, some people might want to have it # distributed on MDS nodes. Setting 'copy_admin_key' to 'true' @@ -24,7 +22,10 @@ copy_admin_key: false ceph_mds_docker_memory_limit: 1g ceph_mds_docker_cpu_limit: 1 -ceph_mds_docker_extra_env: -e CLUSTER={{ cluster }} -e MDS_NAME={{ ansible_hostname }} +# we currently for MDS_NAME to hostname because of a bug in ceph-docker +# fix here: https://github.com/ceph/ceph-docker/pull/770 +# this will go away soon. +ceph_mds_docker_extra_env: -e MDS_NAME={{ ansible_hostname }} ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-mds/templates/ceph-mds.service.j2 b/roles/ceph-mds/templates/ceph-mds.service.j2 index 0d99e5314..48e4e561b 100644 --- a/roles/ceph-mds/templates/ceph-mds.service.j2 +++ b/roles/ceph-mds/templates/ceph-mds.service.j2 @@ -22,8 +22,9 @@ ExecStart=/usr/bin/docker run --rm --net=host \ -e KV_PORT={{kv_port}} \ {% endif -%} -v /etc/localtime:/etc/localtime:ro \ - -e CEPH_DAEMON=MDS \ + -e CLUSTER={{ cluster }} \ -e CEPHFS_CREATE=1 \ + -e CEPH_DAEMON=MDS \ {{ ceph_mds_docker_extra_env }} \ --name=ceph-mds-{{ ansible_hostname }} \ {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} diff --git a/roles/ceph-mgr/defaults/main.yml b/roles/ceph-mgr/defaults/main.yml index 78a83fd35..57300559b 100644 --- a/roles/ceph-mgr/defaults/main.yml +++ b/roles/ceph-mgr/defaults/main.yml @@ -10,7 +10,7 @@ ceph_mgr_docker_memory_limit: 1g ceph_mgr_docker_cpu_limit: 1 -ceph_mgr_docker_extra_env: -e CLUSTER={{ cluster }} -e MGR_NAME={{ ansible_hostname }} +ceph_mgr_docker_extra_env: ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-mgr/templates/ceph-mgr.service.j2 b/roles/ceph-mgr/templates/ceph-mgr.service.j2 index 5aecf4ce3..981289199 100644 --- a/roles/ceph-mgr/templates/ceph-mgr.service.j2 +++ b/roles/ceph-mgr/templates/ceph-mgr.service.j2 @@ -22,6 +22,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \ -e KV_PORT={{kv_port}} \ {% endif -%} -v /etc/localtime:/etc/localtime:ro \ + -e CLUSTER={{ cluster }} \ -e CEPH_DAEMON=MGR \ {{ ceph_mgr_docker_extra_env }} \ --name=ceph-mgr-{{ ansible_hostname }} \ diff --git a/roles/ceph-mon/defaults/main.yml b/roles/ceph-mon/defaults/main.yml index 88e0d80fb..ca3c07d95 100644 --- a/roles/ceph-mon/defaults/main.yml +++ b/roles/ceph-mon/defaults/main.yml @@ -105,7 +105,6 @@ openstack_keys: ########## # DOCKER # ########## -ceph_mon_docker_subnet: "{{ public_network }}"# subnet of the monitor_interface # Resource limitation # For the whole list of limits you can apply see: docs.docker.com/engine/admin/resource_constraints @@ -114,12 +113,10 @@ ceph_mon_docker_subnet: "{{ public_network }}"# subnet of the monitor_interface ceph_mon_docker_memory_limit: 1g ceph_mon_docker_cpu_limit: 1 -# ceph_mon_docker_extra_env: -# # Use this variable to add extra env configuration to run your mon container. # If you want to set a custom admin keyring you can set this variable like following: -# ceph_mon_docker_extra_env: -e CLUSTER={{ cluster }} -e FSID={{ fsid }} -e MON_NAME={{ monitor_name }} -e ADMIN_SECRET={{ admin_secret }} -ceph_mon_docker_extra_env: -e CLUSTER={{ cluster }} -e FSID={{ fsid }} -e MON_NAME={{ monitor_name }} +# ceph_mon_docker_extra_env: -e ADMIN_SECRET={{ admin_secret }} +ceph_mon_docker_extra_env: mon_docker_privileged: false mon_docker_net_host: true ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index 07c776a2c..490d5973c 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -28,8 +28,6 @@ ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i --net=host \ {% if mon_docker_net_host -%} --net=host \ {% endif -%} - -e CEPH_DAEMON=MON \ - -e CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }} \ -e IP_VERSION={{ ip_version[-1:] }} \ {% if monitor_address is defined and monitor_address != '0.0.0.0' %} {% if ip_version == 'ipv4' -%} @@ -42,6 +40,10 @@ ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i --net=host \ {% elif ip_version =='ipv6' -%} -e MON_IP=[{{ hostvars[inventory_hostname]['ansible_' + monitor_interface][ip_version][0]['address'] }}] \ {% endif -%} + -e CLUSTER={{ cluster }} \ + -e FSID={{ fsid }} \ + -e CEPH_PUBLIC_NETWORK={{ public_network }} \ + -e CEPH_DAEMON=MON \ {{ ceph_mon_docker_extra_env }} \ {{ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} ExecStopPost=-/usr/bin/docker stop ceph-mon-%i diff --git a/roles/ceph-nfs/defaults/main.yml b/roles/ceph-nfs/defaults/main.yml index 786099d27..2e4c8bfff 100644 --- a/roles/ceph-nfs/defaults/main.yml +++ b/roles/ceph-nfs/defaults/main.yml @@ -5,8 +5,6 @@ # GENERAL # ########### -fetch_directory: fetch/ - # Even though NFS nodes should not have the admin key # at their disposal, some people might want to have it # distributed on RGW nodes. Setting 'copy_admin_key' to 'true' diff --git a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 index 48b448bb1..9be66e5d6 100644 --- a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 +++ b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 @@ -14,6 +14,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \ --cpu-quota={{ ceph_rbd_mirror_docker_cpu_limit * 100000 }} \ {% endif -%} {% if not containerized_deployment_with_kv -%} + -v /var/lib/ceph:/var/lib/ceph \ -v /etc/ceph:/etc/ceph \ {% else -%} -e KV_TYPE={{kv_type}} \ @@ -21,6 +22,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \ -e KV_PORT={{kv_port}} \ {% endif -%} -v /etc/localtime:/etc/localtime:ro \ + -e CLUSTER={{ cluster }} \ -e CEPH_DAEMON=RBD_MIRROR \ --name=ceph-rbd-mirror-{{ ansible_hostname }} \ {{ ceph_rbd_mirror_docker_extra_env }} \ diff --git a/roles/ceph-restapi/defaults/main.yml b/roles/ceph-restapi/defaults/main.yml index 4152ee730..2c88d3c67 100644 --- a/roles/ceph-restapi/defaults/main.yml +++ b/roles/ceph-restapi/defaults/main.yml @@ -4,8 +4,6 @@ # GENERAL # ########### -fetch_directory: fetch/ - ########## # DOCKER # ########## diff --git a/roles/ceph-rgw/defaults/main.yml b/roles/ceph-rgw/defaults/main.yml index 7f0a8aa4c..d8587fa46 100644 --- a/roles/ceph-rgw/defaults/main.yml +++ b/roles/ceph-rgw/defaults/main.yml @@ -5,8 +5,6 @@ # GENERAL # ########### -fetch_directory: fetch/ - # Even though RGW nodes should not have the admin key # at their disposal, some people might want to have it # distributed on RGW nodes. Setting 'copy_admin_key' to 'true'