]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Add option to enable ntp
authorIvan Font <ivan.font@redhat.com>
Thu, 28 Jul 2016 14:42:19 +0000 (07:42 -0700)
committerIvan Font <ivan.font@redhat.com>
Mon, 8 Aug 2016 17:16:48 +0000 (10:16 -0700)
This fixes #845 for containerized deployments. We now also mount the
/etc/localtime volume in the containers in order to synchronize the host
timezone with the container timezone.

Signed-off-by: Ivan Font <ivan.font@redhat.com>
29 files changed:
roles/ceph-common/tasks/checks/check_ntp_atomic.yml [new file with mode: 0644]
roles/ceph-common/tasks/misc/ntp_atomic.yml [new file with mode: 0644]
roles/ceph-mds/tasks/docker/main.yml
roles/ceph-mds/tasks/docker/pre_requisite.yml
roles/ceph-mds/tasks/docker/start_docker_mds.yml
roles/ceph-mds/templates/ceph-mds.service.j2
roles/ceph-mon/tasks/docker/main.yml
roles/ceph-mon/tasks/docker/pre_requisite.yml
roles/ceph-mon/tasks/docker/start_docker_monitor.yml
roles/ceph-mon/templates/ceph-mon.service.j2
roles/ceph-nfs/tasks/docker/main.yml
roles/ceph-nfs/tasks/docker/pre_requisite.yml
roles/ceph-nfs/tasks/docker/start_docker_nfs.yml
roles/ceph-nfs/templates/ceph-nfs.service.j2
roles/ceph-osd/tasks/docker/main.yml
roles/ceph-osd/tasks/docker/pre_requisite.yml
roles/ceph-osd/tasks/docker/start_docker_osd.yml
roles/ceph-osd/templates/ceph-osd.service.j2
roles/ceph-rbd-mirror/tasks/docker/main.yml
roles/ceph-rbd-mirror/tasks/docker/pre_requisite.yml
roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml
roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2
roles/ceph-restapi/tasks/docker/main.yml
roles/ceph-restapi/tasks/docker/pre_requisite.yml
roles/ceph-restapi/tasks/docker/start_docker_restapi.yml
roles/ceph-rgw/tasks/docker/main.yml
roles/ceph-rgw/tasks/docker/pre_requisite.yml
roles/ceph-rgw/tasks/docker/start_docker_rgw.yml
roles/ceph-rgw/templates/ceph-rgw.service.j2

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 (file)
index 0000000..e1fbba4
--- /dev/null
@@ -0,0 +1,7 @@
+---
+- name: check ntp installation on atomic
+  command: rpm -q chrony
+  register: ntp_pkg_query
+  ignore_errors: true
+  changed_when: false
+  when: ansible_os_family == 'RedHat'
diff --git a/roles/ceph-common/tasks/misc/ntp_atomic.yml b/roles/ceph-common/tasks/misc/ntp_atomic.yml
new file mode 100644 (file)
index 0000000..3e47f83
--- /dev/null
@@ -0,0 +1,11 @@
+---
+- include: ../checks/check_ntp_atomic.yml
+  when: ansible_os_family == 'RedHat'
+
+- name: start the ntp service
+  service:
+    name: chronyd
+    enabled: yes
+    state: started
+  when:
+    - ntp_pkg_query.rc == 0
index 0c42388ea75ab3be2ed43e54baae275f96e99865..fbae68b89ceb872158a20deebe3cd4968f90052c 100644 (file)
   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 }}"
index a32d7caf0ecf1d14869f60cbd2b0e919346838d6..972003be3b61ab836149e5f3a68dad7b9838e7d2 100644 (file)
   tags:
     with_pkg
   when: ansible_version['full'] | version_compare('2.1.0.0', '<')
+
 - name: install docker-py
   pip:
     name: docker-py
     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
index 9f3a7b68ccec77dce0376f34197831f487591db5..a62a7d536d15188c16510e6b2136e1e19cc0149a 100644 (file)
@@ -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'
index 283183d5679f5b5702f77f56949d54ba9ce851bf..208c8d294d3257165179970c2831d1d3a66e5838 100644 (file)
@@ -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 \
index d2fc4f8ab9ea884ff8c73b1e2f42389f32b7df4f..802449acfa0e19040cd7d35544ab681e7fc04d46 100644 (file)
 
 - 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 }}"
