]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/log
ceph-ansible.git
4 years agoUse ansible_facts
Alex Schultz [Wed, 3 Mar 2021 14:43:50 +0000 (07:43 -0700)]
Use ansible_facts

It has come to our attention that using ansible_* vars that are
populated with INJECT_FACTS_AS_VARS=True is not very performant.  In
order to be able to support setting that to off, we need to update the
references to use ansible_facts[<thing>] instead of ansible_<thing>.

Related: ansible#73654
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1935406
Signed-off-by: Alex Schultz <aschultz@redhat.com>
(cherry picked from commit a7f2fa73e63e69dba2e41aaac9732397eec437c9)

4 years agolibrary: drop ceph_facts
Guillaume Abrioux [Thu, 25 Mar 2021 02:49:11 +0000 (03:49 +0100)]
library: drop ceph_facts

This is never called in the playbook and seems unmaintained.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit b01f16e8353ac261d8de34ef8b04e618c455492d)

4 years agoREADME-MULTISITE: fix typos
Ken Dreyer [Wed, 24 Mar 2021 20:44:52 +0000 (14:44 -0600)]
README-MULTISITE: fix typos

This commit fixes some typos in MULTISITE documentation.

Signed-off-by: Ken Dreyer <ktdreyer@redhat.com>
(cherry picked from commit 63a246db41195f842537473e1784f642ca6292cf)

4 years agotests: switch to quay.ceph.io for dashboard images
Guillaume Abrioux [Tue, 23 Mar 2021 13:49:30 +0000 (14:49 +0100)]
tests: switch to quay.ceph.io for dashboard images

for some reason, `quay.io/app-sre/grafana` no longer exist.
as a workaround, all dashboard related images have been mirrored on
quay.ceph.io.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit c90b0985e50cd9a4a0160d0707af544f319a7fe8)

4 years agoiscsi: fetch right repo from shaman
Guillaume Abrioux [Tue, 23 Mar 2021 10:25:51 +0000 (11:25 +0100)]
iscsi: fetch right repo from shaman

due to recent changes in shaman, we must fetch the right repo by
filtering on the desired architecture.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 5801171b37a3acd6d7d26b874c7d541d135b9f15)

4 years agotests: fix `test_rgw_is_up` test
Guillaume Abrioux [Tue, 23 Mar 2021 08:04:51 +0000 (09:04 +0100)]
tests: fix `test_rgw_is_up` test

The data structure seems to have been modified in ceph@master (quincy).

This commit update the test accordingly.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit b8080bac41f7604c3f37a2db214e4091f64720b4)

4 years agotests: fix `test_nfs_is_up` test
Guillaume Abrioux [Mon, 22 Mar 2021 16:54:27 +0000 (17:54 +0100)]
tests: fix `test_nfs_is_up` test

the data structure seems to have been modified in ceph@master (quincy).

This commit update the test accordingly.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 7e1db0b59929b30b35c75968076b34685d0eac5b)

4 years agoceph_volume: fix bug in `is_lv()`
Guillaume Abrioux [Mon, 22 Mar 2021 13:46:55 +0000 (14:46 +0100)]
ceph_volume: fix bug in `is_lv()`

This function makes the `ceph_volume` module be not idempotent in
containerized context because it tries to run a container and bindmount
directories that no longer exist.

In that case, the `lvs` command being executed returns something
different than `0` so we can't call `json.loads(out)['report'][0]['lv']`
since it might throw an python error.

The idea is to return `True` only if `rc` is equal to `0` and
`len(result)` is greater than `0`, which means the command matched an
LV.

Fixes: #6284
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit ed79bc7a4e38e257f37faac50a5a19c06711dd8d)

4 years agofix 'command -v' tasks
Guillaume Abrioux [Thu, 18 Mar 2021 10:36:59 +0000 (11:36 +0100)]
fix 'command -v' tasks

`command -v` is a bash script which needs a shell to run.

Fixes: #6325
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 14c472707c165f77def05826b22885480af3e8f9)

4 years agofacts: fix nfs/external cluster scenario
Guillaume Abrioux [Tue, 16 Mar 2021 13:13:13 +0000 (14:13 +0100)]
facts: fix nfs/external cluster scenario

These tasks shouldn't be run when at least 1 monitor isn't present in
the inventory.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1937997
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit ccd1cbb732e25fe364b68a548cbed11da2a91ceb)

4 years agoconfig: reset num_osds
Guillaume Abrioux [Fri, 12 Mar 2021 14:49:15 +0000 (15:49 +0100)]
config: reset num_osds

When collocating OSDs with other daemon, `num_osds` is incorrectly calculated
because `ceph-config` is called multiple times.

Indeed, the following code:
```
num_osds: "{{ lvm_list.stdout | default('{}') | from_json | length | int + num_osds | default(0) | int }}"
```

makes `num_osds` be incremented each time `ceph-config` is called.

We have to reset it in order to get the correct number of expected OSDs.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 31a0f2653db0a1ff57adb1249107e2e8986ac34b)

4 years agotests: increase nb of rerun in pytest
Guillaume Abrioux [Wed, 3 Mar 2021 07:51:25 +0000 (08:51 +0100)]
tests: increase nb of rerun in pytest

In order to avoid false positive in the CI that I've been unable to
reproduce.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit f7fd1c229896c3a6a482c92a64742f06bbed0a25)

4 years agoDocs: fix some typos
Matthew Vernon [Wed, 10 Mar 2021 16:53:45 +0000 (16:53 +0000)]
Docs: fix some typos

While working on the previous PR, I found a couple of typos in the
docs. This fixes those.

Signed-off-by: Matthew Vernon <mv3@sanger.ac.uk>
(cherry picked from commit 8b1474ab75bb5563bbdecaf965f8fbb240bd93bf)

4 years agodebian/uca: remove the handler notification
Dimitri Savineau [Wed, 10 Jun 2020 14:32:53 +0000 (10:32 -0400)]
debian/uca: remove the handler notification

The "update apt cache" in the ceph-handler role was never called and the
handler trigger after adding the uca repository doesn't exist at all.
Instead of using a handler for that we can just set the update_cache
parameter to true like the other apt_repository tasks.

