diff --git a/README.md b/README.md index 8a9c4af1a..a2d8be69b 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,7 @@ ceph_conf_overrides: osd mkfs type: ext4 ``` -### Note -* It is not recommended to use underscores when defining options in the `ceph_conf_overrides` variable (ex. osd_mkfs_type) as this may cause issues with -incorrect configuration options appearing in ceph.conf. -* We will no longer accept pull requests that modify the ceph.conf template unless it helps the deployment. For simple configuration tweaks +**Note:** we will no longer accept pull requests that modify the ceph.conf template unless it helps the deployment. For simple configuration tweaks please use the `ceph_conf_overrides` variable. ## Special notes diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index e6fccbb3b..9eb23f1cf 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -330,7 +330,6 @@ dummy: #handler_health_mon_check_delay: 10 #handler_health_osd_check_retries: 40 #handler_health_osd_check_delay: 30 -#handler_health_osd_check: true ################### # CONFIG OVERRIDE # diff --git a/roles/ceph-common/defaults/main.yml b/roles/ceph-common/defaults/main.yml index f20fd3a6c..50bd4b3dd 100644 --- a/roles/ceph-common/defaults/main.yml +++ b/roles/ceph-common/defaults/main.yml @@ -322,7 +322,6 @@ handler_health_mon_check_retries: 5 handler_health_mon_check_delay: 10 handler_health_osd_check_retries: 40 handler_health_osd_check_delay: 30 -handler_health_osd_check: true ################### # CONFIG OVERRIDE # diff --git a/roles/ceph-common/handlers/validate-osd.yml b/roles/ceph-common/handlers/validate-osd.yml index 99d1c2f87..b83d0952d 100644 --- a/roles/ceph-common/handlers/validate-osd.yml +++ b/roles/ceph-common/handlers/validate-osd.yml @@ -17,4 +17,3 @@ retries: "{{ handler_health_osd_check_retries }}" delay: "{{ handler_health_osd_check_delay }}" delegate_to: "{{ groups[mon_group_name][0] }}" - when: handler_health_osd_check diff --git a/roles/ceph-docker-common/tasks/main.yml b/roles/ceph-docker-common/tasks/main.yml deleted file mode 100644 index 14e987cde..000000000 --- a/roles/ceph-docker-common/tasks/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include: system_checks.yml diff --git a/roles/ceph-docker-common/tasks/system_checks.yml b/roles/ceph-docker-common/tasks/system_checks.yml deleted file mode 100644 index a9a5311e6..000000000 --- a/roles/ceph-docker-common/tasks/system_checks.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: fail if systemd is not present - fail: - msg: "Systemd must be present" - when: ansible_service_mgr != 'systemd' diff --git a/roles/ceph-mds/tasks/docker/start_docker_mds.yml b/roles/ceph-mds/tasks/docker/start_docker_mds.yml index d49e56e67..cb76e9777 100644 --- a/roles/ceph-mds/tasks/docker/start_docker_mds.yml +++ b/roles/ceph-mds/tasks/docker/start_docker_mds.yml @@ -8,22 +8,26 @@ owner: "root" group: "root" mode: "0644" + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: link systemd unit file for mds instance file: src: /var/lib/ceph/ceph-mds@.service dest: /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service state: link + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for mds instance command: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service failed_when: false changed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files command: systemctl daemon-reload changed_when: false failed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start mds container service: diff --git a/roles/ceph-mon/tasks/docker/main.yml b/roles/ceph-mon/tasks/docker/main.yml index 15499e6e2..62d111750 100644 --- a/roles/ceph-mon/tasks/docker/main.yml +++ b/roles/ceph-mon/tasks/docker/main.yml @@ -62,29 +62,21 @@ - include: start_docker_monitor.yml -- name: wait for monitor socket to exist - command: docker exec {{ ansible_hostname }} stat /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok - register: monitor_socket - retries: 5 - delay: 10 - until: monitor_socket.rc == 0 - -- name: force peer addition as potential bootstrap peer for cluster bringup - command: docker exec {{ ansible_hostname }} ceph --admin-daemon /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok add_bootstrap_peer_hint {{ hostvars[item]['ansible_' + ceph_mon_docker_interface].ipv4.address }} - with_items: "{{ groups.mons }}" - changed_when: false - failed_when: false - when: - - inventory_hostname == groups.mons[0] - - not mon_containerized_deployment_with_kv +# NOTE: if we don't wait we will attempt to copy config to ansible host +# before admin key is ready, preventing future daemons e.g. ceph-mds from +# properly retrieving key +- name: "wait for {{ cluster }}.client.admin.keyring exists" + wait_for: + path: /etc/ceph/{{ cluster }}.client.admin.keyring + when: cephx - include: copy_configs.yml when: not mon_containerized_deployment_with_kv - name: create ceph rest api keyring when mon is containerized - command: docker exec {{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/{{ cluster }}.client.restapi.keyring + command: docker exec {{ ansible_hostname }} ceph auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/ceph.client.restapi.keyring args: - creates: /etc/ceph/{{ cluster }}.client.restapi.keyring + creates: /etc/ceph/ceph.client.restapi.keyring changed_when: false when: - cephx diff --git a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml index 50dc8f37d..a2071936c 100644 --- a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml +++ b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml @@ -40,6 +40,7 @@ image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}:{{ ceph_mon_docker_image_tag }}" when: mon_containerized_deployment_with_kv +# Use systemd to manage container on Atomic host and CoreOS - name: generate systemd unit file become: true template: @@ -48,16 +49,19 @@ owner: "root" group: "root" mode: "0644" + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for mon instance shell: systemctl enable ceph-mon@{{ ansible_hostname }}.service failed_when: false changed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload changed_when: false failed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start mon container service: diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index 1815015c5..a9f41a923 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -5,7 +5,7 @@ After=docker.service [Service] EnvironmentFile=-/etc/environment ExecStartPre=-/usr/bin/docker rm %i -ExecStartPre=$(command -v mkdir) -p /etc/ceph /var/lib/ceph/mon +ExecStartPre=/usr/bin/mkdir -p /etc/ceph /var/lib/ceph/mon ExecStart=/usr/bin/docker run --rm --name %i --net=host \ {% if not mon_containerized_deployment_with_kv -%} -v /var/lib/ceph:/var/lib/ceph \ diff --git a/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml b/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml index b4685a6b7..3b297d544 100644 --- a/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml +++ b/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml @@ -8,22 +8,34 @@ owner: "root" group: "root" mode: "0644" + when: + is_atomic or + ansible_os_family == 'CoreOS' - name: link systemd unit file for NFS instance file: src: /var/lib/nfs/ganesha/ceph-nfs@.service dest: /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service state: link + when: + is_atomic or + ansible_os_family == 'CoreOS' - name: enable systemd unit file for NFS instance shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service failed_when: false changed_when: false + when: + is_atomic or + ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload changed_when: false failed_when: false + when: + is_atomic or + ansible_os_family == 'CoreOS' - name: systemd start NFS container service: diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index 196725b31..5c830804f 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -67,6 +67,7 @@ - ceph_osd_docker_prepare_env is defined - osd_containerized_deployment_with_kv +# Use systemd to manage container on appropriate host - name: generate systemd unit file become: true template: @@ -76,17 +77,20 @@ group: "root" mode: "0644" failed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for osd instance shell: systemctl enable ceph-osd@{{ item | basename }}.service failed_when: false changed_when: false with_items: "{{ ceph_osd_docker_devices }}" + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload changed_when: false failed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start osd container service: diff --git a/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml b/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml index afaffafe2..b3d127ce3 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml @@ -8,16 +8,19 @@ owner: "root" group: "root" mode: "0644" + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for rbd mirror instance command: systemctl enable ceph-rbd-mirror@{{ ansible_hostname }}.service failed_when: false changed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files command: systemctl daemon-reload changed_when: false failed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start rbd mirror container service: diff --git a/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml b/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml index d86a062c9..072615eca 100644 --- a/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml +++ b/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml @@ -8,22 +8,26 @@ owner: "root" group: "root" mode: "0644" + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: link systemd unit file for rgw instance file: src: /var/lib/ceph/ceph-rgw@.service dest: /etc/systemd/system/multi-user.target.wants/ceph-rgw@{{ ansible_hostname }}.service state: link + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for rgw instance shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-rgw@{{ ansible_hostname }}.service failed_when: false changed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload changed_when: false failed_when: false + when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start rgw container service: diff --git a/roles/ceph-rgw/tasks/multisite/main.yml b/roles/ceph-rgw/tasks/multisite/main.yml index 2f7114a3d..0dc6d94da 100644 --- a/roles/ceph-rgw/tasks/multisite/main.yml +++ b/roles/ceph-rgw/tasks/multisite/main.yml @@ -17,10 +17,11 @@ # Continue with common tasks - name: add zone to rgw stanza in ceph.conf - ini_file: + lineinfile: dest: "/etc/ceph/{{ cluster }}.conf" - section: "client.rgw.{{ ansible_hostname }}" - option: "rgw_zone" - value: "{{ rgw_zone }}" + regexp: "{{ ansible_host }}" + insertafter: "^[client.rgw.{{ ansible_host }}]" + line: "rgw_zone = {{ rgw_zone }}" + state: present notify: - restart rgw