index dde220721b6e57578625565e99484ec8d2adb247..9c27ee8cc5f4e654c7a56615ade500e9a04ed3d7 100644 (file)
   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
index 7072a2e251a4d40448c118a60c0a24b277325114..f3754a850b876a12ccc41b57b0b57ac6acb93b2d 100644 (file)
@@ -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'
index 93c5a66adef44690c5ca0accce73729b9da41459..b8facb2444f6c73e9b27ac6979d60daa20d8618c 100644 (file)
@@ -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 -%}
index ae9a3cb21c99f3eec402ebffd925937489cf2918..1e4d030f9e39ac0e5349c1fe028ae7dd7182e299 100644 (file)
 
 - 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 }}"
index c937afc727cc4f844cc58e82067b48f35f2527c0..69b538518dce6f8a4cdb5a3a33c4ff3e55f52071 100644 (file)
     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
index 77a5a9604eba32f5205481f2e2d16a3f17d729d8..7e0196c93a6f2e2aba78a6df15a3242ed7a4bf98 100644 (file)
@@ -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
index d78d2d0d253d9af7bbc184c0554d27be236b9622..bd8b41b0a9da545b4701549f899bbcdcea456cde 100644 (file)
@@ -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 }} \
index 41e68785ee30615d7f4bbcf3284687c0a7a20038..16ccd8cb2eb3ea01eb4f16c85c96c3201c3fbec0 100644 (file)
 
 - 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 }}'
index 728d562b1aa1a15f0974530d9617d98017bf2f42..ab7e21057fa6cdc196b6c03b39388c36a6c784d1 100644 (file)
   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
index 34cbacbc13e7f58f82a4e7326865994bd4a79504..f466f02b812161cdf120667d568841121fad3dcb 100644 (file)
@@ -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 \
     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'
     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'
index 12e6a952074b03e85f544b291ca1c4acde909314..a6841b9ac4bddbc635c6e8762679ceda5d668a75 100644 (file)
@@ -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 \
index 886beca75e54feafd31a8920d3d5a3a2fa0dbe92..7bfe9da2c364faa7e42e5ba9414f61bcc05ab2dd 100644 (file)
   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 }}"
index 4b060aed64647d7633c00e37ec668562fd373700..6cc5e0bba3d84c04eb2e8d49cf362f5ee72b8fe3 100644 (file)
   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
index cb4ff3b4a3975130a7164ffcaf29fea88cbe7ae9..fcd34cc7ab1e055a20505f5559dc6ef5abc7e74f 100644 (file)
@@ -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'
index 69aa5b605385a782e1c5d2f5e66ad9fc6b962700..618967e56093ce04c97754cd55c16c8af40c0a85 100644 (file)
@@ -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 }} \
index a0945cc1f75e7a342a80675fde6e540a52bfd76f..fc22747941397b95e8aa8668ebabbbea0d011b76 100644 (file)
@@ -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 }}"
index c4e8922c914da269c46e91fbe9f4ade91af01a7f..d89fe36f6983784cd97f0bf24972856278393989 100644 (file)
     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
index 40e6b355b7f532d0a554336376d74ca6c2ee6760..045c07d1da8b31f2919825acc1b36719cda3cbef 100644 (file)
@@ -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"
index 787a4fdcc318b73f4ce39b943f0d308d1fd9646d..360d37b71f5ec0e2ada7f5a6fec2daecb59c6e2a 100644 (file)
   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 }}"
index c322ed12c71ee4400e398e3a735162010114c57b..92c3ae8ae02337963db995b0398db95c5d7a753c 100644 (file)
     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
index 11e9f910e8b6ea3b3fd4c00529c2d60c86f455bd..cfdd107b1d21e347bebf2cc9b006f1a85ec21785 100644 (file)
@@ -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'
index 5a173f95b9cce9f7f47d16fff0c2f6efe74953bc..4dfcc754e1adc6b61dd7b5f4990b6d4d66ebf32c 100644 (file)
@@ -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 }} \