Resolve merge conflict from cherry-picking this commit.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 09d6706697d37abc245f627847c07e9b165d03a0)

4 years agolibrary: do not always add --yes in batch mode v4.0.50
Guillaume Abrioux [Tue, 9 Feb 2021 14:28:08 +0000 (15:28 +0100)]
library: do not always add --yes in batch mode

When asking `ceph-volume` to report only in `lvm batch` context, there's
a bug described in bz1896803 [1] when `--yes` is passed (which by the
way isn't necessary with `--report`).
This commit ensure `--yes` isn't passed to `ceph-volume` when `--report`
is used.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1896803

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1896803
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit fe6d6ba62248853dabf9ecbd5fe702b319b8f14a)

4 years agopurge: rm service-cid files
Guillaume Abrioux [Tue, 2 Feb 2021 20:22:50 +0000 (21:22 +0100)]
purge: rm service-cid files

This commit makes sure purge playbooks remove those file if for any reason they
have been left.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1920900
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit b9dd253a4fdd336684d107a5f2692dabc5fc1d36)

4 years agoswitch2container: do not serialize the ceph-crash migration
Guillaume Abrioux [Thu, 11 Feb 2021 15:28:31 +0000 (16:28 +0100)]
switch2container: do not serialize the ceph-crash migration

There's no need to slow down the playbook execution time by migrating
all the `ceph-crash` instances in a serial way. Let's remove the
`serial: 1` so the migration is achieved in a parallel way.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 980a5a7df4f6f286b5e6a16b786847920c269bdd)

4 years agorolling_update: enforce ceph-container-engine
Dimitri Savineau [Wed, 3 Feb 2021 22:39:49 +0000 (17:39 -0500)]
rolling_update: enforce ceph-container-engine

When running the rolling_update.yml playbook and adding the dashboard
component in the same time then the requirement (like container packages)
aren't installed.
This could lead to a failure in case of using authentication on the
container registry because the playbook will try to login on the registry
but podman/docker aren't yet installed.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1903504
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1918650
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 48a456dc8c951d869c7745aa38fbe5327795eb65)

4 years agoceph-common: enable rhcs tools repo for monitoring
Dimitri Savineau [Wed, 3 Feb 2021 15:28:24 +0000 (10:28 -0500)]
ceph-common: enable rhcs tools repo for monitoring

The monitoring node running grafana needs the rhcs tools repostory
enabled in non containerized deployment to be able to install the
ceph-grafana-dashboards rpm package.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1918650
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit e4dd0067c6fbe824b895ebaedb805359e85f0374)

4 years agorolling_update: exclude clients from node-exporter
Dimitri Savineau [Wed, 3 Feb 2021 18:07:24 +0000 (13:07 -0500)]
rolling_update: exclude clients from node-exporter

Since b105549 we don't install node-exporter on client nodes so we should
also exclude the client node from the node-exporter upgrade.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 94af3c87d18fab6170c5b32f1431a0d49ccad321)

4 years agopurge: zap and destroy db and wal devices for lvm batch
Guillaume Abrioux [Mon, 1 Feb 2021 15:51:07 +0000 (16:51 +0100)]
purge: zap and destroy db and wal devices for lvm batch

Those devices (db/wal) are never zapped in lvm batch deployment.
Iterating over `dedicated_devices` and `bluestore_wal_devices` fixes
this issue.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1922926
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 984191ac7fc7c500de3a7a111564a537b937711b)

4 years agofacts: support device aliases for (dedicated|bluestore_wal)_devices
Tyler Bishop [Thu, 23 Jul 2020 13:36:01 +0000 (09:36 -0400)]
facts: support device aliases for (dedicated|bluestore_wal)_devices

Just likve `devices`, this commit adds the support for linux device aliases for
`dedicated_devices` and `bluestore_wal_devices`.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1919084
Signed-off-by: Tyler Bishop <tbishop@liquidweb.com>
(cherry picked from commit ee4b8804ae1260a84737b7db8de2e9d2eb3a5737)

4 years agomon: fix cephx disabled deployment
Guillaume Abrioux [Wed, 13 Jan 2021 10:07:50 +0000 (11:07 +0100)]
mon: fix cephx disabled deployment

Due to missing condition on `cephx` variable, cephx disabled deployments
are broken.
This commit fixes this.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1910151
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 4af084570274c2ffdc601c9113242df4808cb726)

4 years agoswitch2container: fix mon quorum check
Guillaume Abrioux [Fri, 18 Dec 2020 09:33:44 +0000 (10:33 +0100)]
switch2container: fix mon quorum check

The current check makes no sense because it checks any of other monitor
than the one being played (either a previous one already converted or a
next that isn't yet converted) is present on the quorum.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1909011
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 175ffa1b882960e8127ada7f6a4b1e6c9a9b8fba)

4 years agocommon: ensure shaman returns right repo
Guillaume Abrioux [Fri, 5 Feb 2021 19:41:21 +0000 (20:41 +0100)]
common: ensure shaman returns right repo

Due to recent changes in shaman, there's a chance it returns the wrong
repository from architecture point of view.
We can query shaman and ask for the correct architecture to get around
this.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 39649f0ce8dd1c7b911fb7442f16e141735685b0)

4 years agoFix typo and broken link for documenting RGW frontends
Matthew Vernon [Mon, 22 Feb 2021 14:26:10 +0000 (14:26 +0000)]
Fix typo and broken link for documenting RGW frontends

http://docs.ceph.com/docs/nautilus/radosgw/frontends/ 404s so replace
it with a working "latest" docs link, and correct the spelling of
"additional" while I'm at it.

Signed-off-by: Matthew Vernon <mv3@sanger.ac.uk>
(cherry picked from commit 847611048ef3c0aa0ae542623f35b23b9cbea8a6)

4 years agorequirements.txt: Move the six dependency into the general requirements
Florian Haas [Fri, 12 Feb 2021 08:29:00 +0000 (09:29 +0100)]
requirements.txt: Move the six dependency into the general requirements

config_template.py depends on six, which isn't listed in the default
requirements.txt. This previously frequently wasn't a problem, because
six used to be a standard package being installed into a venv, and
lots of other projects depended on it.

