From: Guillaume Abrioux Date: Wed, 12 Apr 2017 17:57:33 +0000 (+0200) Subject: Refact code X-Git-Tag: v2.3.0rc2~38^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1469%2Fhead;p=ceph-ansible.git Refact code `ceph-docker-common`: At the moment there is a lot of duplicated tasks in each `./roles/ceph-/tasks/docker/main.yml` that could be refactored in `./roles/ceph-docker-common/tasks/main.yml`. `*_containerized_deployment` variables: All `*_containerized_deployment` have been refactored to a single variable `containerized_deployment` duplicate `cephx` variables in `group_vars/* have been removed. Signed-off-by: Guillaume Abrioux --- diff --git a/Vagrantfile b/Vagrantfile index 910f6bdf9..19d93e8fc 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -73,14 +73,7 @@ ansible_provision = proc do |ansible| # In a production deployment, these should be secret if DOCKER then ansible.extra_vars = ansible.extra_vars.merge({ - mon_containerized_deployment: 'true', - osd_containerized_deployment: 'true', - mds_containerized_deployment: 'true', - rgw_containerized_deployment: 'true', - nfs_containerized_deployment: 'true', - restapi_containerized_deployment: 'true', - rbd_mirror_containerized_deployment: 'true', - mgr_containerized_deployment: 'true', + containerized_deployment: 'true', ceph_mon_docker_interface: ETH, ceph_mon_docker_subnet: "#{PUBLIC_SUBNET}.0/24", ceph_osd_docker_devices: settings['disks'], diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 8df17f1e5..39c84a285 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -386,10 +386,10 @@ dummy: #ceph_docker_image: "ceph/daemon" #ceph_docker_image_tag: latest -# Do not comment the following variables mon_containerized_deployment_* here. These variables are being used +# Do not comment the following variables containerized_deployment_* here. These variables are being used # by ceph.conf.j2 template. so it should always be defined -#mon_containerized_deployment_with_kv: false -#mon_containerized_deployment: false +#containerized_deployment_with_kv: false +#containerized_deployment: false #mon_containerized_default_ceph_conf_with_kv: false # Confiure the type of NFS gatway access. At least one must be enabled for an @@ -404,6 +404,8 @@ dummy: # do not ever change this here #rolling_update: false +#fsid: "{{ cluster_uuid.stdout }}" +#generate_fsid: true #ceph_docker_registry: docker.io #ceph_docker_enable_centos_extra_repo: false @@ -414,4 +416,12 @@ dummy: # These values have to be set according to the base OS used by the container image, NOT the host. #bootstrap_dirs_owner: "64045" #bootstrap_dirs_group: "64045" +# +############ +# KV store # +############ +#kv_type: etcd +#kv_endpoint: 127.0.0.1 +#kv_port: 4001 +#containerized_deployment_with_kv: false diff --git a/group_vars/mdss.yml.sample b/group_vars/mdss.yml.sample index d49dfd256..084f40994 100644 --- a/group_vars/mdss.yml.sample +++ b/group_vars/mdss.yml.sample @@ -21,20 +21,10 @@ dummy: # will copy the admin key to the /etc/ceph/ directory #copy_admin_key: false -#cephx: true - - ########## # DOCKER # ########## -#mds_containerized_deployment: false -#mds_containerized_deployment_with_kv: false -#kv_type: etcd -#kv_endpoint: 127.0.0.1 -#ceph_docker_image: "ceph/daemon" -#ceph_docker_image_tag: latest #ceph_mds_docker_extra_env: -e CLUSTER={{ cluster }} -e MDS_NAME={{ ansible_hostname }} -#ceph_docker_on_openstack: false #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/group_vars/mgrs.yml.sample b/group_vars/mgrs.yml.sample index c4c60fc66..787e3cc78 100644 --- a/group_vars/mgrs.yml.sample +++ b/group_vars/mgrs.yml.sample @@ -11,13 +11,6 @@ dummy: # DOCKER # ########## -#mgr_containerized_deployment: false -#mgr_containerized_deployment_with_kv: false -#kv_type: etcd -#kv_endpoint: 127.0.0.1 -#ceph_docker_image: "ceph/daemon" -#ceph_docker_image_tag: latest #ceph_mgr_docker_extra_env: -e CLUSTER={{ cluster }} -e MGR_NAME={{ ansible_hostname }} -#ceph_docker_on_openstack: false #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/group_vars/mons.yml.sample b/group_vars/mons.yml.sample index 620a23cb2..838dfa230 100644 --- a/group_vars/mons.yml.sample +++ b/group_vars/mons.yml.sample @@ -20,7 +20,6 @@ dummy: # ACTIVATE BOTH FSID AND MONITOR_SECRET VARIABLES FOR NON-VAGRANT DEPLOYMENT #fsid: "{{ cluster_uuid.stdout }}" #monitor_secret: "{{ monitor_keyring.stdout }}" -#cephx: true # CephFS #cephfs_data: cephfs_data @@ -78,16 +77,9 @@ dummy: # DOCKER # ########## #docker_exec_cmd: -#mon_containerized_deployment: false -#mon_containerized_deployment_with_kv: false -# This is currently in ceph-common defaults because it is shared with ceph-nfs -#mon_containerized_default_ceph_conf_with_kv: false #ceph_mon_docker_interface: "{{ monitor_interface }}" #ceph_mon_docker_subnet: "{{ public_network }}"# subnet of the ceph_mon_docker_interface -#ceph_docker_image: "ceph/daemon" -#ceph_docker_image_tag: latest #ceph_mon_docker_extra_env: -e CLUSTER={{ cluster }} -e FSID={{ fsid }} -e MON_NAME={{ monitor_name }} -#ceph_docker_on_openstack: false #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 4433f6f9f..011f0cc25 100644 --- a/group_vars/nfss.yml.sample +++ b/group_vars/nfss.yml.sample @@ -15,11 +15,6 @@ dummy: #fetch_directory: fetch/ -## Ceph options -# -#cephx: true - - ####################### # Access type options # ####################### @@ -81,13 +76,8 @@ dummy: # DOCKER # ########## -#nfs_containerized_deployment: false -#nfs_containerized_deployment_with_kv: false -#kv_type: etcd -#kv_endpoint: 127.0.0.1 #ceph_docker_image: "ceph/ganesha" #ceph_docker_image_tag: latest #ceph_nfs_docker_extra_env: -e GANESHA_EPOCH={{ ganesha_epoch }} -#ceph_docker_on_openstack: false #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/group_vars/osds.yml.sample b/group_vars/osds.yml.sample index c8f67b946..d2b2124e8 100644 --- a/group_vars/osds.yml.sample +++ b/group_vars/osds.yml.sample @@ -60,7 +60,6 @@ dummy: # ACTIVATE THE FSID VARIABLE FOR NON-VAGRANT DEPLOYMENT #fsid: "{{ cluster_uuid.stdout }}" -#cephx: true # Devices to be used as OSDs # You can pre-provision disks that are not present yet. @@ -158,15 +157,7 @@ dummy: # DOCKER # ########## -#osd_containerized_deployment: false -#osd_containerized_deployment_with_kv: false -#kv_type: etcd -#kv_endpoint: 127.0.0.1 -#kv_port: 4001 -#ceph_docker_image: "ceph/daemon" -#ceph_docker_image_tag: latest #ceph_config_keys: [] # DON'T TOUCH ME -#ceph_docker_on_openstack: false # PREPARE DEVICE # Make sure you only pass a single device to raw_journal_devices, otherwise this will fail horribly. diff --git a/group_vars/rbd-mirrors.yml.sample b/group_vars/rbd-mirrors.yml.sample index 22d1933d7..4be7cfd7e 100644 --- a/group_vars/rbd-mirrors.yml.sample +++ b/group_vars/rbd-mirrors.yml.sample @@ -42,12 +42,5 @@ dummy: # DOCKER # ########## -#rbd_mirror_containerized_deployment: false -#rbd_mirror_containerized_deployment_with_kv: false -#kv_type: etcd -#kv_endpoint: 127.0.0.1 -#ceph_docker_image: "ceph/daemon" -#ceph_docker_image_tag: latest -#ceph_docker_on_openstack: false #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/group_vars/restapis.yml.sample b/group_vars/restapis.yml.sample index 425e56a1f..034b936cc 100644 --- a/group_vars/restapis.yml.sample +++ b/group_vars/restapis.yml.sample @@ -18,12 +18,8 @@ dummy: # DOCKER # ########## -#restapi_containerized_deployment: false #ceph_restapi_docker_interface: eth0 #ceph_restapi_port: 5000 -#ceph_docker_image: "ceph/daemon" -#ceph_docker_image_tag: latest #ceph_restapi_docker_extra_env: "RESTAPI_IP=0.0.0.0" # comma separated variables -#ceph_docker_on_openstack: false #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/group_vars/rgws.yml.sample b/group_vars/rgws.yml.sample index ad9d2f803..22e2eeb04 100644 --- a/group_vars/rgws.yml.sample +++ b/group_vars/rgws.yml.sample @@ -21,10 +21,6 @@ dummy: # will copy the admin key to the /etc/ceph/ directory #copy_admin_key: false -## Ceph options -# -#cephx: true - # Multi-site remote pull URL variables #rgw_pull_port: "{{ radosgw_civetweb_port }}" #rgw_pull_proto: "http" @@ -59,15 +55,8 @@ dummy: # DOCKER # ########## -#rgw_containerized_deployment: false -#rgw_containerized_deployment_with_kv: false -#kv_type: etcd -#kv_endpoint: 127.0.0.1 #ceph_rgw_civetweb_port: "{{ radosgw_civetweb_port }}" -#ceph_docker_image: "ceph/daemon" -#ceph_docker_image_tag: latest #ceph_rgw_docker_extra_env: -e CLUSTER={{ cluster }} -e RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }} -#ceph_docker_on_openstack: false #ceph_config_keys: [] # DON'T TOUCH ME #rgw_config_keys: "/" # DON'T TOUCH ME diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 1853b80a1..3a0e892d6 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -88,7 +88,7 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - not mon_containerized_deployment + - not containerized_deployment roles: - ceph-mon @@ -114,7 +114,7 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - not mon_containerized_deployment + - not containerized_deployment - name: restart containerized ceph mons with systemd service: @@ -123,7 +123,7 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - mon_containerized_deployment + - containerized_deployment - name: set mon_host_count set_fact: mon_host_count={{ groups[mon_group_name] | length }} @@ -149,7 +149,7 @@ retries: "{{ health_mon_check_retries }}" delay: "{{ health_mon_check_delay }}" delegate_to: "{{ mon_host }}" - when: not mon_containerized_deployment + when: not containerized_deployment - name: waiting for the containerized monitor to join the quorum... shell: | @@ -159,7 +159,7 @@ retries: "{{ health_mon_check_retries }}" delay: "{{ health_mon_check_delay }}" delegate_to: "{{ mon_host }}" - when: mon_containerized_deployment + when: containerized_deployment - name: upgrade ceph osds cluster @@ -183,7 +183,7 @@ - noscrub - nodeep-scrub delegate_to: "{{ groups[mon_group_name][0] }}" - when: not mon_containerized_deployment + when: not containerized_deployment - name: set containerized osd flags command: | @@ -193,13 +193,13 @@ - noscrub - nodeep-scrub delegate_to: "{{ groups[mon_group_name][0] }}" - when: mon_containerized_deployment + when: containerized_deployment - name: get osd numbers shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi" register: osd_ids changed_when: false - when: not osd_containerized_deployment + when: not containerized_deployment - name: stop ceph osds with upstart service: @@ -221,7 +221,7 @@ with_items: "{{ osd_ids.stdout_lines }}" when: - ansible_service_mgr == 'systemd' - - not osd_containerized_deployment + - not containerized_deployment roles: - ceph-osd @@ -231,7 +231,7 @@ shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi" register: osd_ids changed_when: false - when: not osd_containerized_deployment + when: not containerized_deployment - name: start ceph osds with upstart service: @@ -253,7 +253,7 @@ with_items: "{{ osd_ids.stdout_lines }}" when: - ansible_service_mgr == 'systemd' - - not osd_containerized_deployment + - not containerized_deployment - name: restart containerized ceph osds with systemd service: @@ -263,7 +263,7 @@ with_items: "{{ ceph_osd_docker_devices }}" when: - ansible_service_mgr == 'systemd' - - osd_containerized_deployment + - containerized_deployment - name: waiting for clean pgs... shell: | @@ -273,7 +273,7 @@ retries: "{{ health_osd_check_retries }}" delay: "{{ health_osd_check_delay }}" delegate_to: "{{ groups[mon_group_name][0] }}" - when: not osd_containerized_deployment + when: not containerized_deployment - name: container - waiting for clean pgs... shell: | @@ -283,7 +283,7 @@ retries: "{{ health_osd_check_retries }}" delay: "{{ health_osd_check_delay }}" delegate_to: "{{ groups[mon_group_name][0] }}" - when: osd_containerized_deployment + when: containerized_deployment - name: unset osd flags command: ceph osd unset {{ item }} --cluster {{ cluster }} @@ -292,7 +292,7 @@ - noscrub - nodeep-scrub delegate_to: "{{ groups[mon_group_name][0] }}" - when: not osd_containerized_deployment + when: not containerized_deployment - name: unset containerized osd flags command: | @@ -302,7 +302,7 @@ - noscrub - nodeep-scrub delegate_to: "{{ groups[mon_group_name][0] }}" - when: osd_containerized_deployment + when: containerized_deployment - name: upgrade ceph mdss cluster @@ -338,7 +338,7 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - not mds_containerized_deployment + - not containerized_deployment roles: - ceph-mds @@ -365,7 +365,7 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - not mds_containerized_deployment + - not containerized_deployment - name: restart ceph mdss service: @@ -374,7 +374,7 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - mds_containerized_deployment + - containerized_deployment - name: upgrade ceph rgws cluster @@ -408,7 +408,7 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - not rgw_containerized_deployment + - not containerized_deployment roles: - ceph-rgw @@ -433,7 +433,7 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - not rgw_containerized_deployment + - not containerized_deployment - name: restart containerized ceph rgws with systemd service: @@ -442,4 +442,4 @@ enabled: yes when: - ansible_service_mgr == 'systemd' - - rgw_containerized_deployment + - containerized_deployment diff --git a/roles/ceph-common/defaults/main.yml b/roles/ceph-common/defaults/main.yml index d64009490..699aa8b27 100644 --- a/roles/ceph-common/defaults/main.yml +++ b/roles/ceph-common/defaults/main.yml @@ -378,10 +378,10 @@ docker: false ceph_docker_image: "ceph/daemon" ceph_docker_image_tag: latest -# Do not comment the following variables mon_containerized_deployment_* here. These variables are being used +# Do not comment the following variables containerized_deployment_* here. These variables are being used # by ceph.conf.j2 template. so it should always be defined -mon_containerized_deployment_with_kv: false -mon_containerized_deployment: false +containerized_deployment_with_kv: false +containerized_deployment: false mon_containerized_default_ceph_conf_with_kv: false # Confiure the type of NFS gatway access. At least one must be enabled for an diff --git a/roles/ceph-common/tasks/docker/fetch_image.yml b/roles/ceph-common/tasks/docker/fetch_image.yml deleted file mode 100644 index 57c76ed85..000000000 --- a/roles/ceph-common/tasks/docker/fetch_image.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -# Normal case - pull image from registry -- name: "pull {{ ceph_docker_image }} image" - command: "docker pull {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" - changed_when: false - when: ceph_docker_dev_image is undefined or not ceph_docker_dev_image - -# Dev case - export local dev image and send it across -- name: export local ceph dev image - local_action: command docker save -o "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" "{{ ceph_docker_username }}/{{ ceph_docker_imagename }}:{{ ceph_docker_image_tag }}" - when: ceph_docker_dev_image is defined and ceph_docker_dev_image - run_once: true - -- name: copy ceph dev image file - copy: - src: "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" - dest: "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" - when: ceph_docker_dev_image is defined and ceph_docker_dev_image - -- name: load ceph dev image - command: "docker load -i /tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" - when: ceph_docker_dev_image is defined and ceph_docker_dev_image - -- name: remove tmp ceph dev image file - command: "rm /tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" - when: ceph_docker_dev_image is defined and ceph_docker_dev_image diff --git a/roles/ceph-common/tasks/facts.yml b/roles/ceph-common/tasks/facts.yml index 0e444e00f..2056ce9dc 100644 --- a/roles/ceph-common/tasks/facts.yml +++ b/roles/ceph-common/tasks/facts.yml @@ -87,4 +87,3 @@ when: - rbd_client_directory_mode is not defined or not rbd_client_directory_mode - diff --git a/roles/ceph-common/tasks/generate_cluster_fsid.yml b/roles/ceph-common/tasks/generate_cluster_fsid.yml index bd4d2abe5..5f49612ca 100644 --- a/roles/ceph-common/tasks/generate_cluster_fsid.yml +++ b/roles/ceph-common/tasks/generate_cluster_fsid.yml @@ -22,3 +22,8 @@ become: false always_run: true when: generate_fsid + +- name: set fsid fact when generate_fsid = true + set_fact: + fsid: "{{ cluster_uuid.stdout }}" + when: generate_fsid diff --git a/roles/ceph-common/templates/ceph.conf.j2 b/roles/ceph-common/templates/ceph.conf.j2 index d9b3df159..59ff882e9 100644 --- a/roles/ceph-common/templates/ceph.conf.j2 +++ b/roles/ceph-common/templates/ceph.conf.j2 @@ -11,7 +11,7 @@ auth supported = none {% if ip_version == 'ipv6' %} ms bind ipv6 = true {% endif %} -{% if not mon_containerized_deployment_with_kv and not mon_containerized_deployment %} +{% if not containerized_deployment_with_kv and not containerized_deployment %} fsid = {{ fsid }} {% endif %} max open files = {{ max_open_files }} @@ -30,7 +30,7 @@ mon initial members = {% for host in groups[mon_group_name] %} {% endfor %} {% endif %} -{% if not mon_containerized_deployment and not mon_containerized_deployment_with_kv %} +{% if not containerized_deployment and not containerized_deployment_with_kv %} {% if monitor_address_block %} mon host = {% for host in groups[mon_group_name] %}{{ hostvars[host]['ansible_all_ipv4_addresses'] | ipaddr(monitor_address_block) | first }}{% if not loop.last %},{% endif %}{% endfor %} {% elif groups[mon_group_name] is defined %} @@ -50,12 +50,12 @@ mon host = {% for host in groups[mon_group_name] %} {% endfor %} {% endif %} {% endif %} -{% if mon_containerized_deployment %} +{% if containerized_deployment %} fsid = {{ fsid }} {% if groups[mon_group_name] is defined %} mon host = {% for host in groups[mon_group_name] %} {% set interface = ["ansible_",ceph_mon_docker_interface]|join %} - {% if mon_containerized_deployment -%} + {% if containerized_deployment -%} {{ hostvars[host][interface]['ipv4']['address'] }} {%- elif hostvars[host]['monitor_address'] is defined -%} {{ hostvars[host]['monitor_address'] }} diff --git a/roles/ceph-docker-common/defaults/main.yml b/roles/ceph-docker-common/defaults/main.yml index 86a7f9bb8..0b88fa8a3 100644 --- a/roles/ceph-docker-common/defaults/main.yml +++ b/roles/ceph-docker-common/defaults/main.yml @@ -1,4 +1,6 @@ --- +fsid: "{{ cluster_uuid.stdout }}" +generate_fsid: true ceph_docker_registry: docker.io ceph_docker_enable_centos_extra_repo: false @@ -9,3 +11,11 @@ mon_use_fqdn: false # if set to true, the MON name used will be the fqdn # These values have to be set according to the base OS used by the container image, NOT the host. bootstrap_dirs_owner: "64045" bootstrap_dirs_group: "64045" +# +############ +# KV store # +############ +kv_type: etcd +kv_endpoint: 127.0.0.1 +kv_port: 4001 +containerized_deployment_with_kv: false diff --git a/roles/ceph-docker-common/tasks/checks.yml b/roles/ceph-docker-common/tasks/checks.yml new file mode 100644 index 000000000..968fc038c --- /dev/null +++ b/roles/ceph-docker-common/tasks/checks.yml @@ -0,0 +1,28 @@ +--- +- name: set config and keys paths + set_fact: + ceph_config_keys: + - /etc/ceph/{{ cluster }}.client.admin.keyring + - /etc/ceph/{{ cluster }}.conf + - /etc/ceph/monmap-{{ cluster }} + - /etc/ceph/{{ cluster }}.mon.keyring + - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring + - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring + - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring + +- name: stat for ceph config and keys + stat: + path: "{{ item }}" + with_items: "{{ ceph_config_keys }}" + changed_when: false + failed_when: false + always_run: true + register: statleftover + +- name: fail if we find existing cluster files + fail: + msg: "looks like no cluster is running but ceph files are present, please remove them" + with_together: + - "{{ ceph_config_keys }}" + - "{{ statleftover.results }}" + when: item.1.stat.exists == true diff --git a/roles/ceph-docker-common/tasks/checks/check_ntp_atomic.yml b/roles/ceph-docker-common/tasks/checks/check_ntp_atomic.yml new file mode 100644 index 000000000..32050835e --- /dev/null +++ b/roles/ceph-docker-common/tasks/checks/check_ntp_atomic.yml @@ -0,0 +1,7 @@ +--- +- name: check ntp installation on atomic + command: rpm -q chrony + register: ntp_pkg_query + ignore_errors: true + always_run: true + changed_when: false diff --git a/roles/ceph-docker-common/tasks/checks/check_ntp_debian.yml b/roles/ceph-docker-common/tasks/checks/check_ntp_debian.yml new file mode 100644 index 000000000..7da8f5bee --- /dev/null +++ b/roles/ceph-docker-common/tasks/checks/check_ntp_debian.yml @@ -0,0 +1,13 @@ +--- +- name: check ntp installation on debian + command: dpkg -s ntp + register: ntp_pkg_query + ignore_errors: true + always_run: true + changed_when: false + when: ansible_os_family == 'Debian' + +- name: install ntp on debian + package: + name: ntp + state: present diff --git a/roles/ceph-docker-common/tasks/checks/check_ntp_redhat.yml b/roles/ceph-docker-common/tasks/checks/check_ntp_redhat.yml new file mode 100644 index 000000000..0e4772f54 --- /dev/null +++ b/roles/ceph-docker-common/tasks/checks/check_ntp_redhat.yml @@ -0,0 +1,13 @@ +--- +- name: check ntp installation on redhat + command: rpm -q ntp + register: ntp_pkg_query + ignore_errors: true + always_run: true + changed_when: false + when: ansible_os_family == 'RedHat' + +- name: install ntp on redhat + package: + name: ntp + state: present diff --git a/roles/ceph-docker-common/tasks/create_configs.yml b/roles/ceph-docker-common/tasks/create_configs.yml new file mode 100644 index 000000000..2ea58c721 --- /dev/null +++ b/roles/ceph-docker-common/tasks/create_configs.yml @@ -0,0 +1,39 @@ +--- +- name: create a local fetch directory if it does not exist + local_action: file path={{ fetch_directory }} state=directory + changed_when: false + become: false + run_once: true + when: cephx or generate_fsid + +- name: generate cluster uuid + local_action: shell python -c 'import uuid; print(str(uuid.uuid4()))' | tee {{ fetch_directory }}/ceph_cluster_uuid.conf + creates="{{ fetch_directory }}/ceph_cluster_uuid.conf" + register: cluster_uuid + become: false + when: generate_fsid + +- name: read cluster uuid if it already exists + local_action: command cat {{ fetch_directory }}/ceph_cluster_uuid.conf + removes="{{ fetch_directory }}/ceph_cluster_uuid.conf" + changed_when: false + register: cluster_uuid + always_run: true + become: false + when: generate_fsid + +- name: "generate {{ cluster }}.conf configuration file" + action: config_template + args: + src: "{{ playbook_dir }}/roles/ceph-common/templates/ceph.conf.j2" + dest: "/etc/ceph/{{ cluster }}.conf" + owner: "root" + group: "root" + mode: "0644" + config_overrides: "{{ ceph_conf_overrides }}" + config_type: ini + +- name: set fsid fact when generate_fsid = true + set_fact: + fsid: "{{ cluster_uuid.stdout }}" + when: generate_fsid diff --git a/roles/ceph-docker-common/tasks/dirs_permissions.yml b/roles/ceph-docker-common/tasks/dirs_permissions.yml new file mode 100644 index 000000000..65997fd08 --- /dev/null +++ b/roles/ceph-docker-common/tasks/dirs_permissions.yml @@ -0,0 +1,13 @@ +--- +- name: create bootstrap directories + file: + path: "{{ item }}" + state: directory + owner: "{{ bootstrap_dirs_owner }}" + group: "{{ bootstrap_dirs_group }}" + mode: "0755" + with_items: + - /etc/ceph/ + - /var/lib/ceph/bootstrap-osd + - /var/lib/ceph/bootstrap-mds + - /var/lib/ceph/bootstrap-rgw diff --git a/roles/ceph-docker-common/tasks/fetch_configs.yml b/roles/ceph-docker-common/tasks/fetch_configs.yml new file mode 100644 index 000000000..a96f34c88 --- /dev/null +++ b/roles/ceph-docker-common/tasks/fetch_configs.yml @@ -0,0 +1,50 @@ +--- +- name: set config and keys paths + set_fact: + ceph_config_keys: + - /etc/ceph/{{ cluster }}.conf + - /etc/ceph/{{ cluster }}.client.admin.keyring + - /etc/ceph/monmap-{{ cluster }} + - /etc/ceph/{{ cluster }}.mon.keyring + - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring + - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring + - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring + +- name: add mgr keys to config and keys paths + set_fact: + tmp_ceph_mgr_keys: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring + with_items: "{{ groups.get(mgr_group_name, []) }}" + register: tmp_ceph_mgr_keys_result + when: "{{ groups.get(mgr_group_name, []) | length > 0 }}" + +- name: convert mgr keys to an array + set_fact: + ceph_mgr_keys: "{{ tmp_ceph_mgr_keys_result.results | map(attribute='ansible_facts.tmp_ceph_mgr_keys') | list }}" + when: "{{ groups.get(mgr_group_name, []) | length > 0 }}" + +- name: merge mgr keys to config and keys paths + set_fact: + ceph_config_keys: "{{ ceph_config_keys + ceph_mgr_keys }}" + when: "{{ groups.get(mgr_group_name, []) | length > 0 }}" + +- name: stat for ceph config and keys + local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} + with_items: "{{ ceph_config_keys }}" + changed_when: false + become: false + failed_when: false + register: statconfig + always_run: true + +- name: try to fetch ceph config and keys + copy: + src: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}" + dest: "{{ item.0 }}" + owner: root + group: root + mode: 0644 + changed_when: false + with_together: + - "{{ ceph_config_keys }}" + - "{{ statconfig.results }}" + when: item.1.stat.exists == true diff --git a/roles/ceph-docker-common/tasks/fetch_image.yml b/roles/ceph-docker-common/tasks/fetch_image.yml new file mode 100644 index 000000000..57c76ed85 --- /dev/null +++ b/roles/ceph-docker-common/tasks/fetch_image.yml @@ -0,0 +1,26 @@ +--- +# Normal case - pull image from registry +- name: "pull {{ ceph_docker_image }} image" + command: "docker pull {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" + changed_when: false + when: ceph_docker_dev_image is undefined or not ceph_docker_dev_image + +# Dev case - export local dev image and send it across +- name: export local ceph dev image + local_action: command docker save -o "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" "{{ ceph_docker_username }}/{{ ceph_docker_imagename }}:{{ ceph_docker_image_tag }}" + when: ceph_docker_dev_image is defined and ceph_docker_dev_image + run_once: true + +- name: copy ceph dev image file + copy: + src: "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" + dest: "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" + when: ceph_docker_dev_image is defined and ceph_docker_dev_image + +- name: load ceph dev image + command: "docker load -i /tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" + when: ceph_docker_dev_image is defined and ceph_docker_dev_image + +- name: remove tmp ceph dev image file + command: "rm /tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" + when: ceph_docker_dev_image is defined and ceph_docker_dev_image diff --git a/roles/ceph-docker-common/tasks/main.yml b/roles/ceph-docker-common/tasks/main.yml index 357573a8b..d27223fb9 100644 --- a/roles/ceph-docker-common/tasks/main.yml +++ b/roles/ceph-docker-common/tasks/main.yml @@ -21,3 +21,77 @@ - set_fact: monitor_name: "{{ ansible_fqdn }}" when: mon_use_fqdn + +- name: check if a cluster is already running + command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'" + register: ceph_health + changed_when: false + failed_when: false + always_run: true + +# Only include 'checks.yml' when : +# we are deploying containers without kv AND host is either a mon OR a nfs OR an osd, +# AND +# a cluster is not already running, +# AND +# we are not playing rolling-update.yml playbook. +- include: checks.yml + when: + - (not containerized_deployment_with_kv and + ((inventory_hostname in groups.get(mon_group_name, [])) or + (inventory_hostname in groups.get(nfs_group_name, [])) or + (inventory_hostname in groups.get(osd_group_name, [])))) + - ceph_health.rc != 0 + - not "{{ rolling_update | default(false) }}" + +- include: "./misc/ntp_atomic.yml" + when: + - is_atomic + - ansible_os_family == 'RedHat' + - ntp_service_enabled + +- include: "./misc/ntp_redhat.yml" + when: + - not is_atomic + - ansible_os_family == 'RedHat' + - ntp_service_enabled + +- include: "./misc/ntp_debian.yml" + when: + - ansible_os_family == 'Debian' + - ntp_service_enabled + +- include: "./fetch_image.yml" + +# NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml +# # because it creates the directories needed by the latter. +- include: ./dirs_permissions.yml + +# let the first mon create configs and keyrings +# Only include 'create_configs.yml" when: +# we are not populating kv_store with default ceph.conf AND host is a mon +# OR +# we are not population kv_store with default ceph.conf AND there at least 1 nfs in nfs group AND host is the first nfs +- include: create_configs.yml + when: + - (not mon_containerized_default_ceph_conf_with_kv and + (inventory_hostname in groups.get(mon_group_name, []))) or + (not mon_containerized_default_ceph_conf_with_kv and + ((groups.get(nfs_group_name, []) | length > 0) + and (inventory_hostname == groups.get(nfs_group_name, [])[0]))) + +# Only include 'fetch_configs.yml' when: +# - we are deploying containers without kv AND host is either a mon OR a nfs OR an osd +# OR +# - host is either a mdss OR mgrs OR rgws +- include: fetch_configs.yml + when: + - (not containerized_deployment_with_kv and + ((inventory_hostname in groups.get(mon_group_name, [])) or + (inventory_hostname in groups.get(nfs_group_name, [])) or + (inventory_hostname in groups.get(osd_group_name, [])))) or + (inventory_hostname in groups.get('mdss', [])) or + (inventory_hostname in groups.get('mgrs', [])) or + (inventory_hostname in groups.get('rgws', [])) + +- include: selinux.yml diff --git a/roles/ceph-docker-common/tasks/misc/ntp_atomic.yml b/roles/ceph-docker-common/tasks/misc/ntp_atomic.yml new file mode 100644 index 000000000..11dfc988e --- /dev/null +++ b/roles/ceph-docker-common/tasks/misc/ntp_atomic.yml @@ -0,0 +1,11 @@ +--- +- include: ../checks/check_ntp_atomic.yml + when: is_atomic + +- name: start the ntp service + service: + name: chronyd + enabled: yes + state: started + when: + - ntp_pkg_query.rc == 0 diff --git a/roles/ceph-docker-common/tasks/misc/ntp_debian.yml b/roles/ceph-docker-common/tasks/misc/ntp_debian.yml new file mode 100644 index 000000000..62db3469c --- /dev/null +++ b/roles/ceph-docker-common/tasks/misc/ntp_debian.yml @@ -0,0 +1,11 @@ +--- +- include: ../checks/check_ntp_debian.yml + when: ansible_os_family == 'Debian' + +- name: start the ntp service + service: + name: ntp + enabled: yes + state: started + when: + - ntp_pkg_query.rc == 0 diff --git a/roles/ceph-docker-common/tasks/misc/ntp_redhat.yml b/roles/ceph-docker-common/tasks/misc/ntp_redhat.yml new file mode 100644 index 000000000..b64b9d8cd --- /dev/null +++ b/roles/ceph-docker-common/tasks/misc/ntp_redhat.yml @@ -0,0 +1,11 @@ +--- +- include: ../checks/check_ntp_redhat.yml + when: ansible_os_family == 'RedHat' + +- name: start the ntp service + service: + name: ntpd + enabled: yes + state: started + when: + - ntp_pkg_query.rc == 0 diff --git a/roles/ceph-docker-common/tasks/selinux.yml b/roles/ceph-docker-common/tasks/selinux.yml new file mode 100644 index 000000000..6d4ee022f --- /dev/null +++ b/roles/ceph-docker-common/tasks/selinux.yml @@ -0,0 +1,14 @@ +--- +- name: check if selinux is enabled + command: getenforce + register: sestatus + changed_when: false + always_run: true + +- name: set selinux permissions + shell: chcon -Rt svirt_sandbox_file_t {{ item }} + with_items: + - /etc/ceph + - /var/lib/ceph + changed_when: false + when: sestatus.stdout != 'Disabled' diff --git a/roles/ceph-mds/defaults/main.yml b/roles/ceph-mds/defaults/main.yml index 71574897e..ec6dd154b 100644 --- a/roles/ceph-mds/defaults/main.yml +++ b/roles/ceph-mds/defaults/main.yml @@ -13,19 +13,9 @@ fetch_directory: fetch/ # will copy the admin key to the /etc/ceph/ directory copy_admin_key: false -cephx: true - - ########## # DOCKER # ########## -mds_containerized_deployment: false -mds_containerized_deployment_with_kv: false -kv_type: etcd -kv_endpoint: 127.0.0.1 -ceph_docker_image: "ceph/daemon" -ceph_docker_image_tag: latest ceph_mds_docker_extra_env: -e CLUSTER={{ cluster }} -e MDS_NAME={{ ansible_hostname }} -ceph_docker_on_openstack: false ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-mds/meta/main.yml b/roles/ceph-mds/meta/main.yml index dc86bd0f3..9b7943261 100644 --- a/roles/ceph-mds/meta/main.yml +++ b/roles/ceph-mds/meta/main.yml @@ -11,5 +11,5 @@ galaxy_info: categories: - system dependencies: - - { role: ceph.ceph-common, when: not mds_containerized_deployment } - - { role: ceph.ceph-docker-common, when: mds_containerized_deployment } + - { role: ceph.ceph-common, when: not containerized_deployment } + - { role: ceph.ceph-docker-common, when: containerized_deployment } diff --git a/roles/ceph-mds/tasks/docker/checks.yml b/roles/ceph-mds/tasks/docker/checks.yml deleted file mode 100644 index 968fc038c..000000000 --- a/roles/ceph-mds/tasks/docker/checks.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: set config and keys paths - set_fact: - ceph_config_keys: - - /etc/ceph/{{ cluster }}.client.admin.keyring - - /etc/ceph/{{ cluster }}.conf - - /etc/ceph/monmap-{{ cluster }} - - /etc/ceph/{{ cluster }}.mon.keyring - - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - -- name: stat for ceph config and keys - stat: - path: "{{ item }}" - with_items: "{{ ceph_config_keys }}" - changed_when: false - failed_when: false - always_run: true - register: statleftover - -- name: fail if we find existing cluster files - fail: - msg: "looks like no cluster is running but ceph files are present, please remove them" - with_together: - - "{{ ceph_config_keys }}" - - "{{ statleftover.results }}" - when: item.1.stat.exists == true diff --git a/roles/ceph-mds/tasks/docker/main.yml b/roles/ceph-mds/tasks/docker/main.yml index 75a954e21..b3cab97ad 100644 --- a/roles/ceph-mds/tasks/docker/main.yml +++ b/roles/ceph-mds/tasks/docker/main.yml @@ -1,38 +1,2 @@ --- -- name: check if a cluster is already running - command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'" - register: ceph_health - changed_when: false - failed_when: false - always_run: true - -- include: checks.yml - when: - - ceph_health.rc != 0 - - not "{{ rolling_update | default(false) }}" - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_atomic.yml" - when: - - is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_redhat.yml" - when: - - not is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_debian.yml" - when: - - ansible_os_family == 'Debian' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml" -- include: dirs_permissions.yml -- include: fetch_configs.yml - -- include: selinux.yml - when: ansible_os_family == 'RedHat' - - include: start_docker_mds.yml diff --git a/roles/ceph-mds/tasks/main.yml b/roles/ceph-mds/tasks/main.yml index f932e584a..1c0b8c615 100644 --- a/roles/ceph-mds/tasks/main.yml +++ b/roles/ceph-mds/tasks/main.yml @@ -1,6 +1,6 @@ --- - include: pre_requisite.yml - when: not mds_containerized_deployment + when: not containerized_deployment - include: ./docker/main.yml - when: mds_containerized_deployment + when: containerized_deployment diff --git a/roles/ceph-mds/templates/ceph-mds.service.j2 b/roles/ceph-mds/templates/ceph-mds.service.j2 index 3ea1a32cb..6c901a718 100644 --- a/roles/ceph-mds/templates/ceph-mds.service.j2 +++ b/roles/ceph-mds/templates/ceph-mds.service.j2 @@ -7,7 +7,7 @@ EnvironmentFile=-/etc/environment 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 -%} + {% if not containerized_deployment_with_kv -%} -v /var/lib/ceph:/var/lib/ceph \ -v /etc/ceph:/etc/ceph \ {% else -%} diff --git a/roles/ceph-mgr/defaults/main.yml b/roles/ceph-mgr/defaults/main.yml index 11227b781..73a031797 100644 --- a/roles/ceph-mgr/defaults/main.yml +++ b/roles/ceph-mgr/defaults/main.yml @@ -3,12 +3,5 @@ # DOCKER # ########## -mgr_containerized_deployment: false -mgr_containerized_deployment_with_kv: false -kv_type: etcd -kv_endpoint: 127.0.0.1 -ceph_docker_image: "ceph/daemon" -ceph_docker_image_tag: latest ceph_mgr_docker_extra_env: -e CLUSTER={{ cluster }} -e MGR_NAME={{ ansible_hostname }} -ceph_docker_on_openstack: false ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-mgr/meta/main.yml b/roles/ceph-mgr/meta/main.yml index 878df1d1d..6829b9ebc 100644 --- a/roles/ceph-mgr/meta/main.yml +++ b/roles/ceph-mgr/meta/main.yml @@ -14,5 +14,5 @@ galaxy_info: categories: - system dependencies: - - { role: ceph.ceph-common, when: not mgr_containerized_deployment } - - { role: ceph.ceph-docker-common, when: mgr_containerized_deployment } + - { role: ceph.ceph-common, when: not containerized_deployment } + - { role: ceph.ceph-docker-common, when: containerized_deployment } diff --git a/roles/ceph-mgr/tasks/docker/checks.yml b/roles/ceph-mgr/tasks/docker/checks.yml deleted file mode 100644 index 968fc038c..000000000 --- a/roles/ceph-mgr/tasks/docker/checks.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: set config and keys paths - set_fact: - ceph_config_keys: - - /etc/ceph/{{ cluster }}.client.admin.keyring - - /etc/ceph/{{ cluster }}.conf - - /etc/ceph/monmap-{{ cluster }} - - /etc/ceph/{{ cluster }}.mon.keyring - - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - -- name: stat for ceph config and keys - stat: - path: "{{ item }}" - with_items: "{{ ceph_config_keys }}" - changed_when: false - failed_when: false - always_run: true - register: statleftover - -- name: fail if we find existing cluster files - fail: - msg: "looks like no cluster is running but ceph files are present, please remove them" - with_together: - - "{{ ceph_config_keys }}" - - "{{ statleftover.results }}" - when: item.1.stat.exists == true diff --git a/roles/ceph-mgr/tasks/docker/main.yml b/roles/ceph-mgr/tasks/docker/main.yml index 1a876d5d8..1f72d3635 100644 --- a/roles/ceph-mgr/tasks/docker/main.yml +++ b/roles/ceph-mgr/tasks/docker/main.yml @@ -1,36 +1,2 @@ --- -- name: check if a cluster is already running - command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'" - register: ceph_health - changed_when: false - failed_when: false - always_run: true - -- include: checks.yml - when: ceph_health.rc != 0 - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_atomic.yml" - when: - - is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_redhat.yml" - when: - - not is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_debian.yml" - when: - - ansible_os_family == 'Debian' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml" -- include: dirs_permissions.yml -- include: fetch_configs.yml - -- include: selinux.yml - when: ansible_os_family == 'RedHat' - - include: start_docker_mgr.yml diff --git a/roles/ceph-mgr/tasks/main.yml b/roles/ceph-mgr/tasks/main.yml index 6c31d30cd..1c0b8c615 100644 --- a/roles/ceph-mgr/tasks/main.yml +++ b/roles/ceph-mgr/tasks/main.yml @@ -1,6 +1,6 @@ --- - include: pre_requisite.yml - when: not mgr_containerized_deployment + when: not containerized_deployment - include: ./docker/main.yml - when: mgr_containerized_deployment + when: containerized_deployment diff --git a/roles/ceph-mgr/templates/ceph-mgr.service.j2 b/roles/ceph-mgr/templates/ceph-mgr.service.j2 index cdb4e0de0..02cbd96eb 100644 --- a/roles/ceph-mgr/templates/ceph-mgr.service.j2 +++ b/roles/ceph-mgr/templates/ceph-mgr.service.j2 @@ -7,7 +7,7 @@ EnvironmentFile=-/etc/environment ExecStartPre=-/usr/bin/docker stop ceph-mgr-{{ ansible_hostname }} ExecStartPre=-/usr/bin/docker rm ceph-mgr-{{ ansible_hostname }} ExecStart=/usr/bin/docker run --rm --net=host \ - {% if not mgr_containerized_deployment_with_kv -%} + {% if not containerized_deployment_with_kv -%} -v /var/lib/ceph:/var/lib/ceph \ -v /etc/ceph:/etc/ceph \ {% else -%} diff --git a/roles/ceph-mon/defaults/main.yml b/roles/ceph-mon/defaults/main.yml index 51bbe12c1..36a0374a2 100644 --- a/roles/ceph-mon/defaults/main.yml +++ b/roles/ceph-mon/defaults/main.yml @@ -12,7 +12,6 @@ mon_group_name: mons # ACTIVATE BOTH FSID AND MONITOR_SECRET VARIABLES FOR NON-VAGRANT DEPLOYMENT fsid: "{{ cluster_uuid.stdout }}" monitor_secret: "{{ monitor_keyring.stdout }}" -cephx: true # CephFS cephfs_data: cephfs_data @@ -70,16 +69,9 @@ openstack_keys: # DOCKER # ########## docker_exec_cmd: -mon_containerized_deployment: false -mon_containerized_deployment_with_kv: false -# This is currently in ceph-common defaults because it is shared with ceph-nfs -#mon_containerized_default_ceph_conf_with_kv: false ceph_mon_docker_interface: "{{ monitor_interface }}" ceph_mon_docker_subnet: "{{ public_network }}"# subnet of the ceph_mon_docker_interface -ceph_docker_image: "ceph/daemon" -ceph_docker_image_tag: latest ceph_mon_docker_extra_env: -e CLUSTER={{ cluster }} -e FSID={{ fsid }} -e MON_NAME={{ monitor_name }} -ceph_docker_on_openstack: false mon_docker_privileged: false mon_docker_net_host: true ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-mon/meta/main.yml b/roles/ceph-mon/meta/main.yml index 9dd5c89f5..0d99a1b3b 100644 --- a/roles/ceph-mon/meta/main.yml +++ b/roles/ceph-mon/meta/main.yml @@ -11,5 +11,5 @@ galaxy_info: categories: - system dependencies: - - { role: ceph.ceph-common, when: not mon_containerized_deployment } - - { role: ceph.ceph-docker-common, when: mon_containerized_deployment } + - { role: ceph.ceph-common, when: not containerized_deployment } + - { role: ceph.ceph-docker-common, when: containerized_deployment } diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index 5abe03000..d3abe917f 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -113,7 +113,7 @@ - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring when: - cephx - - inventory_hostname == groups[mon_group_name]|last + - "{{ inventory_hostname == groups[mon_group_name] | last }}" - name: drop in a motd script to report status when logging in copy: diff --git a/roles/ceph-mon/tasks/docker/checks.yml b/roles/ceph-mon/tasks/docker/checks.yml deleted file mode 100644 index 75613c091..000000000 --- a/roles/ceph-mon/tasks/docker/checks.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: set config and keys paths - set_fact: - ceph_config_keys: - - /etc/ceph/{{ cluster }}.client.admin.keyring - - /etc/ceph/{{ cluster }}.conf - - /etc/ceph/monmap-{{ cluster }} - - /etc/ceph/{{ cluster }}.mon.keyring - - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - -- name: stat for ceph config and keys - stat: - path: "{{ item }}" - with_items: "{{ ceph_config_keys }}" - changed_when: false - failed_when: false - register: statleftover - always_run: true - -- name: fail if we find existing cluster files - fail: - msg: "looks like no cluster is running but ceph files are present, please remove them" - with_together: - - "{{ ceph_config_keys }}" - - "{{ statleftover.results }}" - when: item.1.stat.exists == true diff --git a/roles/ceph-mon/tasks/docker/create_configs.yml b/roles/ceph-mon/tasks/docker/create_configs.yml deleted file mode 100644 index 788a2be99..000000000 --- a/roles/ceph-mon/tasks/docker/create_configs.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- name: create a local fetch directory if it does not exist - local_action: file path={{ fetch_directory }} state=directory - changed_when: false - become: false - run_once: true - when: cephx or generate_fsid - -- name: generate cluster uuid - local_action: shell python -c 'import uuid; print(str(uuid.uuid4()))' | tee {{ fetch_directory }}/ceph_cluster_uuid.conf - creates="{{ fetch_directory }}/ceph_cluster_uuid.conf" - register: cluster_uuid - become: false - when: generate_fsid - -- name: read cluster uuid if it already exists - local_action: command cat {{ fetch_directory }}/ceph_cluster_uuid.conf - removes="{{ fetch_directory }}/ceph_cluster_uuid.conf" - changed_when: false - register: cluster_uuid - always_run: true - become: false - when: generate_fsid - -- name: "generate {{ cluster }}.conf configuration file" - action: config_template - args: - src: "{{ playbook_dir }}/roles/ceph-common/templates/ceph.conf.j2" - dest: "/etc/ceph/{{ cluster }}.conf" - owner: "root" - group: "root" - mode: "0644" - config_overrides: "{{ ceph_conf_overrides }}" - config_type: ini diff --git a/roles/ceph-mon/tasks/docker/main.yml b/roles/ceph-mon/tasks/docker/main.yml index daaf152c4..fe49404c3 100644 --- a/roles/ceph-mon/tasks/docker/main.yml +++ b/roles/ceph-mon/tasks/docker/main.yml @@ -1,49 +1,4 @@ --- -- name: check if a cluster is already running - command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'" - register: ceph_health - changed_when: false - failed_when: false - always_run: true - -- include: checks.yml - when: - - ceph_health.rc != 0 - - not mon_containerized_deployment_with_kv - - not "{{ rolling_update | default(false) }}" - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_atomic.yml" - when: - - is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_redhat.yml" - when: - - not is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_debian.yml" - when: - - ansible_os_family == 'Debian' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml" - -- include: dirs_permissions.yml - -# let the first mon create configs and keyrings -- include: create_configs.yml - when: - - not mon_containerized_default_ceph_conf_with_kv - -- include: fetch_configs.yml - when: not mon_containerized_deployment_with_kv - -- include: selinux.yml - when: ansible_os_family == 'RedHat' - - name: set docker_exec_cmd fact set_fact: docker_exec_cmd: "docker exec ceph-mon-{{ ansible_hostname }}" @@ -64,10 +19,10 @@ failed_when: false when: - "{{ inventory_hostname == groups[mon_group_name][0] }}" - - not mon_containerized_deployment_with_kv + - not containerized_deployment_with_kv - include: copy_configs.yml - when: not mon_containerized_deployment_with_kv + when: not containerized_deployment_with_kv - name: create ceph rest api keyring when mon is containerized 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 @@ -76,10 +31,10 @@ changed_when: false when: - cephx - - mon_containerized_deployment + - containerized_deployment - groups[restapi_group_name] is defined - "{{ inventory_hostname == groups[mon_group_name] | last }}" - - not mon_containerized_deployment_with_kv + - not containerized_deployment_with_kv - include: "{{ playbook_dir }}/roles/ceph-mon/tasks/set_osd_pool_default_pg_num.yml" @@ -97,9 +52,9 @@ changed_when: false when: - cephx - - mon_containerized_deployment + - containerized_deployment - "{{ groups.get(mgr_group_name, []) | length > 0 }}" - - not mon_containerized_deployment_with_kv + - not containerized_deployment_with_kv with_items: "{{ groups.get(mgr_group_name, []) }}" - name: stat for ceph mgr key(s) diff --git a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml index fcd8af4b4..5a7d770ce 100644 --- a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml +++ b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml @@ -12,7 +12,7 @@ run_once: true when: - "{{ inventory_hostname == groups[mon_group_name][0] }}" - - mon_containerized_deployment_with_kv + - containerized_deployment_with_kv - mon_containerized_default_ceph_conf_with_kv - name: populate kv_store with custom ceph.conf @@ -30,7 +30,7 @@ run_once: true when: - "{{ inventory_hostname == groups[mon_group_name][0] }}" - - mon_containerized_deployment_with_kv + - containerized_deployment_with_kv - not mon_containerized_default_ceph_conf_with_kv - name: delete populate-kv-store docker @@ -38,7 +38,7 @@ name: populate-kv-store state: absent image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" - when: mon_containerized_deployment_with_kv + when: containerized_deployment_with_kv - name: generate systemd unit file become: true diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index 0c6f75ec0..15bae8deb 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -1,18 +1,18 @@ --- - include: deploy_monitors.yml - when: not mon_containerized_deployment + when: not containerized_deployment - include: start_monitor.yml - when: not mon_containerized_deployment + when: not containerized_deployment - include: ceph_keys.yml - when: not mon_containerized_deployment + when: not containerized_deployment # this avoids the bug mentioned here: https://github.com/ansible/ansible/issues/18206 static: no - include: create_mds_filesystems.yml when: - - not mon_containerized_deployment + - not containerized_deployment - groups[mds_group_name] is defined - "{{ groups[mds_group_name]|length > 0 }}" - "{{ inventory_hostname == groups[mon_group_name] | last }}" @@ -20,10 +20,10 @@ - include: secure_cluster.yml when: - secure_cluster - - not mon_containerized_deployment + - not containerized_deployment - include: ./docker/main.yml - when: mon_containerized_deployment + when: containerized_deployment - include: calamari.yml when: calamari diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index 014046f3e..2a8bb4911 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -7,7 +7,7 @@ EnvironmentFile=-/etc/environment 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 ceph-mon-%i --net=host \ - {% if not mon_containerized_deployment_with_kv -%} + {% if not containerized_deployment_with_kv -%} -v /var/lib/ceph:/var/lib/ceph \ -v /etc/ceph:/etc/ceph \ {% else -%} diff --git a/roles/ceph-nfs/defaults/main.yml b/roles/ceph-nfs/defaults/main.yml index 509d38bc1..f31463d5d 100644 --- a/roles/ceph-nfs/defaults/main.yml +++ b/roles/ceph-nfs/defaults/main.yml @@ -7,11 +7,6 @@ fetch_directory: fetch/ -## Ceph options -# -cephx: true - - ####################### # Access type options # ####################### @@ -73,12 +68,7 @@ ganesha_conf_overrides: {} # DOCKER # ########## -nfs_containerized_deployment: false -nfs_containerized_deployment_with_kv: false -kv_type: etcd -kv_endpoint: 127.0.0.1 ceph_docker_image: "ceph/ganesha" ceph_docker_image_tag: latest #ceph_nfs_docker_extra_env: -e GANESHA_EPOCH={{ ganesha_epoch }} -ceph_docker_on_openstack: false ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-nfs/meta/main.yml b/roles/ceph-nfs/meta/main.yml index 4efb5d920..9b3052388 100644 --- a/roles/ceph-nfs/meta/main.yml +++ b/roles/ceph-nfs/meta/main.yml @@ -11,5 +11,5 @@ galaxy_info: categories: - system dependencies: - - { role: ceph.ceph-common, when: not nfs_containerized_deployment } - - { role: ceph.ceph-docker-common, when: nfs_containerized_deployment } + - { role: ceph.ceph-common, when: not containerized_deployment } + - { role: ceph.ceph-docker-common, when: containerized_deployment } diff --git a/roles/ceph-nfs/tasks/docker/checks.yml b/roles/ceph-nfs/tasks/docker/checks.yml deleted file mode 100644 index e6d00d031..000000000 --- a/roles/ceph-nfs/tasks/docker/checks.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: set config and keys paths - set_fact: - ceph_config_keys: - - /etc/ceph/{{ cluster }}.client.admin.keyring - - /etc/ceph/{{ cluster }}.conf - - /etc/ceph/monmap-{{ cluster }} - - /etc/ceph/{{ cluster }}.mon.keyring - - /etc/ganesha/ganesha.conf - -- name: stat for ceph config and keys - stat: - path: "{{ item }}" - with_items: "{{ ceph_config_keys }}" - changed_when: false - failed_when: false - always_run: true - register: statleftover - -- name: fail if we find existing cluster files - fail: - msg: "looks like no cluster is running but ceph files are present, please remove them" - with_together: - - "{{ ceph_config_keys }}" - - "{{ statleftover.results }}" - when: item.1.stat.exists == true diff --git a/roles/ceph-nfs/tasks/docker/create_configs.yml b/roles/ceph-nfs/tasks/docker/create_configs.yml deleted file mode 100644 index c30dd7c91..000000000 --- a/roles/ceph-nfs/tasks/docker/create_configs.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- name: create ganesha conf directory - file: - path: /etc/ganesha - state: directory - owner: root - group: root - mode: 0644 - -- name: create the nfs rgw user - docker: - image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" - name: ceph-rgw-user-{{ ansible_hostname }} - hostname: "{{ ansible_hostname }}" - expose: "{{ ceph_rgw_civetweb_port }}" - ports: "{{ ceph_rgw_civetweb_port }}:{{ ceph_rgw_civetweb_port }}" - state: running - env: "CEPH_DAEMON=RGW_USER,RGW_USERNAME={{ ceph_nfs_rgw_user }},RGW_USER_ACCESS_KEY={{ ceph_nfs_rgw_access_key }},RGW_USER_SECRET_KEY={{ ceph_nfs_rgw_secret_key }}" - volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph" - when: nfs_obj_gw - -- name: get user create output - command: docker logs ceph-rgw-user-{{ ansible_hostname }} - always_run: true - register: rgwuser - -- name: generate ganesha configuration file - action: config_template - args: - src: "{{ playbook_dir }}/roles/ceph-common/templates/ganesha.conf.j2" - dest: /etc/ganesha/ganesha.conf - owner: "root" - group: "root" - mode: "0644" - config_overrides: "{{ ganesha_conf_overrides }}" - config_type: ini diff --git a/roles/ceph-nfs/tasks/docker/main.yml b/roles/ceph-nfs/tasks/docker/main.yml index 314614b36..9a731c46b 100644 --- a/roles/ceph-nfs/tasks/docker/main.yml +++ b/roles/ceph-nfs/tasks/docker/main.yml @@ -1,53 +1,7 @@ --- -- name: check if a cluster is already running - command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'" - register: ceph_health - changed_when: false - failed_when: false - always_run: true - -- include: checks.yml - when: - ceph_health.rc != 0 and - not mon_containerized_deployment_with_kv - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_atomic.yml" - when: - - is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_redhat.yml" - when: - - not is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_debian.yml" - when: - - ansible_os_family == 'Debian' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml" - -- include: dirs_permissions.yml - # Copy Ceph configs to host - include: copy_configs.yml -- include: selinux.yml - when: ansible_os_family == 'RedHat' - -# let the first ganesha create configs and users -- include: create_configs.yml - when: - inventory_hostname == groups[nfs_group_name][0] and - not mon_containerized_default_ceph_conf_with_kv - -# Copy Ganesha configs to host -- include: fetch_configs.yml - when: not mon_containerized_deployment_with_kv - - include: selinux.yml when: ansible_os_family == 'RedHat' diff --git a/roles/ceph-nfs/tasks/main.yml b/roles/ceph-nfs/tasks/main.yml index 7c2539de3..1c0b8c615 100644 --- a/roles/ceph-nfs/tasks/main.yml +++ b/roles/ceph-nfs/tasks/main.yml @@ -1,6 +1,6 @@ --- - include: pre_requisite.yml - when: not nfs_containerized_deployment + when: not containerized_deployment - include: ./docker/main.yml - when: nfs_containerized_deployment + when: containerized_deployment diff --git a/roles/ceph-nfs/templates/ceph-nfs.service.j2 b/roles/ceph-nfs/templates/ceph-nfs.service.j2 index 3b228b479..1b0834ab1 100644 --- a/roles/ceph-nfs/templates/ceph-nfs.service.j2 +++ b/roles/ceph-nfs/templates/ceph-nfs.service.j2 @@ -8,7 +8,7 @@ EnvironmentFile=-/etc/environment 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 -%} + {% if not containerized_deployment_with_kv -%} -v /etc/ceph:/etc/ceph \ -v /etc/ganesha:/etc/ganesha \ {% else -%} diff --git a/roles/ceph-osd/defaults/main.yml b/roles/ceph-osd/defaults/main.yml index 9d2df9a56..2f95ed08e 100644 --- a/roles/ceph-osd/defaults/main.yml +++ b/roles/ceph-osd/defaults/main.yml @@ -52,7 +52,6 @@ osd_crush_location: "\"root={{ ceph_crush_root }} rack={{ ceph_crush_rack }} hos # ACTIVATE THE FSID VARIABLE FOR NON-VAGRANT DEPLOYMENT fsid: "{{ cluster_uuid.stdout }}" -cephx: true # Devices to be used as OSDs # You can pre-provision disks that are not present yet. @@ -150,15 +149,7 @@ dmcrypt_dedicated_journal: false # DOCKER # ########## -osd_containerized_deployment: false -osd_containerized_deployment_with_kv: false -kv_type: etcd -kv_endpoint: 127.0.0.1 -kv_port: 4001 -ceph_docker_image: "ceph/daemon" -ceph_docker_image_tag: latest ceph_config_keys: [] # DON'T TOUCH ME -ceph_docker_on_openstack: false # PREPARE DEVICE # Make sure you only pass a single device to raw_journal_devices, otherwise this will fail horribly. diff --git a/roles/ceph-osd/meta/main.yml b/roles/ceph-osd/meta/main.yml index e1d85c157..ef9c436af 100644 --- a/roles/ceph-osd/meta/main.yml +++ b/roles/ceph-osd/meta/main.yml @@ -11,5 +11,5 @@ galaxy_info: categories: - system dependencies: - - { role: ceph.ceph-common, when: not osd_containerized_deployment } - - { role: ceph.ceph-docker-common, when: osd_containerized_deployment } + - { role: ceph.ceph-common, when: not containerized_deployment } + - { role: ceph.ceph-docker-common, when: containerized_deployment } diff --git a/roles/ceph-osd/tasks/check_mandatory_vars.yml b/roles/ceph-osd/tasks/check_mandatory_vars.yml index 5492c0f88..da8b23b01 100644 --- a/roles/ceph-osd/tasks/check_mandatory_vars.yml +++ b/roles/ceph-osd/tasks/check_mandatory_vars.yml @@ -9,7 +9,7 @@ msg: "cluster_network must be configured. Ceph replication network" when: - cluster_network == '0.0.0.0/0' - - not osd_containerized_deployment + - not containerized_deployment - name: make sure journal_size configured debug: @@ -25,7 +25,7 @@ when: - osd_group_name is defined - osd_group_name in group_names - - not osd_containerized_deployment + - not containerized_deployment - not journal_collocation - not raw_multi_journal - not bluestore @@ -38,7 +38,7 @@ when: - osd_group_name is defined - osd_group_name in group_names - - not osd_containerized_deployment + - not containerized_deployment - (journal_collocation and raw_multi_journal) or (journal_collocation and bluestore) or (raw_multi_journal and bluestore) @@ -56,7 +56,7 @@ when: - osd_group_name is defined - osd_group_name in group_names - - (journal_collocation or osd_containerized_deployment) + - (journal_collocation or containerized_deployment) - not osd_auto_discovery - devices|length == 0 @@ -66,7 +66,7 @@ when: - osd_group_name is defined - osd_group_name in group_names - - not osd_containerized_deployment + - not containerized_deployment - raw_multi_journal - raw_journal_devices|length == 0 or devices|length == 0 diff --git a/roles/ceph-osd/tasks/docker/checks.yml b/roles/ceph-osd/tasks/docker/checks.yml deleted file mode 100644 index 968fc038c..000000000 --- a/roles/ceph-osd/tasks/docker/checks.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: set config and keys paths - set_fact: - ceph_config_keys: - - /etc/ceph/{{ cluster }}.client.admin.keyring - - /etc/ceph/{{ cluster }}.conf - - /etc/ceph/monmap-{{ cluster }} - - /etc/ceph/{{ cluster }}.mon.keyring - - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - -- name: stat for ceph config and keys - stat: - path: "{{ item }}" - with_items: "{{ ceph_config_keys }}" - changed_when: false - failed_when: false - always_run: true - register: statleftover - -- name: fail if we find existing cluster files - fail: - msg: "looks like no cluster is running but ceph files are present, please remove them" - with_together: - - "{{ ceph_config_keys }}" - - "{{ statleftover.results }}" - when: item.1.stat.exists == true diff --git a/roles/ceph-osd/tasks/docker/main.yml b/roles/ceph-osd/tasks/docker/main.yml index 23ecd54e3..d9bff3ee2 100644 --- a/roles/ceph-osd/tasks/docker/main.yml +++ b/roles/ceph-osd/tasks/docker/main.yml @@ -1,44 +1,5 @@ --- -- name: check if a cluster is already running - command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'" - register: ceph_health - changed_when: false - failed_when: false - always_run: true - -- include: checks.yml - when: - - ceph_health.rc != 0 - - not osd_containerized_deployment_with_kv - - not "{{ rolling_update | default(false) }}" - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_atomic.yml" - when: - - is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_redhat.yml" - when: - - not is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_debian.yml" - when: - - ansible_os_family == 'Debian' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml" - -# NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml -# because it creates the directories needed by the latter. -- include: dirs_permissions.yml - - include: fetch_configs.yml - when: not osd_containerized_deployment_with_kv - -- include: selinux.yml - when: ansible_os_family == 'RedHat' + when: not containerized_deployment_with_kv - include: start_docker_osd.yml diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index 3423a9452..15f47eae4 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -40,7 +40,7 @@ when: - item.1.get("rc", 0) != 0 - ceph_osd_docker_prepare_env is defined - - not osd_containerized_deployment_with_kv + - not containerized_deployment_with_kv - name: prepare ceph osd disk with kv_store shell: | @@ -65,7 +65,7 @@ when: - item.1.get("rc", 0) != 0 - ceph_osd_docker_prepare_env is defined - - osd_containerized_deployment_with_kv + - containerized_deployment_with_kv - name: generate ceph osd docker run script become: true diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 963716a6c..de2e53ef3 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -2,46 +2,46 @@ - include: check_mandatory_vars.yml - include: pre_requisite.yml - when: not osd_containerized_deployment + when: not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False - include: ./scenarios/journal_collocation.yml when: - journal_collocation - - not osd_containerized_deployment + - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False - include: ./scenarios/raw_multi_journal.yml when: - raw_multi_journal - - not osd_containerized_deployment + - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False - include: ./scenarios/bluestore.yml when: - osd_objectstore == 'bluestore' - - not osd_containerized_deployment + - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False - include: ./scenarios/dmcrypt-journal-collocation.yml when: - dmcrypt_journal_collocation - - not osd_containerized_deployment + - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False - include: ./scenarios/dmcrypt-dedicated-journal.yml when: - dmcrypt_dedicated_journal - - not osd_containerized_deployment + - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False - include: ./docker/main.yml - when: osd_containerized_deployment + when: containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False diff --git a/roles/ceph-osd/templates/ceph-osd-run.sh.j2 b/roles/ceph-osd/templates/ceph-osd-run.sh.j2 index bf5ee9b38..9fa5d3551 100644 --- a/roles/ceph-osd/templates/ceph-osd-run.sh.j2 +++ b/roles/ceph-osd/templates/ceph-osd-run.sh.j2 @@ -28,7 +28,7 @@ fi --security-opt apparmor:unconfined \ {% endif -%} --pid=host \ - {% if not osd_containerized_deployment_with_kv -%} + {% if not containerized_deployment_with_kv -%} -v /var/lib/ceph:/var/lib/ceph \ -v /etc/ceph:/etc/ceph \ {% else -%} diff --git a/roles/ceph-rbd-mirror/defaults/main.yml b/roles/ceph-rbd-mirror/defaults/main.yml index 4395c6e03..a362a5e8f 100644 --- a/roles/ceph-rbd-mirror/defaults/main.yml +++ b/roles/ceph-rbd-mirror/defaults/main.yml @@ -34,11 +34,4 @@ ceph_rbd_mirror_pool: "" # DOCKER # ########## -rbd_mirror_containerized_deployment: false -rbd_mirror_containerized_deployment_with_kv: false -kv_type: etcd -kv_endpoint: 127.0.0.1 -ceph_docker_image: "ceph/daemon" -ceph_docker_image_tag: latest -ceph_docker_on_openstack: false ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-rbd-mirror/meta/main.yml b/roles/ceph-rbd-mirror/meta/main.yml index a70fe4418..a73a1447c 100644 --- a/roles/ceph-rbd-mirror/meta/main.yml +++ b/roles/ceph-rbd-mirror/meta/main.yml @@ -14,5 +14,5 @@ galaxy_info: categories: - system dependencies: - - { role: ceph.ceph-common, when: not rbd_mirror_containerized_deployment } - - { role: ceph.ceph-docker-common, when: rbd_mirror_containerized_deployment } + - { role: ceph.ceph-common, when: not containerized_deployment } + - { role: ceph.ceph-docker-common, when: containerized_deployment } diff --git a/roles/ceph-rbd-mirror/tasks/docker/checks.yml b/roles/ceph-rbd-mirror/tasks/docker/checks.yml deleted file mode 100644 index 968fc038c..000000000 --- a/roles/ceph-rbd-mirror/tasks/docker/checks.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: set config and keys paths - set_fact: - ceph_config_keys: - - /etc/ceph/{{ cluster }}.client.admin.keyring - - /etc/ceph/{{ cluster }}.conf - - /etc/ceph/monmap-{{ cluster }} - - /etc/ceph/{{ cluster }}.mon.keyring - - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - -- name: stat for ceph config and keys - stat: - path: "{{ item }}" - with_items: "{{ ceph_config_keys }}" - changed_when: false - failed_when: false - always_run: true - register: statleftover - -- name: fail if we find existing cluster files - fail: - msg: "looks like no cluster is running but ceph files are present, please remove them" - with_together: - - "{{ ceph_config_keys }}" - - "{{ statleftover.results }}" - when: item.1.stat.exists == true diff --git a/roles/ceph-rbd-mirror/tasks/docker/main.yml b/roles/ceph-rbd-mirror/tasks/docker/main.yml index dbbc87eea..84ebe12e0 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/main.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/main.yml @@ -1,36 +1,4 @@ --- -- name: check if a cluster is already running - command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'" - register: ceph_health - changed_when: false - failed_when: false - always_run: true - -- include: checks.yml - when: ceph_health.rc != 0 - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_atomic.yml" - when: - - is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_redhat.yml" - when: - - not is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_debian.yml" - when: - - ansible_os_family == 'Debian' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml" -- include: dirs_permissions.yml - include: fetch_configs.yml -- include: selinux.yml - when: ansible_os_family == 'RedHat' - - include: start_docker_rbd_mirror.yml diff --git a/roles/ceph-rbd-mirror/tasks/main.yml b/roles/ceph-rbd-mirror/tasks/main.yml index abb3c5304..cdad90bfb 100644 --- a/roles/ceph-rbd-mirror/tasks/main.yml +++ b/roles/ceph-rbd-mirror/tasks/main.yml @@ -1,14 +1,14 @@ --- - include: pre_requisite.yml - when: not rbd_mirror_containerized_deployment + when: not containerized_deployment - include: start_rbd_mirror.yml - when: not rbd_mirror_containerized_deployment + when: not containerized_deployment - include: configure_mirroring.yml when: - ceph_rbd_mirror_configure - - not rbd_mirror_containerized_deployment + - not containerized_deployment - include: ./docker/main.yml - when: rbd_mirror_containerized_deployment + when: containerized_deployment 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 fe5ee0bb3..4b6537ba1 100644 --- a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 +++ b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 @@ -7,7 +7,7 @@ EnvironmentFile=-/etc/environment ExecStartPre=-/usr/bin/docker stop ceph-rbd-mirror-{{ ansible_hostname }} ExecStartPre=-/usr/bin/docker rm ceph-rbd-mirror-{{ ansible_hostname }} ExecStart=/usr/bin/docker run --rm --net=host \ - {% if not rbd_mirror_containerized_deployment_with_kv -%} + {% if not containerized_deployment_with_kv -%} -v /etc/ceph:/etc/ceph \ {% else -%} -e KV_TYPE={{kv_type}} \ diff --git a/roles/ceph-restapi/defaults/main.yml b/roles/ceph-restapi/defaults/main.yml index 8df594070..4152ee730 100644 --- a/roles/ceph-restapi/defaults/main.yml +++ b/roles/ceph-restapi/defaults/main.yml @@ -10,11 +10,7 @@ fetch_directory: fetch/ # DOCKER # ########## -restapi_containerized_deployment: false ceph_restapi_docker_interface: eth0 ceph_restapi_port: 5000 -ceph_docker_image: "ceph/daemon" -ceph_docker_image_tag: latest ceph_restapi_docker_extra_env: "RESTAPI_IP=0.0.0.0" # comma separated variables -ceph_docker_on_openstack: false ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-restapi/meta/main.yml b/roles/ceph-restapi/meta/main.yml index f2a9c2855..809d979c2 100644 --- a/roles/ceph-restapi/meta/main.yml +++ b/roles/ceph-restapi/meta/main.yml @@ -11,5 +11,5 @@ galaxy_info: categories: - system dependencies: - - { role: ceph.ceph-common, when: not restapi_containerized_deployment } - - { role: ceph.ceph-docker-common, when: restapi_containerized_deployment } + - { role: ceph.ceph-common, when: not containerized_deployment } + - { role: ceph.ceph-docker-common, when: containerized_deployment } diff --git a/roles/ceph-restapi/tasks/docker/main.yml b/roles/ceph-restapi/tasks/docker/main.yml index c0143f9cc..900cd8d2a 100644 --- a/roles/ceph-restapi/tasks/docker/main.yml +++ b/roles/ceph-restapi/tasks/docker/main.yml @@ -1,22 +1,3 @@ --- -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_atomic.yml" - when: - - is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_redhat.yml" - when: - - not is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_debian.yml" - when: - - ansible_os_family == 'Debian' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml" -- include: dirs_permissions.yml - include: fetch_configs.yml - include: start_docker_restapi.yml diff --git a/roles/ceph-restapi/tasks/main.yml b/roles/ceph-restapi/tasks/main.yml index 571d4c98d..e62323e7b 100644 --- a/roles/ceph-restapi/tasks/main.yml +++ b/roles/ceph-restapi/tasks/main.yml @@ -1,9 +1,9 @@ --- - include: pre_requisite.yml - when: not restapi_containerized_deployment + when: not containerized_deployment - include: start_restapi.yml - when: not restapi_containerized_deployment + when: not containerized_deployment - include: ./docker/main.yml - when: restapi_containerized_deployment + when: containerized_deployment diff --git a/roles/ceph-rgw/defaults/main.yml b/roles/ceph-rgw/defaults/main.yml index 2eb337b75..7a6ee4fb0 100644 --- a/roles/ceph-rgw/defaults/main.yml +++ b/roles/ceph-rgw/defaults/main.yml @@ -13,10 +13,6 @@ fetch_directory: fetch/ # will copy the admin key to the /etc/ceph/ directory copy_admin_key: false -## Ceph options -# -cephx: true - # Multi-site remote pull URL variables rgw_pull_port: "{{ radosgw_civetweb_port }}" rgw_pull_proto: "http" @@ -51,14 +47,7 @@ rgw_pull_proto: "http" # DOCKER # ########## -rgw_containerized_deployment: false -rgw_containerized_deployment_with_kv: false -kv_type: etcd -kv_endpoint: 127.0.0.1 ceph_rgw_civetweb_port: "{{ radosgw_civetweb_port }}" -ceph_docker_image: "ceph/daemon" -ceph_docker_image_tag: latest ceph_rgw_docker_extra_env: -e CLUSTER={{ cluster }} -e RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }} -ceph_docker_on_openstack: false ceph_config_keys: [] # DON'T TOUCH ME rgw_config_keys: "/" # DON'T TOUCH ME diff --git a/roles/ceph-rgw/meta/main.yml b/roles/ceph-rgw/meta/main.yml index 051f5e0ec..cffb6d934 100644 --- a/roles/ceph-rgw/meta/main.yml +++ b/roles/ceph-rgw/meta/main.yml @@ -11,5 +11,5 @@ galaxy_info: categories: - system dependencies: - - { role: ceph.ceph-common, when: not rgw_containerized_deployment } - - { role: ceph.ceph-docker-common, when: rgw_containerized_deployment } + - { role: ceph.ceph-common, when: not containerized_deployment } + - { role: ceph.ceph-docker-common, when: containerized_deployment } diff --git a/roles/ceph-rgw/tasks/docker/checks.yml b/roles/ceph-rgw/tasks/docker/checks.yml deleted file mode 100644 index 968fc038c..000000000 --- a/roles/ceph-rgw/tasks/docker/checks.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: set config and keys paths - set_fact: - ceph_config_keys: - - /etc/ceph/{{ cluster }}.client.admin.keyring - - /etc/ceph/{{ cluster }}.conf - - /etc/ceph/monmap-{{ cluster }} - - /etc/ceph/{{ cluster }}.mon.keyring - - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - -- name: stat for ceph config and keys - stat: - path: "{{ item }}" - with_items: "{{ ceph_config_keys }}" - changed_when: false - failed_when: false - always_run: true - register: statleftover - -- name: fail if we find existing cluster files - fail: - msg: "looks like no cluster is running but ceph files are present, please remove them" - with_together: - - "{{ ceph_config_keys }}" - - "{{ statleftover.results }}" - when: item.1.stat.exists == true diff --git a/roles/ceph-rgw/tasks/docker/main.yml b/roles/ceph-rgw/tasks/docker/main.yml index 5779e805e..8a599aef9 100644 --- a/roles/ceph-rgw/tasks/docker/main.yml +++ b/roles/ceph-rgw/tasks/docker/main.yml @@ -1,42 +1,6 @@ --- -- name: check if a cluster is already running - command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'" - register: ceph_health - changed_when: false - failed_when: false - always_run: true - -- include: checks.yml - when: - - ceph_health.rc != 0 - - not "{{ rolling_update | default(false) }}" - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_atomic.yml" - when: - - is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_redhat.yml" - when: - - not is_atomic - - ansible_os_family == 'RedHat' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/misc/ntp_debian.yml" - when: - - ansible_os_family == 'Debian' - - ntp_service_enabled - -- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml" -- include: dirs_permissions.yml -# NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml -# because it creates the directories needed by the latter. - include: fetch_configs.yml -- include: selinux.yml - when: ansible_os_family == 'RedHat' - - include: start_docker_rgw.yml - include: copy_configs.yml diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index 4e0dc5e45..52fb1dd3c 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -1,6 +1,6 @@ --- - include: pre_requisite.yml - when: not rgw_containerized_deployment + when: not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False @@ -12,7 +12,7 @@ static: False - include: start_radosgw.yml - when: not rgw_containerized_deployment + when: not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False @@ -30,6 +30,6 @@ static: False - include: ./docker/main.yml - when: rgw_containerized_deployment + when: containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False diff --git a/roles/ceph-rgw/templates/ceph-rgw.service.j2 b/roles/ceph-rgw/templates/ceph-rgw.service.j2 index b63c60878..944e99457 100644 --- a/roles/ceph-rgw/templates/ceph-rgw.service.j2 +++ b/roles/ceph-rgw/templates/ceph-rgw.service.j2 @@ -7,7 +7,7 @@ EnvironmentFile=-/etc/environment 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 -%} + {% if not containerized_deployment_with_kv -%} -v /var/lib/ceph:/var/lib/ceph \ -v /etc/ceph:/etc/ceph \ {% else -%} diff --git a/tests/functional/centos/7/docker-cluster-dedicated-journal/Vagrantfile b/tests/functional/centos/7/docker-cluster-dedicated-journal/Vagrantfile index d232095b3..3fa4b55bf 100644 --- a/tests/functional/centos/7/docker-cluster-dedicated-journal/Vagrantfile +++ b/tests/functional/centos/7/docker-cluster-dedicated-journal/Vagrantfile @@ -72,13 +72,7 @@ ansible_provision = proc do |ansible| # In a production deployment, these should be secret if DOCKER then ansible.extra_vars = ansible.extra_vars.merge({ - mon_containerized_deployment: 'true', - osd_containerized_deployment: 'true', - mds_containerized_deployment: 'true', - rgw_containerized_deployment: 'true', - nfs_containerized_deployment: 'true', - restapi_containerized_deployment: 'true', - rbd_mirror_containerized_deployment: 'true', + containerized_deployment: 'true', ceph_mon_docker_interface: ETH, ceph_mon_docker_subnet: "#{PUBLIC_SUBNET}.0/24", ceph_osd_docker_devices: settings['disks'], diff --git a/tests/functional/centos/7/docker-cluster-dedicated-journal/group_vars/all b/tests/functional/centos/7/docker-cluster-dedicated-journal/group_vars/all index 9608fb6ee..e5950afc3 100644 --- a/tests/functional/centos/7/docker-cluster-dedicated-journal/group_vars/all +++ b/tests/functional/centos/7/docker-cluster-dedicated-journal/group_vars/all @@ -4,10 +4,7 @@ docker: True ceph_stable: True -mon_containerized_deployment: True -osd_containerized_deployment: True -mds_containerized_deployment: True -rgw_containerized_deployment: True +containerized_deployment: True cluster: test ceph_mon_docker_interface: eth1 ceph_mon_docker_subnet: "{{ public_network }}" diff --git a/tests/functional/centos/7/docker-cluster-dmcrypt-journal-collocation/Vagrantfile b/tests/functional/centos/7/docker-cluster-dmcrypt-journal-collocation/Vagrantfile index d232095b3..761a7b119 100644 --- a/tests/functional/centos/7/docker-cluster-dmcrypt-journal-collocation/Vagrantfile +++ b/tests/functional/centos/7/docker-cluster-dmcrypt-journal-collocation/Vagrantfile @@ -72,13 +72,13 @@ ansible_provision = proc do |ansible| # In a production deployment, these should be secret if DOCKER then ansible.extra_vars = ansible.extra_vars.merge({ - mon_containerized_deployment: 'true', - osd_containerized_deployment: 'true', - mds_containerized_deployment: 'true', - rgw_containerized_deployment: 'true', - nfs_containerized_deployment: 'true', - restapi_containerized_deployment: 'true', - rbd_mirror_containerized_deployment: 'true', + containerized_deployment: 'true', + containerized_deployment: 'true', + containerized_deployment: 'true', + containerized_deployment: 'true', + containerized_deployment: 'true', + containerized_deployment: 'true', + containerized_deployment: 'true', ceph_mon_docker_interface: ETH, ceph_mon_docker_subnet: "#{PUBLIC_SUBNET}.0/24", ceph_osd_docker_devices: settings['disks'], diff --git a/tests/functional/centos/7/docker-cluster-dmcrypt-journal-collocation/group_vars/all b/tests/functional/centos/7/docker-cluster-dmcrypt-journal-collocation/group_vars/all index a9178552f..926e92d11 100644 --- a/tests/functional/centos/7/docker-cluster-dmcrypt-journal-collocation/group_vars/all +++ b/tests/functional/centos/7/docker-cluster-dmcrypt-journal-collocation/group_vars/all @@ -4,10 +4,7 @@ docker: True ceph_stable: True -mon_containerized_deployment: True -osd_containerized_deployment: True -mds_containerized_deployment: True -rgw_containerized_deployment: True +containerized_deployment: True cluster: ceph ceph_mon_docker_interface: eth1 ceph_mon_docker_subnet: "{{ public_network }}" diff --git a/tests/functional/centos/7/docker-cluster/group_vars/all b/tests/functional/centos/7/docker-cluster/group_vars/all index 11ce8af0f..1192f2cd2 100644 --- a/tests/functional/centos/7/docker-cluster/group_vars/all +++ b/tests/functional/centos/7/docker-cluster/group_vars/all @@ -4,11 +4,7 @@ docker: True ceph_stable: True -mon_containerized_deployment: True -osd_containerized_deployment: True -mds_containerized_deployment: True -rgw_containerized_deployment: True -mgr_containerized_deployment: True +containerized_deployment: True cluster: test ceph_mon_docker_interface: eth1 ceph_mon_docker_subnet: "{{ public_network }}"