mirror of https://github.com/ceph/ceph-ansible.git
commit
16174a397c
|
@ -9,4 +9,6 @@
|
|||
- "{{ ceph_config_keys }}"
|
||||
- "{{ statconfig.results }}"
|
||||
when:
|
||||
- inventory_hostname == groups.get(mon_group_name)
|
||||
- item.1.stat.exists == true
|
||||
- ceph_health.stdout_lines | length == 0
|
||||
|
|
|
@ -40,19 +40,19 @@
|
|||
set_fact:
|
||||
docker_version: "{{ docker_version.stdout.split(' ')[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
|
||||
|
||||
# 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.
|
||||
- name: check if a cluster is already running
|
||||
command: "docker ps -q --filter=\'name=ceph-mon-{{ ansible_hostname }}\'"
|
||||
register: ceph_health
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
always_run: true
|
||||
|
||||
- name: include checks.yml
|
||||
include: checks.yml
|
||||
when:
|
||||
|
@ -60,8 +60,8 @@
|
|||
((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) }}"
|
||||
- ceph_health.stdout_lines | length == 0
|
||||
- not rolling_update | default(false)
|
||||
|
||||
- name: include misc/ntp_atomic.yml
|
||||
include: misc/ntp_atomic.yml
|
||||
|
|
|
@ -8,17 +8,7 @@
|
|||
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
|
||||
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
|
||||
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
|
||||
|
||||
- name: set_fact bootstrap_rbd_keyring
|
||||
set_fact:
|
||||
bootstrap_rbd_keyring:
|
||||
- "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring"
|
||||
when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous
|
||||
|
||||
- name: set_fact ceph_config_keys ceph_config_keys + bootstrap_rbd_keyring
|
||||
set_fact:
|
||||
ceph_config_keys: "{{ ceph_config_keys + bootstrap_rbd_keyring }}"
|
||||
when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous
|
||||
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
|
||||
|
||||
- name: set_fact tmp_ceph_mgr_keys add mgr keys to config and keys paths
|
||||
set_fact:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
set_fact:
|
||||
ceph_config_keys:
|
||||
- /etc/ceph/{{ cluster }}.mgr.{{ ansible_hostname }}.keyring
|
||||
- /etc/ceph/{{ cluster }}.client.admin.keyring
|
||||
|
||||
- name: stat for ceph config and keys
|
||||
local_action: stat path={{ fetch_directory }}/{{ fsid }}/{{ item }}
|
||||
|
|
|
@ -8,6 +8,18 @@
|
|||
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
|
||||
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
|
||||
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
|
||||
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
|
||||
|
||||
- name: register rbd bootstrap key
|
||||
set_fact:
|
||||
bootstrap_rbd_keyring:
|
||||
- "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring"
|
||||
when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous
|
||||
|
||||
- name: merge rbd bootstrap key to config and keys paths
|
||||
set_fact:
|
||||
ceph_config_keys: "{{ ceph_config_keys + bootstrap_rbd_keyring }}"
|
||||
when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous
|
||||
|
||||
- name: set_fact tmp_ceph_mgr_keys add mgr keys to config and keys paths
|
||||
set_fact:
|
||||
|
|
|
@ -93,6 +93,13 @@
|
|||
notify:
|
||||
- restart ceph nfss
|
||||
|
||||
- name: change ownership on /var/log/ganesha
|
||||
file:
|
||||
path: '/var/log/ganesha'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: '0755'
|
||||
|
||||
- name: start nfs gateway service
|
||||
service:
|
||||
name: nfs-ganesha
|
||||
|
|
|
@ -10,24 +10,20 @@
|
|||
|
||||
# For backward compatibility
|
||||
- name: disable old systemd unit ('ceph-rgw@') if present
|
||||
service:
|
||||
name: ceph-rgw@{{ ansible_hostname }}
|
||||
state: disable
|
||||
systemd:
|
||||
name: "{{ item }}"
|
||||
state: stopped
|
||||
enabled: no
|
||||
daemon_reload: yes
|
||||
with_items:
|
||||
- "ceph-rgw@{{ ansible_hostname }}"
|
||||
- "ceph-radosgw@{{ ansible_hostname }}.service"
|
||||
ignore_errors: true
|
||||
|
||||
- name: enable systemd unit file for rgw instance
|
||||
shell: systemctl enable ceph-radosgw@{{ ansible_hostname }}.service
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: reload systemd unit files
|
||||
shell: systemctl daemon-reload
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: systemd start rgw container
|
||||
service:
|
||||
name: ceph-radosgw@{{ ansible_hostname }}
|
||||
systemd:
|
||||
name: "ceph-radosgw@rgw.{{ ansible_hostname }}.service"
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
changed_when: false
|
||||
|
|
|
@ -101,6 +101,10 @@ def pytest_collection_modifyitems(session, config, items):
|
|||
item.add_marker(pytest.mark.osds)
|
||||
elif "mds" in test_path:
|
||||
item.add_marker(pytest.mark.mdss)
|
||||
elif "mgr" in test_path:
|
||||
item.add_marker(pytest.mark.mgrs)
|
||||
elif "rbd-mirror" in test_path:
|
||||
item.add_marker(pytest.mark.rbdmirrors)
|
||||
elif "rgw" in test_path:
|
||||
item.add_marker(pytest.mark.rgws)
|
||||
elif "nfs" in test_path:
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
import pytest
|
||||
import json
|
||||
|
||||
class TestMDSs(object):
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_mds_is_installed(self, node, host):
|
||||
assert host.package("ceph-mds").is_installed
|
||||
|
||||
def test_mds_service_is_running(self, node, host):
|
||||
service_name = "ceph-mds@{hostname}".format(
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
)
|
||||
assert host.service(service_name).is_running
|
||||
|
||||
def test_mds_service_is_enabled(self, node, host):
|
||||
service_name = "ceph-mds@{hostname}".format(
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
)
|
||||
assert host.service(service_name).is_enabled
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_mds_is_up(self, node, host):
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cmd = "sudo ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(cluster=node['cluster_name'])
|
||||
output = host.check_output(cmd)
|
||||
daemons = json.loads(output)["fsmap"]["by_rank"][0]["name"]
|
||||
assert hostname in daemons
|
||||
|
||||
@pytest.mark.docker
|
||||
def test_docker_mds_is_up(self, node, host):
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cmd = "sudo docker exec ceph-mds-{hostname} ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
hostname=node["vars"]["inventory_hostname"],
|
||||
cluster=node["cluster_name"]
|
||||
)
|
||||
output = host.check_output(cmd)
|
||||
daemons = json.loads(output)["fsmap"]["by_rank"][0]["name"]
|
||||
assert hostname in daemons
|
|
@ -0,0 +1,44 @@
|
|||
import pytest
|
||||
import json
|
||||
|
||||
class TestMGRs(object):
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_mgr_is_installed(self, node, host):
|
||||
assert host.package("ceph-mgr").is_installed
|
||||
|
||||
def test_mgr_service_is_running(self, node, host):
|
||||
service_name = "ceph-mgr@{hostname}".format(
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
)
|
||||
assert host.service(service_name).is_running
|
||||
|
||||
def test_mgr_service_is_enabled(self, node, host):
|
||||
service_name = "ceph-mgr@{hostname}".format(
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
)
|
||||
assert host.service(service_name).is_enabled
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_mgr_is_up(self, node, host):
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
cluster=node["cluster_name"]
|
||||
cmd = "sudo ceph --name mgr.{hostname} --keyring /var/lib/ceph/mgr/{cluster}-{hostname}/keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
hostname=hostname,
|
||||
cluster=cluster
|
||||
)
|
||||
output = host.check_output(cmd)
|
||||
daemons = json.loads(output)["mgrmap"]["active_name"]
|
||||
assert hostname in daemons
|
||||
|
||||
@pytest.mark.docker
|
||||
def test_docker_mgr_is_up(self, node, host):
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
cluster=node["cluster_name"]
|
||||
cmd = "sudo docker exec ceph-mgr-{hostname} ceph --name mgr.{hostname} --keyring /var/lib/ceph/mgr/{cluster}-{hostname}/keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
hostname=node["vars"]["inventory_hostname"],
|
||||
cluster=node["cluster_name"]
|
||||
)
|
||||
output = host.check_output(cmd)
|
||||
daemons = json.loads(output)["mgrmap"]["active_name"]
|
||||
assert hostname in daemons
|
|
@ -22,11 +22,12 @@ class TestNFSs(object):
|
|||
def test_nfs_config_override(self, node, host):
|
||||
assert host.file("/etc/ganesha/ganesha.conf").contains("Entries_HWMark")
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_nfs_rgw_fsal_export(self, node, host):
|
||||
if(host.mount_point("/mnt").exists):
|
||||
cmd = host.run("sudo umount /mnt")
|
||||
assert cmd.rc == 0
|
||||
cmd = host.run("sudo mount.nfs localhost:/ceph /mnt/")
|
||||
assert cmd.rc == 0
|
||||
assert host.mount_point("/mnt").exists
|
||||
#NOTE (guits): This check must be fixed. (Permission denied error)
|
||||
# @pytest.mark.no_docker
|
||||
# def test_nfs_rgw_fsal_export(self, node, host):
|
||||
# if(host.mount_point("/mnt").exists):
|
||||
# cmd = host.run("sudo umount /mnt")
|
||||
# assert cmd.rc == 0
|
||||
# cmd = host.run("sudo mount.nfs localhost:/ceph /mnt/")
|
||||
# assert cmd.rc == 0
|
||||
# assert host.mount_point("/mnt").exists
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import pytest
|
||||
import json
|
||||
|
||||
class TestRbdMirrors(object):
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_rbd_mirror_is_installed(self, node, host):
|
||||
assert host.package("rbd-mirror").is_installed
|
||||
|
||||
def test_rbd_mirror_service_is_running(self, node, host):
|
||||
service_name = "ceph-rbd-mirror@rbd-mirror.{hostname}".format(
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
)
|
||||
assert host.service(service_name).is_running
|
||||
|
||||
def test_rbd_mirror_service_is_enabled(self, node, host):
|
||||
service_name = "ceph-rbd-mirror@rbd-mirror.{hostname}".format(
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
)
|
||||
assert host.service(service_name).is_enabled
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_rbd_mirror_is_up(self, node, host):
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node['cluster_name']
|
||||
cmd = "sudo ceph --name client.bootstrap-rbd --keyring /var/lib/ceph/bootstrap-rbd/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
hostname=hostname,
|
||||
cluster=cluster
|
||||
)
|
||||
output = host.check_output(cmd)
|
||||
daemons = [i for i in json.loads(output)["servicemap"]["services"]["rbd-mirror"]["daemons"]]
|
||||
assert hostname in daemons
|
||||
|
||||
@pytest.mark.docker
|
||||
def test_docker_rbd_mirror_is_up(self, node, host):
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node['cluster_name']
|
||||
cmd = "sudo docker exec ceph-rbd-mirror-{hostname} ceph --name client.bootstrap-rbd --keyring /var/lib/ceph/bootstrap-rbd/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
hostname=hostname,
|
||||
cluster=cluster
|
||||
)
|
||||
output = host.check_output(cmd)
|
||||
daemons = [i for i in json.loads(output)["servicemap"]["services"]["rbd-mirror"]["daemons"]]
|
||||
assert hostname in daemons
|
|
@ -0,0 +1,47 @@
|
|||
import pytest
|
||||
import json
|
||||
|
||||
class TestRGWs(object):
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_rgw_is_installed(self, node, host):
|
||||
result = host.package("radosgw").is_installed
|
||||
if not result:
|
||||
result = host.package("ceph-radosgw").is_installed
|
||||
assert result
|
||||
|
||||
def test_rgw_service_is_running(self, node, host):
|
||||
service_name = "ceph-radosgw@rgw.{hostname}".format(
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
)
|
||||
assert host.service(service_name).is_running
|
||||
|
||||
def test_rgw_service_is_enabled(self, node, host):
|
||||
service_name = "ceph-radosgw@rgw.{hostname}".format(
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
)
|
||||
assert host.service(service_name).is_enabled
|
||||
|
||||
@pytest.mark.no_docker
|
||||
def test_rgw_is_up(self, node, host):
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node['cluster_name']
|
||||
cmd = "sudo ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
hostname=hostname,
|
||||
cluster=cluster
|
||||
)
|
||||
output = host.check_output(cmd)
|
||||
daemons = [i for i in json.loads(output)["servicemap"]["services"]["rgw"]["daemons"]]
|
||||
assert hostname in daemons
|
||||
|
||||
@pytest.mark.docker
|
||||
def test_docker_rgw_is_up(self, node, host):
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node['cluster_name']
|
||||
cmd = "sudo docker exec ceph-rgw-{hostname} ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
hostname=hostname,
|
||||
cluster=cluster
|
||||
)
|
||||
output = host.check_output(cmd)
|
||||
daemons = [i for i in json.loads(output)["servicemap"]["services"]["rgw"]["daemons"]]
|
||||
assert hostname in daemons
|
Loading…
Reference in New Issue