It also does get installed for unit and integration tests via
tests/requirements.txt, so any broken dependency on six wouldn't be
detected by tox runs.

However, as other projects and distributions have phased out Python
2.7 support the dependency on six becomes less common. Thus, as long
as ceph-ansible does require it for config_template.py, add it to the
base requirements.

Signed-off-by: Florian Haas <florian@citynetwork.eu>
(cherry picked from commit d49ea9818b162a4b8fc0f5099f45acff4d22fe14)

4 years agodashboard: add missing parameter in `ceph_cmd` v4.0.49
Guillaume Abrioux [Mon, 1 Mar 2021 14:22:22 +0000 (15:22 +0100)]
dashboard: add missing parameter in `ceph_cmd`

the `ceph_cmd` fact is missing the `--net=host` parameter.

Some tasks consuming this fact can fail like following:

```
Error: error configuring network namespace for container b8ec913db1fb694ae683faf202680de7a59c714a004e533aba87e8503d29261f: Missing CNI default network
```

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1931365
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit f143b1a6478bffe0e7ff1c23810d0a5368cf3592)

4 years agoupdate: fix require-osd-release task v4.0.48
Guillaume Abrioux [Thu, 18 Feb 2021 19:50:16 +0000 (20:50 +0100)]
update: fix require-osd-release task

This commit fixes two issues in rolling_update.yml:

- `container_exec_cmd_update_osd` is unset in the `complete osd upgrade`
play so it never runs the command in a container.
- the 'require-osd-release' task is never applied because the condition
  looks for luminous release.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1930164
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
4 years agodefaults: update rhcs dashboard images versions v4.0.47
Guillaume Abrioux [Wed, 17 Feb 2021 03:22:34 +0000 (04:22 +0100)]
defaults: update rhcs dashboard images versions

The current dashboard images deployed have a bad health index.
Updating to a newer version fixes this issue.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1925350
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit a16ae693d8e1d3502acf92004179d84c6b60c873)

4 years agodoc: add a note about "latest" tags
Guillaume Abrioux [Thu, 11 Feb 2021 12:58:27 +0000 (13:58 +0100)]
doc: add a note about "latest" tags

See the change for details.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 4e95180c80c3da0c721c54b100e7698798b173cc)

4 years agodoc: update containerized deployment
Dimitri Savineau [Tue, 26 Jan 2021 19:03:27 +0000 (14:03 -0500)]
doc: update containerized deployment

This adds more documentation to the configuration and usage of
containerizerd deployment.

Closes: #6198
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit d42d584085bd768d6a8f3ef57c862811b8ec67b5)

4 years agotests: install correct ansible-lint version v4.0.46
Guillaume Abrioux [Wed, 10 Feb 2021 07:04:09 +0000 (08:04 +0100)]
tests: install correct ansible-lint version

We need to pin the ansible-lint version depending on python version
being used.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
4 years agotests: set `mon_max_pg_per_osd` in rgw_multisite
Guillaume Abrioux [Tue, 9 Feb 2021 14:50:43 +0000 (15:50 +0100)]
tests: set `mon_max_pg_per_osd` in rgw_multisite

Otherwise, the job fails when it tries to create a bucket with `s3cmd mb`
command because we have too many PGs per OSD.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 54bae480d20b1066e20d1bfa530f987a8425535c)

4 years agorgw: fix a typo in multisite
Guillaume Abrioux [Thu, 4 Feb 2021 16:45:05 +0000 (17:45 +0100)]
rgw: fix a typo in multisite

if `rgw_zonegroupmaster` is not defined at the rgw instance level in
`rgw_instances` it will fallback to a wrong variable (`rgw_zonemaster`).

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1925247
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 931b87e83044936648172c37ff961fee3d660c14)

4 years agorgw: quick fix in create_zone_user.yml v4.0.45
Guillaume Abrioux [Mon, 1 Feb 2021 13:04:40 +0000 (14:04 +0100)]
rgw: quick fix in create_zone_user.yml

typical error:

```
2021-02-01 03:11:09,809 p=93834 u=cephuser n=ansible | TASK [ceph-rgw : check if the realm system user already exists] ***************************************************************************************************************************************************
2021-02-01 03:11:09,809 p=93834 u=cephuser n=ansible | Monday 01 February 2021  03:11:09 -0500 (0:00:00.084)       0:14:38.607 *******
2021-02-01 03:11:09,836 p=93834 u=cephuser n=ansible | fatal: [ceph-kvm-ms2-1611241931591-node7-rgw]: FAILED! =>
  msg: |-
    The task includes an option with an undefined variable. The error was: 'None' has no attribute 'realm'
```

This task should be skipped when `zone_users` is undefined.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1922998
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
4 years agoceph-mon: add ExecStartPre docker stop to systemd
Dimitri Savineau [Wed, 13 Jan 2021 15:17:56 +0000 (10:17 -0500)]
ceph-mon: add ExecStartPre docker stop to systemd

We already do that in the other systemd templates (mgr, mds, etc..)
and would present to add workaround in other orchestration tool.
This change is for containerized deployment only.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1882724
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 3749d297c77e65406ddec08e7bae5cea097905d8)

4 years agorgw: avoid useless call to ceph-rgw v4.0.44
Guillaume Abrioux [Wed, 27 Jan 2021 17:36:13 +0000 (18:36 +0100)]
rgw: avoid useless call to ceph-rgw

since `ceph-rgw` may be called from `ceph-handler` in some contexts we
should avoid rerunning it unnecessarily.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 86170816649ccb1d0995ea3f0bd17275d4af2574)

4 years agocontainers: use --cpus instead --cpu-quota
Guillaume Abrioux [Fri, 10 Jan 2020 09:55:06 +0000 (10:55 +0100)]
containers: use --cpus instead --cpu-quota

When using docker 1.13.1, the current condition:

```
{% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
```

is wrong because it compares the first digit (1) whereas it should
compare the second one.
It means we always use `--cpu-quota` although documentation recommend
using `--cpus` when docker version is 1.13.1 or higher.

From the doc:
> --cpu-quota=<value> Impose a CPU CFS quota on the container. The number of
> microseconds per --cpu-period that the container is limited to before
> throttled. As such acting as the effective ceiling.
> If you use Docker 1.13 or higher, use --cpus instead.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 3e262e072b0e86bbb431c47bc691bcad70783443)

