diff --git a/roles/ceph-common/tasks/checks/check_ntp_atomic.yml b/roles/ceph-common/tasks/checks/check_ntp_atomic.yml new file mode 100644 index 000000000..15a5b2d13 --- /dev/null +++ b/roles/ceph-common/tasks/checks/check_ntp_atomic.yml @@ -0,0 +1,6 @@ +--- +- name: check ntp installation on atomic + command: rpm -q chrony + register: ntp_pkg_query + ignore_errors: true + changed_when: false diff --git a/roles/ceph-common/tasks/misc/ntp_atomic.yml b/roles/ceph-common/tasks/misc/ntp_atomic.yml new file mode 100644 index 000000000..11dfc988e --- /dev/null +++ b/roles/ceph-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-mds/tasks/docker/main.yml b/roles/ceph-mds/tasks/docker/main.yml index 0c42388ea..fbae68b89 100644 --- a/roles/ceph-mds/tasks/docker/main.yml +++ b/roles/ceph-mds/tasks/docker/main.yml @@ -17,6 +17,24 @@ when: ceph_health.rc != 0 - include: pre_requisite.yml + +- 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" vars: ceph_docker_username: "{{ ceph_mds_docker_username }}" diff --git a/roles/ceph-mds/tasks/docker/pre_requisite.yml b/roles/ceph-mds/tasks/docker/pre_requisite.yml index a32d7caf0..972003be3 100644 --- a/roles/ceph-mds/tasks/docker/pre_requisite.yml +++ b/roles/ceph-mds/tasks/docker/pre_requisite.yml @@ -116,7 +116,7 @@ tags: with_pkg when: ansible_version['full'] | version_compare('2.1.0.0', '<') - + - name: install docker-py pip: name: docker-py @@ -125,3 +125,34 @@ with_pkg when: ansible_version['full'] | version_compare('2.1.0.0', '>=') +- name: install ntp on redhat using yum + yum: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'yum' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on redhat using dnf + dnf: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'dnf' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on debian + apt: + name: ntp + state: present + when: + - ansible_os_family == 'Debian' + - ntp_service_enabled + tags: + with_pkg diff --git a/roles/ceph-mds/tasks/docker/start_docker_mds.yml b/roles/ceph-mds/tasks/docker/start_docker_mds.yml index 9f3a7b68c..a62a7d536 100644 --- a/roles/ceph-mds/tasks/docker/start_docker_mds.yml +++ b/roles/ceph-mds/tasks/docker/start_docker_mds.yml @@ -44,5 +44,5 @@ net: host state: running env: "CEPH_DAEMON=MDS,CEPHFS_CREATE=1,{{ ceph_mds_docker_extra_env }}" - volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph" + volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro" when: ansible_os_family != 'RedHat' and ansible_os_family != 'CoreOS' diff --git a/roles/ceph-mds/templates/ceph-mds.service.j2 b/roles/ceph-mds/templates/ceph-mds.service.j2 index 283183d56..208c8d294 100644 --- a/roles/ceph-mds/templates/ceph-mds.service.j2 +++ b/roles/ceph-mds/templates/ceph-mds.service.j2 @@ -14,6 +14,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \ -e KV_TYPE={{kv_type}} \ -e KV_IP={{kv_endpoint}} \ {% endif -%} + -v /etc/localtime:/etc/localtime:ro \ --privileged \ -e CEPH_DAEMON=MDS \ -e CEPHFS_CREATE=1 \ diff --git a/roles/ceph-mon/tasks/docker/main.yml b/roles/ceph-mon/tasks/docker/main.yml index d2fc4f8ab..802449acf 100644 --- a/roles/ceph-mon/tasks/docker/main.yml +++ b/roles/ceph-mon/tasks/docker/main.yml @@ -20,6 +20,23 @@ - include: pre_requisite.yml +- 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" vars: ceph_docker_username: "{{ ceph_mon_docker_username }}" diff --git a/roles/ceph-mon/tasks/docker/pre_requisite.yml b/roles/ceph-mon/tasks/docker/pre_requisite.yml index dde220721..9c27ee8cc 100644 --- a/roles/ceph-mon/tasks/docker/pre_requisite.yml +++ b/roles/ceph-mon/tasks/docker/pre_requisite.yml @@ -126,3 +126,35 @@ tags: with_pkg when: ansible_version['full'] | version_compare('2.1.0.0', '>=') + +- name: install ntp on redhat using yum + yum: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'yum' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on redhat using dnf + dnf: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'dnf' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on debian + apt: + name: ntp + state: present + when: + - ansible_os_family == 'Debian' + - ntp_service_enabled + tags: + with_pkg diff --git a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml index 7072a2e25..f3754a850 100644 --- a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml +++ b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml @@ -85,7 +85,7 @@ state: "running" privileged: "{{ mon_docker_privileged }}" env: "MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }},CEPH_FSID={{ fsid }},{{ ceph_mon_extra_envs }}" - volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph" + volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro" when: - ansible_os_family != 'RedHat' - ansible_os_family != 'CoreOS' @@ -99,6 +99,7 @@ state: "running" privileged: "{{ mon_docker_privileged }}" env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }},{{ ceph_mon_extra_envs }}" + volumes: "/etc/localtime:/etc/localtime:ro" when: - ansible_os_family != 'RedHat' - ansible_os_family != 'CoreOS' diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index 93c5a66ad..b8facb244 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -15,6 +15,7 @@ ExecStart=/usr/bin/docker run --rm --name %i --net=host \ -e KV_IP={{kv_endpoint}}\ -e KV_PORT={{kv_port}} \ {% endif -%} + -v /etc/localtime:/etc/localtime:ro \ {% if mon_docker_privileged -%} --privileged \ {% endif -%} diff --git a/roles/ceph-nfs/tasks/docker/main.yml b/roles/ceph-nfs/tasks/docker/main.yml index ae9a3cb21..1e4d030f9 100644 --- a/roles/ceph-nfs/tasks/docker/main.yml +++ b/roles/ceph-nfs/tasks/docker/main.yml @@ -20,6 +20,23 @@ - include: pre_requisite.yml +- 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" vars: ceph_docker_username: "{{ ceph_nfs_docker_username }}" diff --git a/roles/ceph-nfs/tasks/docker/pre_requisite.yml b/roles/ceph-nfs/tasks/docker/pre_requisite.yml index c937afc72..69b538518 100644 --- a/roles/ceph-nfs/tasks/docker/pre_requisite.yml +++ b/roles/ceph-nfs/tasks/docker/pre_requisite.yml @@ -97,3 +97,35 @@ enabled: yes tags: with_pkg + +- name: install ntp on redhat using yum + yum: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'yum' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on redhat using dnf + dnf: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'dnf' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on debian + apt: + name: ntp + state: present + when: + - ansible_os_family == 'Debian' + - ntp_service_enabled + tags: + with_pkg diff --git a/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml b/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml index 77a5a9604..7e0196c93 100644 --- a/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml +++ b/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml @@ -61,7 +61,7 @@ privileged: true ports: "{{ ceph_nfs_port }}:{{ ceph_nfs_port }},111:111" env: "CEPH_DAEMON=NFS,CEPH_PUBLIC_NETWORK={{ ceph_nfs_docker_subnet }},{{ ceph_nfs_extra_envs }}" - volumes: "/etc/ceph:/etc/ceph,/etc/ganesha:/etc/ganesha" + volumes: "/etc/ceph:/etc/ceph,/etc/ganesha:/etc/ganesha,/etc/localtime:/etc/localtime:ro" when: not is_atomic and ansible_os_family != 'CoreOS' and @@ -75,7 +75,7 @@ state: "running" privileged: true env: "CEPH_DAEMON=NFS,CEPH_PUBLIC_NETWORK={{ ceph_nfs_docker_subnet }},{{ ceph_nfs_extra_envs }}" - volumes: "/etc/ganesha:/etc/ganesha" + volumes: "/etc/ganesha:/etc/ganesha,/etc/localtime:/etc/localtime:ro" when: not is_atomic and ansible_os_family != 'CoreOS' and diff --git a/roles/ceph-nfs/templates/ceph-nfs.service.j2 b/roles/ceph-nfs/templates/ceph-nfs.service.j2 index d78d2d0d2..bd8b41b0a 100644 --- a/roles/ceph-nfs/templates/ceph-nfs.service.j2 +++ b/roles/ceph-nfs/templates/ceph-nfs.service.j2 @@ -15,6 +15,7 @@ ExecStart=/usr/bin/docker run --rm --name %i --net=host \ -e KV_TYPE={{kv_type}} \ -e KV_IP={{kv_endpoint}}\ {% endif -%} + -v /etc/localtime:/etc/localtime:ro \ --privileged \ -e CEPH_DAEMON=NFS \ -e CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }} \ diff --git a/roles/ceph-osd/tasks/docker/main.yml b/roles/ceph-osd/tasks/docker/main.yml index 41e68785e..16ccd8cb2 100644 --- a/roles/ceph-osd/tasks/docker/main.yml +++ b/roles/ceph-osd/tasks/docker/main.yml @@ -20,6 +20,23 @@ - include: pre_requisite.yml +- 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" vars: ceph_docker_username: '{{ ceph_osd_docker_username }}' diff --git a/roles/ceph-osd/tasks/docker/pre_requisite.yml b/roles/ceph-osd/tasks/docker/pre_requisite.yml index 728d562b1..ab7e21057 100644 --- a/roles/ceph-osd/tasks/docker/pre_requisite.yml +++ b/roles/ceph-osd/tasks/docker/pre_requisite.yml @@ -125,3 +125,35 @@ tags: with_pkg when: ansible_version['full'] | version_compare('2.1.0.0', '>=') + +- name: install ntp on redhat using yum + yum: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'yum' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on redhat using dnf + dnf: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'dnf' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on debian + apt: + name: ntp + state: present + when: + - ansible_os_family == 'Debian' + - ntp_service_enabled + tags: + with_pkg diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index 34cbacbc1..f466f02b8 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -28,6 +28,7 @@ -v /etc/ceph:/etc/ceph \ -v /var/lib/ceph/:/var/lib/ceph/ \ -v /dev:/dev \ + -v /etc/localtime:/etc/localtime:ro \ -e "OSD_DEVICE={{ item.0 }}" \ -e "{{ ceph_osd_docker_prepare_env }}" \ "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}:{{ ceph_osd_docker_image_tag }}" \ @@ -48,6 +49,7 @@ --name="{{ ansible_hostname }}-osd-prepare-{{ item.0 | regex_replace('/', '') }}" \ -v /dev:/dev \ + -v /etc/localtime:/etc/localtime:ro \ -e "OSD_DEVICE={{ item.0 }}" \ -e "{{ ceph_osd_docker_prepare_env }}" \ -e CEPH_DAEMON=osd_ceph_disk_prepare \ @@ -106,7 +108,7 @@ state: started privileged: yes env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}" - volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev:/dev,/run:/run" + volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro,/dev:/dev,/run:/run" with_items: ceph_osd_docker_devices when: - ansible_os_family != 'RedHat' @@ -122,7 +124,7 @@ state: running privileged: yes env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}" - volumes: "/dev/:/dev/" + volumes: "/etc/localtime:/etc/localtime:ro,/dev/:/dev/" with_items: ceph_osd_docker_devices when: - ansible_os_family != 'RedHat' diff --git a/roles/ceph-osd/templates/ceph-osd.service.j2 b/roles/ceph-osd/templates/ceph-osd.service.j2 index 12e6a9520..a6841b9ac 100644 --- a/roles/ceph-osd/templates/ceph-osd.service.j2 +++ b/roles/ceph-osd/templates/ceph-osd.service.j2 @@ -15,6 +15,7 @@ ExecStart=/usr/bin/docker run --rm --net=host --pid=host\ -e KV_IP={{kv_endpoint}} \ -e KV_PORT={{kv_port}} \ {% endif -%} + -v /etc/localtime:/etc/localtime:ro \ -v /dev:/dev \ --privileged \ -e CEPH_DAEMON=OSD_CEPH_DISK_ACTIVATE \ diff --git a/roles/ceph-rbd-mirror/tasks/docker/main.yml b/roles/ceph-rbd-mirror/tasks/docker/main.yml index 886beca75..7bfe9da2c 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/main.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/main.yml @@ -17,6 +17,24 @@ when: ceph_health.rc != 0 - include: pre_requisite.yml + +- 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" vars: ceph_docker_username: "{{ ceph_rbd_mirror_docker_username }}" diff --git a/roles/ceph-rbd-mirror/tasks/docker/pre_requisite.yml b/roles/ceph-rbd-mirror/tasks/docker/pre_requisite.yml index 4b060aed6..6cc5e0bba 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/pre_requisite.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/pre_requisite.yml @@ -124,3 +124,35 @@ tags: with_pkg when: ansible_version['full'] | version_compare('2.1.0.0', '>=') + +- name: install ntp on redhat using yum + yum: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'yum' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on redhat using dnf + dnf: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'dnf' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on debian + apt: + name: ntp + state: present + when: + - ansible_os_family == 'Debian' + - ntp_service_enabled + tags: + with_pkg 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 cb4ff3b4a..fcd34cc7a 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 @@ -43,5 +43,5 @@ name: ceph-{{ ansible_hostname }}-rbd-mirror net: host state: running - volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph" + volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro" when: ansible_os_family != 'RedHat' and ansible_os_family != 'CoreOS' 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 69aa5b605..618967e56 100644 --- a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 +++ b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 @@ -14,6 +14,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \ -e KV_TYPE={{kv_type}} \ -e KV_IP={{kv_endpoint}} \ {% endif -%} + -v /etc/localtime:/etc/localtime:ro \ --privileged \ -e CEPH_DAEMON=RBD_MIRROR \ --name={{ ansible_hostname }} \ diff --git a/roles/ceph-restapi/tasks/docker/main.yml b/roles/ceph-restapi/tasks/docker/main.yml index a0945cc1f..fc2274794 100644 --- a/roles/ceph-restapi/tasks/docker/main.yml +++ b/roles/ceph-restapi/tasks/docker/main.yml @@ -1,5 +1,31 @@ --- +- name: check if it is Atomic host + stat: path=/run/ostree-booted + register: stat_ostree + +- name: set fact for using Atomic host + set_fact: + is_atomic: '{{ stat_ostree.stat.exists }}' + - include: pre_requisite.yml + +- 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" vars: ceph_docker_username: "{{ ceph_restapi_docker_username }}" diff --git a/roles/ceph-restapi/tasks/docker/pre_requisite.yml b/roles/ceph-restapi/tasks/docker/pre_requisite.yml index c4e8922c9..d89fe36f6 100644 --- a/roles/ceph-restapi/tasks/docker/pre_requisite.yml +++ b/roles/ceph-restapi/tasks/docker/pre_requisite.yml @@ -122,3 +122,35 @@ enabled: yes tags: with_pkg + +- name: install ntp on redhat using yum + yum: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'yum' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on redhat using dnf + dnf: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'dnf' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on debian + apt: + name: ntp + state: present + when: + - ansible_os_family == 'Debian' + - ntp_service_enabled + tags: + with_pkg diff --git a/roles/ceph-restapi/tasks/docker/start_docker_restapi.yml b/roles/ceph-restapi/tasks/docker/start_docker_restapi.yml index 40e6b355b..045c07d1d 100644 --- a/roles/ceph-restapi/tasks/docker/start_docker_restapi.yml +++ b/roles/ceph-restapi/tasks/docker/start_docker_restapi.yml @@ -7,4 +7,4 @@ expose: "{{ ceph_restapi_port }}" state: running env: "RESTAPI_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_restapi_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=RESTAPI,{{ ceph_restapi_docker_extra_env }}" - volumes: "/etc/ceph:/etc/ceph" + volumes: "/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro" diff --git a/roles/ceph-rgw/tasks/docker/main.yml b/roles/ceph-rgw/tasks/docker/main.yml index 787a4fdcc..360d37b71 100644 --- a/roles/ceph-rgw/tasks/docker/main.yml +++ b/roles/ceph-rgw/tasks/docker/main.yml @@ -17,6 +17,24 @@ when: ceph_health.rc != 0 - include: pre_requisite.yml + +- 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" vars: ceph_docker_username: "{{ ceph_rgw_docker_username }}" diff --git a/roles/ceph-rgw/tasks/docker/pre_requisite.yml b/roles/ceph-rgw/tasks/docker/pre_requisite.yml index c322ed12c..92c3ae8ae 100644 --- a/roles/ceph-rgw/tasks/docker/pre_requisite.yml +++ b/roles/ceph-rgw/tasks/docker/pre_requisite.yml @@ -110,3 +110,35 @@ enabled: yes tags: with_pkg + +- name: install ntp on redhat using yum + yum: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'yum' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on redhat using dnf + dnf: + name: ntp + state: present + when: + - ansible_os_family == 'RedHat' + - ansible_pkg_mgr == 'dnf' + - ntp_service_enabled + tags: + with_pkg + +- name: install ntp on debian + apt: + name: ntp + state: present + when: + - ansible_os_family == 'Debian' + - ntp_service_enabled + tags: + with_pkg diff --git a/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml b/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml index 11e9f910e..cfdd107b1 100644 --- a/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml +++ b/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml @@ -45,5 +45,5 @@ ports: "{{ ceph_rgw_civetweb_port }}:{{ ceph_rgw_civetweb_port }}" state: running env: "CEPH_DAEMON=RGW,{{ ceph_rgw_docker_extra_env }}" - volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph" + volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro" when: ansible_os_family != 'RedHat' and ansible_os_family != 'CoreOS' diff --git a/roles/ceph-rgw/templates/ceph-rgw.service.j2 b/roles/ceph-rgw/templates/ceph-rgw.service.j2 index 5a173f95b..4dfcc754e 100644 --- a/roles/ceph-rgw/templates/ceph-rgw.service.j2 +++ b/roles/ceph-rgw/templates/ceph-rgw.service.j2 @@ -14,6 +14,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \ -e KV_TYPE={{kv_type}} \ -e KV_IP={{kv_endpoint}} \ {% endif -%} + -v /etc/localtime:/etc/localtime:ro \ --privileged \ -e CEPH_DAEMON=RGW \ --name={{ ansible_hostname }} \