4 years agorgw: multisite refact
Guillaume Abrioux [Thu, 14 Jan 2021 16:52:39 +0000 (17:52 +0100)]
rgw: multisite refact

Add the possibility to deploy rgw multisite configuration with a mix of
secondary and primary zones on a same rgw node.
Before that, on a same node, all instances were either primary
zones *OR* secondary.

Now you can define a rgw instance like following:

```
rgw_instances:
  - instance_name: 'rgw0'
    rgw_zonemaster: false
    rgw_zonesecondary: true
    rgw_zonegroupmaster: false
    rgw_realm: 'france'
    rgw_zonegroup: 'zonegroup-france'
    rgw_zone: paris-00
    radosgw_address: "{{ _radosgw_address }}"
    radosgw_frontend_port: 8080
    rgw_zone_user: jacques.chirac
    rgw_zone_user_display_name: "Jacques Chirac"
    system_access_key: P9Eb6S8XNyo4dtZZUUMy
    system_secret_key: qqHCUtfdNnpHq3PZRHW5un9l0bEBM812Uhow0XfB
    endpoint: http://192.168.101.12:8080
```

Basically it's now possible to define `rgw_zonemaster`,
`rgw_zonesecondary` and `rgw_zonegroupmaster` at the intsance
level instead of the whole node level.

Also, this commit adds an option `deploy_secondary_zones` (default True)
which can be set to `False` in order to explicitly ask the playbook to
not deploy secondary zones in case where the corresponding endpoint are
not deployed yet.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1915478
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 71a5e666e39b11cd7945afa28a9f6fbe7de8c2b7)

4 years agofs2bs: skip migration when a mix of fs and bs is detected
Guillaume Abrioux [Tue, 15 Dec 2020 16:49:32 +0000 (17:49 +0100)]
fs2bs: skip migration when a mix of fs and bs is detected

Since the default of `osd_objectstore` has changed as of 3.2, some
deployments might have a mix of filestore and bluestore OSDs on a same
node. In some specific cases, there's a possibility that a filestore OSD
shares a journal/db device with a bluestore OSD. We shouldn't try to
redeploy in this context because ceph-volume will complain. (either
because in lvm batch you can't pass partition or about gpt header).
The safest option is to skip the migration on the node when such a mix
is detected or force all osds including those already using bluestore
(option `force_filestore_to_bluestore=True` has to be passed as an extra var).
If all OSDs are using filestore, then they will be migrated to
bluestore.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1875777
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit e66f12d1387e7fa86138ae18d3026a1f31328b6b)

4 years agodashboard: manage password backward compatibility
Dimitri Savineau [Mon, 11 Jan 2021 16:48:53 +0000 (11:48 -0500)]
dashboard: manage password backward compatibility

The ceph dashboard changed the way the password are provided via the
CLI.
This breaks the backward compatibility when using a recent ceph-ansible
version with ceph release without that feature.
This patch adds tasks for legacy workflow (ceph release without that
feature) in ceph-dashboard role.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1915506
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
4 years agodashboard: configure passwords via stdin
Guillaume Abrioux [Thu, 7 Jan 2021 11:40:18 +0000 (12:40 +0100)]
dashboard: configure passwords via stdin

Due to recent changes in ceph, the few dashboard passwors
must be passed via `-i`

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit ef975ef5eacb14b66a8982ccb27a38ce552abcc4)

4 years agolibrary: remove containerized parameter from cv v4.0.43
Dimitri Savineau [Fri, 18 Dec 2020 15:25:54 +0000 (10:25 -0500)]
library: remove containerized parameter from cv

The ceph-volume module relies on environment variables to determine if
the command should be executed within a container or not.
The containerized parameter isn't used anymore and we can remove it.

Fixes: #6153
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 613ab11b9be8cfe2c9ef4f1e1ff12510d794c6c7)

4 years agoPath for ceph config missing in crash template
Mike Currin [Thu, 24 Dec 2020 07:25:24 +0000 (09:25 +0200)]
Path for ceph config missing in crash template

The path where ceph.conf is located (/etc/ceph) missing in the Docker container bind mounts, this throws errors

Signed-off-by: Mike Currin <currin@gmail.com>
(cherry picked from commit 4cbc9a48c9cd025df7dcd438c5bcf975868638c0)

4 years agorgw: support switching from single-site to multisite
Guillaume Abrioux [Wed, 6 Jan 2021 09:37:12 +0000 (10:37 +0100)]
rgw: support switching from single-site to multisite

When collocating rgw with either a mon, mgr or osd, switching from
single site to a multisite rgw setup failed because of the handlers
triggered between the ansible play of the collocated daemon and the play
of the rgw. Since the multisite changes are not yet applied the handlers
fail.
The idea here is to ensure we run the multisite configuration from the
ceph-handler role before the restart happens, this way it won't complain
because of non existing multisite configuration.

(Note: this is also valid when simply changing a multisite configuration)

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1888630
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 513c8cfe551da78ea89d2513dffebd9649bfeb44)

4 years agocommon: do not use pipefail when not needed v4.0.42
Guillaume Abrioux [Mon, 30 Nov 2020 16:08:18 +0000 (17:08 +0100)]
common: do not use pipefail when not needed

Let's discard the ansible lint error 306 and add a "# noqa 306" on tasks
where we don't need `set -o pipefail`

Fixes: #6090
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 86a8889ee3adffc81d3435895a7a117824e779ad)

4 years agoceph-osd: refact `docker_exec_start_osd`
Guillaume Abrioux [Fri, 2 Oct 2020 09:00:29 +0000 (11:00 +0200)]
ceph-osd: refact `docker_exec_start_osd`

This commit drops nested jinja construction in this set_fact task.
It also rename it to `container_exec_start_osd`

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit ff95fa9c32ba6cba486200d2c7734259bd50fd1b)

4 years agoworkflow/pytest: update python matrix version
Dimitri Savineau [Mon, 23 Nov 2020 14:40:46 +0000 (09:40 -0500)]
workflow/pytest: update python matrix version

On this branch we should test pytest against python 2.7 and 3.6.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
4 years agotests: use github workflow for nbsp char check
Guillaume Abrioux [Thu, 19 Nov 2020 08:13:28 +0000 (09:13 +0100)]
tests: use github workflow for nbsp char check

Let's use a github workflow instead of travis for this.

With this commit we can get rid of Travis.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 94c37b9de89ffd93449e77f7a90ad50b700fd0db)

4 years agolint: ignore 302,303,505 errors
Guillaume Abrioux [Wed, 18 Nov 2020 09:13:45 +0000 (10:13 +0100)]
lint: ignore 302,303,505 errors

ignore 302,303 and 505 errors

[302] Using command rather than an argument to e.g. file
[303] Using command rather than module
[505] referenced files must exist

they aren't relevant on these tasks.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 195d88fcda60e28e246245a1bf566b6e412b2ab3)

4 years agolint: do not use 'local_action'
Guillaume Abrioux [Fri, 2 Oct 2020 11:43:47 +0000 (13:43 +0200)]
lint: do not use 'local_action'

Fix ansible-lint 504 error:

[504] Do not use 'local_action', use 'delegate_to: localhost'

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit c948b668ebe7cf7af61090ac6f9b93e0a16e14ee)

4 years agolint: trailing whitespace
Guillaume Abrioux [Fri, 2 Oct 2020 11:40:31 +0000 (13:40 +0200)]
lint: trailing whitespace

Fix ansible-lint 201 error:

[201] Trailing whitespace

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit dfc7e6e4bdd9edf49080b59ff03ac560bd990f86)

4 years agolint: all tasks should be named
Guillaume Abrioux [Fri, 2 Oct 2020 11:38:04 +0000 (13:38 +0200)]
lint: all tasks should be named

Fix ansible-lint 502 error:

[502] All tasks should be named

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 97dd9218dd0493edc68bc9e69cb39fae8924f6dc)

4 years agolint: use shell only when shell functionality is required
Guillaume Abrioux [Fri, 2 Oct 2020 11:35:39 +0000 (13:35 +0200)]
lint: use shell only when shell functionality is required

Fix ansible-lint 305 error:

[305] Use shell only when shell functionality is required

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 11b4bf5083639abea66a874ba86ac38a1b706ca6)

4 years agolint: don't compare to literal true/false
Guillaume Abrioux [Fri, 2 Oct 2020 11:32:51 +0000 (13:32 +0200)]
lint: don't compare to literal true/false

Fix ansible lint 601 error:

[601] Don't compare to literal True/False

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 2011e4dbc8e4c90dfb60ecd4c59325782d95986c)

4 years agolint: variables should have spaces before and after
Guillaume Abrioux [Fri, 2 Oct 2020 11:05:01 +0000 (13:05 +0200)]
lint: variables should have spaces before and after

Fix ansible lint 206 error:

[206] Variables should have spaces before and after: {{ var_name }}

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 9fba6eecfa5de7415ebe6ba6a1ab496412de8eed)

4 years agolint: commands should not change things
Guillaume Abrioux [Fri, 2 Oct 2020 10:55:53 +0000 (12:55 +0200)]
lint: commands should not change things

Fix ansible lint 301 error:

[301] Commands should not change things if nothing needs doing

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 5450de58b37cb169adecd87f547551b976d4b9bf)

4 years agolint: set pipefail on shell tasks
Guillaume Abrioux [Fri, 2 Oct 2020 09:23:42 +0000 (11:23 +0200)]
lint: set pipefail on shell tasks

Fix ansible lint 306 error:

[306] Shells that use pipes should set the pipefail option

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 1879c26eb9ed46db9adfa6803ef4a03b15b6914b)

4 years agotests: use github workflow for ansible-lint
Guillaume Abrioux [Thu, 1 Oct 2020 08:23:22 +0000 (10:23 +0200)]
tests: use github workflow for ansible-lint

let's use github workflow instead of travis.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit d4400f911aee4f49f775cc04630d37e127ddd6cd)

4 years agoceph-config: fix ceph-volume lvm batch report
Dimitri Savineau [Tue, 15 Dec 2020 18:52:43 +0000 (13:52 -0500)]
ceph-config: fix ceph-volume lvm batch report

Since the major ceph-volume lvm batch refactoring, the report value
is different.
Before the refact, the report was a dict with the OSDs list to be created
under the "osds" key.
After the refact, the report is a list of dict.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 827b23353ff389660f393cb36fb36540c362e8cf)

4 years agolibrary: add ceph_osd_flag module
Dimitri Savineau [Tue, 3 Nov 2020 21:44:58 +0000 (16:44 -0500)]
library: add ceph_osd_flag module

This adds ceph_osd_flag ansible module for replacing the command module
usage with the ceph osd set/unset commands.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 5da593604a50605b228107752588a907169eb381)

4 years agoceph-iscsi: set the pool name in the config file
Dimitri Savineau [Tue, 24 Nov 2020 17:35:23 +0000 (12:35 -0500)]
ceph-iscsi: set the pool name in the config file

When using a custom pool for iSCSI gateway then we need to set the pool
name in the configuration otherwise the default rbd pool name will be
used.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 40a87c4b92c658f601b7170400d8b2cb3f849673)

4 years agocontainers: modify bindmount option
Guillaume Abrioux [Tue, 17 Nov 2020 03:35:27 +0000 (04:35 +0100)]
containers: modify bindmount option

This commit changes the bind mount option for the mount point
`/var/lib/ceph` in the systemd template for mon and mgr containers. This
is needed in case of collocating mon/mgr with osds using dmcrypt
scenario.
Once mon/mgr got converted to containers, the dmcrypt layer sub mount is
still seen in `/var/lib/ceph`. For some reason it makes the
corresponding devices busy so any other container can't open/close it.
As a result, it prevents osds from starting properly.

Since it only happens on the nodes converted before the OSD play, the idea is
to bind mount `/var/lib/ceph` on mon and mgr with the `rshared` option
so once the sub mount is unmounted, it is propagated inside the
container so it doesn't see that mount point.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1896392
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit f5ba6d9b0117d283c44cc96af1810bf4cbb29b0a)

4 years agoalertmanager/prometheus: fix owner/group
Dimitri Savineau [Wed, 25 Nov 2020 17:00:38 +0000 (12:00 -0500)]
alertmanager/prometheus: fix owner/group

Set the owner/group on alertmanager and prometheus directories and
files to nobody and nogroup (uid and gid 65534) to avoid permission
issues.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1901543
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit eb452d35bc7bae076ed7727494dc52e6528b21a3)

4 years agoswitch2containers: do not stop ceph.target in osd play
Guillaume Abrioux [Thu, 26 Nov 2020 09:11:36 +0000 (10:11 +0100)]
switch2containers: do not stop ceph.target in osd play

`ceph.target` should be disabled only. Otherwise, in collocation
scenario you stop other collocated services in the OSD play which isn't
what we want to do. Each daemon has its corresponding play for managing
the transition to container.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1901865
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 0b05620597121c6388b7fbf227fb01f8efb2bda6)

4 years agoosd: add tag on 'wait for all osd to be up' task
Guillaume Abrioux [Thu, 26 Nov 2020 08:53:04 +0000 (09:53 +0100)]
osd: add tag on 'wait for all osd to be up' task

This allows skipping this task if really desired.
Use it carefully. Use it at your own risk.

Fixes: #6073
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 5c4ae5356d9ae10573d699236897969052f77823)

4 years agorhcs: drop fetch_directory override
Dimitri Savineau [Wed, 2 Dec 2020 22:45:18 +0000 (17:45 -0500)]
rhcs: drop fetch_directory override

Since the fetch_directory variable has been dropped then we don't need
the override in rhcs file.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit a2cbab16a41dfa8508ebac6fb4c1c8053a4eb6ff)

4 years agoceph-mon: No become during gen mon initial keyring
Jukka Nousiainen [Wed, 2 Dec 2020 09:07:25 +0000 (11:07 +0200)]
ceph-mon: No become during gen mon initial keyring

Since the backing generate_secret() just hands out urandom output,
running as privileged doesn't seem to be required. It's not
desireable to provide sudo in some Ansible runner environments.

Signed-off-by: Jukka Nousiainen <jukka.nousiainen@csc.fi>
(cherry picked from commit eb7473491b25c5f899a110f6ae1076ef5096d6d5)

4 years agoRevert "config: Always use osd_memory_target if set"
Dimitri Savineau [Wed, 9 Dec 2020 19:02:45 +0000 (14:02 -0500)]
Revert "config: Always use osd_memory_target if set"

This reverts commit 4d1fdd2b05d55f8028fb5593d41fa61dbddd7095.

This breaks the backward compatibility with previous osd_memory_target
calculation and we could have a value lower than the minimum value allowed
(896M) which causes some ceph commands to fail (like ceph assimilate-conf).

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit aa6e1f20eaa5272ff0bb5e8b3cded16273aa120c)

4 years agoceph-osd: use global crush_device_class in lvm_volumes
Seena Fallah [Sat, 5 Dec 2020 21:55:46 +0000 (01:25 +0330)]
ceph-osd: use global crush_device_class in lvm_volumes

Use global crush_device_class variable if it's not set per OSD

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit 5e9444fa5c283587d38e823012c5bfdb434a8f2c)

4 years agofix broken ceph-fetch-keys role
Karl-Heinz Preuß [Thu, 26 Nov 2020 09:48:49 +0000 (10:48 +0100)]
fix broken ceph-fetch-keys role

set fetch_directory variable in default/main.yml instead of using the
defaults jinja filter in tasks/main.yml.

Fixes: #6072
Signed-off-by: Karl-Heinz Preuß <karl-heinz.preuss@cms.hu-berlin.de>
(cherry picked from commit 6ce34ef59fe33874ae7876d27b991e23c6281fdb)

4 years agogroup_vars: remove useless files
Dimitri Savineau [Tue, 14 Jan 2020 19:08:17 +0000 (14:08 -0500)]
group_vars: remove useless files

Delete legacy files that aren't used anymore.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit e790b0851d3d2a4b98d75d7a5ae4006aebd56e0e)

4 years agocommon: drop `fetch_directory` feature
Guillaume Abrioux [Tue, 6 Oct 2020 05:53:06 +0000 (07:53 +0200)]
common: drop `fetch_directory` feature

This commit drops the `fetch_directory` feature.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 1cc9666c09c616cc743b4f2f05d2b52cfd6c32cb)

4 years agoceph-config: ceph.conf rendering refactor
Guillaume Abrioux [Mon, 5 Oct 2020 15:41:20 +0000 (17:41 +0200)]
ceph-config: ceph.conf rendering refactor

This commit cleans up the `main.yml` task file of `ceph-config`.
It drops the local ceph.conf generation.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 900c0f44925ec0c6c1acb16433044ac40717e00e)

4 years agotests: rgw_multisite playbook test refactor
Guillaume Abrioux [Fri, 11 Dec 2020 13:36:00 +0000 (14:36 +0100)]
tests: rgw_multisite playbook test refactor

Currently we create an object from the primary sites but we try to read
that object still from the master which doesn't make sense, we should
try to read it from a secondary site.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit e2ea403d5ef938a3ea12276004eaa71f9919a4a3)

4 years agomergify: add mergify configuration
Guillaume Abrioux [Tue, 15 Dec 2020 09:03:33 +0000 (10:03 +0100)]
mergify: add mergify configuration

This adds mergify configuration file on `stable-4.0` branch so we can
get backports automatically created by mergify.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
4 years agomon: refact initial keyring generation 4.2rc v4.0.41
Guillaume Abrioux [Tue, 24 Nov 2020 10:33:46 +0000 (11:33 +0100)]
mon: refact initial keyring generation

adding monitor is no longer possible because we generate a new mon
keyring each time the playbook is run.

Fixes: #5864
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1902281
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 970c6a4ee6923588adb81d8c49185ff8e340d52e)

4 years agoceph_key: set state as optional
Dimitri Savineau [Fri, 11 Sep 2020 13:34:05 +0000 (09:34 -0400)]
ceph_key: set state as optional

Most ansible module using a state parameter default to the present
value (when available) instead of using it as a mandatory option.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit abb4023d762305c368facd3fab5a5b7e3a839d66)

4 years agoceph_key: support using different keyring
Guillaume Abrioux [Sat, 3 Oct 2020 04:56:06 +0000 (06:56 +0200)]
ceph_key: support using different keyring

Currently the `ceph_key` module doesn't support using a different
keyring than `client.admin`.
This commit adds the possibility to use a different keyring.

Usage:
```
      ceph_key:
        name: "client.rgw.myrgw-node.rgw123"
        cluster: "ceph"
        user: "client.bootstrap-rgw"
        user_key: /var/lib/ceph/bootstrap-rgw/ceph.keyring
        dest: "/var/lib/ceph/radosgw/ceph-rgw.myrgw-node.rgw123/keyring"
        caps:
          osd: 'allow rwx'
          mon: 'allow rw'
          import_key: False
        owner: "ceph"
        group: "ceph"
        mode: "0400"
```

Where:
`user` corresponds to `-n (--name)`
`user_key` corresponds to `-k (--keyring)`

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 12e6260266dec04b4b2d25f3508aa7149fd16714)

4 years agolibrary: Fix new-style modules check mode
Benoît Knecht [Tue, 1 Sep 2020 11:06:57 +0000 (13:06 +0200)]
library: Fix new-style modules check mode

Running the `ceph_crush.py`, `ceph_key.py` or `ceph_volume.py` modules in check
mode resulted in the following error:

```
New-style module did not handle its own exit
```

This was due to the fact that they simply returned a `dict` in that case,
instead of calling `module.exit_json()`.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit 85dd4058145436e86a12ad9f015f5228189437d5)

4 years agoceph_key: refact the code and minor fixes
Guillaume Abrioux [Tue, 4 Aug 2020 11:53:24 +0000 (13:53 +0200)]
ceph_key: refact the code and minor fixes

This commit refactors the code to remove a duplicate condition and it
makes the `state: absent` code idempotent

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 13e2311cbe78b7b51930a3a1210629bf036a20c5)

4 years agoRevert "library: Fix new-style modules check mode"
Guillaume Abrioux [Fri, 27 Nov 2020 07:53:55 +0000 (08:53 +0100)]
Revert "library: Fix new-style modules check mode"

This reverts commit bff21234303b9086dd8a352b52f2f47c5f3d2251.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
4 years agoRevert "ceph_key: support using different keyring"
Guillaume Abrioux [Fri, 27 Nov 2020 07:53:48 +0000 (08:53 +0100)]
Revert "ceph_key: support using different keyring"

This reverts commit 74eb7cbecbeff1e96d261d69246d04d183783241.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
4 years agoiscsigw: remove `--cap-add=all` from `podman run` cmd
Guillaume Abrioux [Mon, 30 Nov 2020 13:55:16 +0000 (14:55 +0100)]
iscsigw: remove `--cap-add=all` from `podman run` cmd

As of podman `2.0.5`, `--cap-add` and `--privileged` are exclusive
options.

```
Nov 30 13:56:30 magna089 podman[171677]: Error: invalid config provided: CapAdd and privileged are mutually exclusive options
```

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1902149
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit d40dd764e004f9765e5d4e12507cdf3c707a3271)

4 years agocontainer: remove `--ignore` from `podman rm` command
Guillaume Abrioux [Mon, 30 Nov 2020 13:52:47 +0000 (14:52 +0100)]
container: remove `--ignore` from `podman rm` command

As of podman 2.0.5, `--ignore` param conflicts with `--storage`.
```
Nov 30 13:53:10 magna089 podman[164443]: Error: --storage conflicts with --volumes, --all, --latest, --ignore and --cidfile
```

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit c68b124ba89e0e4e7c4845b6dd1ce98be8e074d4)

4 years agocommon: add a default value for ceph_directories_mode
Guillaume Abrioux [Tue, 21 Jan 2020 14:30:16 +0000 (15:30 +0100)]
common: add a default value for ceph_directories_mode

Since this variable makes it possible to customize the mode for ceph
directories, let's make it a bit more explicit by adding a default value
in ceph-defaults.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 483adb5d790ea74db01154b7dacbbf2bef030acc)

4 years agoosd: ensure /var/lib/ceph/osd/{cluster}-{id} is present
Guillaume Abrioux [Tue, 17 Nov 2020 09:45:14 +0000 (10:45 +0100)]
osd: ensure /var/lib/ceph/osd/{cluster}-{id} is present

This commit ensures that the `/var/lib/ceph/osd/{{ cluster }}-{{ osd_id }}` is
present before starting OSDs.

This is needed specificly when redeploying an OSD in case of OS upgrade
failure.
Since ceph data are still present on its devices then the node can be
redeployed, however those directories aren't present since they are
initially created by ceph-volume. We could recreate them manually but
for better user experience we can ask ceph-ansible to recreate them.

NOTE:
this only works for OSDs that were deployed with ceph-volume.
ceph-disk deployed OSDs would have to get those directories recreated
manually.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1898486
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 873fc8ec0ff12fa1d1b45c5400050f15d0417480)

4 years agoceph-facts: fix read osd pool default crush fact v4.0.40
Dimitri Savineau [Wed, 18 Nov 2020 15:43:57 +0000 (10:43 -0500)]
ceph-facts: fix read osd pool default crush fact

We don't need to use run_once on that task when having running monitors
otherwise the read task could be skip and the set task will fail.

The conditional check 'crush_rule_variable.rc == 0' failed. The error
was: error while evaluating conditional (crush_rule_variable.rc == 0):
'dict object' has no attribute 'rc'

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1898856
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit e150df789edb966549ba2a8f2415a844ce612d46)

4 years agotests: use github workflow for pytest
Dimitri Savineau [Fri, 23 Oct 2020 14:24:50 +0000 (10:24 -0400)]
tests: use github workflow for pytest

Move the pytest testing from TravisCI to Github workflow.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 3e79f0322a703003ab1af51104b69a1d2162951e)

4 years agotests: enforce pytest-rerunfailures version
Guillaume Abrioux [Wed, 1 Jul 2020 16:22:00 +0000 (18:22 +0200)]
tests: enforce pytest-rerunfailures version

This commit enforces the pytest-rerunfailures installed so it's <9.0

This is to avoid the following error:

```
ERROR: pytest-rerunfailures 9.0 has requirement pytest>=5.0, but you'll have pytest 4.6.11 which is incompatible.
```

latest version of pytest-rerunfailures isn't compatible with the version
of pytest we are using.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 19097026fbda71752a500119b0c99c1a9f8d523d)

4 years agocontainer: force rm --storage on ExecStartPre v4.0.39
Guillaume Abrioux [Thu, 12 Nov 2020 10:34:41 +0000 (11:34 +0100)]
container: force rm --storage on ExecStartPre

This is a workaround to avoid error like following:
```
Error: error creating container storage: the container name "ceph-mgr-magna022" is already in use by "4a5f674e113f837a0cc561dea5d2cd55d16ca159a647b7794ab06c4c276ef701"
```

that doesn't seem to be 100% reproducible but it shows up after a
reboot. The only workaround we came up with at the moment is to run
`podman rm --storage <container>` before starting it.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1887716
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 5ba7824c55e4a5d6732208859293ac3f47bb54a2)

4 years agoswitch2container: chown symlink in mon/mgr plays
Dimitri Savineau [Mon, 16 Nov 2020 15:31:11 +0000 (10:31 -0500)]
switch2container: chown symlink in mon/mgr plays

fa2bb3a only fix the symlink owner/group issue in the OSD play. If the
OSDs are collocated with other services like MONs and MGRs then the
chown command will fail.

$ find /var/lib/ceph/osd/ceph-0 -not -user 167 -execdir chown 167:167 {} +
chown: cannot dereference './block': Permission denied

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1896448
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 35ed9977aac9afbcad4f726a865891f0e84b4680)

4 years agoconfig: Always use osd_memory_target if set
Gaudenz Steinlin [Mon, 28 Oct 2019 09:41:26 +0000 (10:41 +0100)]
config: Always use osd_memory_target if set

The osd_memory_target variable was only used if it was higher than the
calculated value based on the number of OSDs. This is changed to always
use the value if it is set in the configuration. This allows this value
to be intentionally set lower so that it does not have to be changed
when more OSDs are added later.

Signed-off-by: Gaudenz Steinlin <gaudenz.steinlin@cloudscale.ch>
(cherry picked from commit 4d1fdd2b05d55f8028fb5593d41fa61dbddd7095)

4 years agoceph-facts: Fix osd_pool_default_crush_rule fact
Benoît Knecht [Wed, 7 Oct 2020 07:44:29 +0000 (09:44 +0200)]
ceph-facts: Fix osd_pool_default_crush_rule fact

The `osd_pool_default_crush_rule` is set based on `crush_rule_variable`, which
is the output of a `grep` command.

However, two consecutive tasks can set that variable, and if the second task is
skipped, it still overwrites the `crush_rule_variable`, leading the
`osd_pool_default_crush_rule` to be set to `ceph_osd_pool_default_crush_rule`
instead of the output of the first task.

This commit ensures that the fact is set right after the `crush_rule_variable`
is assigned, before it can be overwritten.

Closes #5912

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit c5f7343a2f696ab3bfef77e735eafdeae4e4883b)

4 years agomain: followup on pr 6012
Guillaume Abrioux [Thu, 12 Nov 2020 14:19:42 +0000 (15:19 +0100)]
main: followup on pr 6012

This tag can be set at the play level.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 2fa17520c425117f87048a1d555c2e73c9e6cf6e)

4 years agoAdd ceph_client tag to execute or skip the playbook
Francesco Pantano [Mon, 9 Nov 2020 16:25:17 +0000 (17:25 +0100)]
Add ceph_client tag to execute or skip the playbook

There are some use cases where there's a need to skip the execution
of the ceph-ansible client role even though the client section of the
inventory isn't empty.
This can happen in contexts where the services are colocated or when
a all-in-one deployment is performed.
The purpose of this change is adding a 'ceph_client' tag to avoid
altering the ceph-ansible execution flow but at the same time be able
to include or exclude a set of tasks using this tag.

Signed-off-by: Francesco Pantano <fpantano@redhat.com>
(cherry picked from commit fafd5f871a81f5e8cdba6e531e499a9678b2dcad)

4 years agoswitch2container: disable ceph-osd enabled-runtime v4.0.38
Dimitri Savineau [Mon, 19 Oct 2020 21:22:31 +0000 (17:22 -0400)]
switch2container: disable ceph-osd enabled-runtime

When deploying the ceph OSD via the packages then the ceph-osd@.service
unit is configured as enabled-runtime.
This means that each ceph-osd service will inherit from that state.
The enabled-runtime systemd state doesn't survive after a reboot.
For non containerized deployment the OSD are still starting after a
reboot because there's the ceph-volume@.service and/or ceph-osd.target
units that are doing the job.

$ systemctl list-unit-files|egrep '^ceph-(volume|osd)'|column -t
ceph-osd@.service     enabled-runtime
ceph-volume@.service  enabled
ceph-osd.target       enabled

When switching to containerized deployment we are stopping/disabling
ceph-osd@XX.servive, ceph-volume and ceph.target and then removing the
systemd unit files.
But the new systemd units for containerized ceph-osd service will still
inherit from ceph-osd@.service unit file.

As a consequence, if an OSD host is rebooting after the playbook execution
then the ceph-osd service won't come back because they aren't enabled at
boot.

This patch also adds a reboot and testinfra run after running the switch
to container playbook.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1881288
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit fa2bb3af86b48befd3901939d38eda20dff6f5e5)

4 years agodashboard: change dashboard_grafana_api_no_ssl_verify default value 6010/head
Guillaume Abrioux [Tue, 3 Nov 2020 15:32:17 +0000 (16:32 +0100)]
dashboard: change dashboard_grafana_api_no_ssl_verify default value

This sets the `dashboard_grafana_api_no_ssl_verify` default value
according to the length of `dashboard_crt` and `dashboard_key`.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 5cadfea42e8dd31e019568cdfe1b0f3d64f5dcc4)

4 years agodashboard: enable https by default
Guillaume Abrioux [Tue, 3 Nov 2020 12:49:59 +0000 (13:49 +0100)]
dashboard: enable https by default

see linked bz for details

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1889426
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 767d3c898e2d8f7dddb655fd98827d5da8b338e8)