Commit Graph

126 Commits

Author SHA1 Message Date
Andrew Bonney 2bb6cdf481 Don't load systemd parent service for object cache
We use the systemd_service role to load a drop-in for all
services which fall under the 'ceph-immutable-object-store'
banner, but this isn't a service in its own right.

Attempting to load the service on Ubuntu Jammy results in
an error, so we prevent loading it, and leave enabling of the
individual service up to an existing later task.

Change-Id: If9c46d22f42bc3765b217b0fbc736331bf337557
2024-02-12 13:51:03 +00:00
Dmitriy Rabotyagov 721e96f145 Align extra conf files mode
When placing ceph_extra_confs files to their destination, they're being
assigned mode 0644 with root:root ownership. However, when we're overriding
some sections in config files, we also accidentally change mode of these
files to 0640 which makes issues while reading them by clients and
makes role not idempotent.

This issue was introduced by this commit [1]

[1] https://review.opendev.org/c/openstack/openstack-ansible-ceph_client/+/888216

Change-Id: I5fe0fff9616e0829b83f61bd1b062cfd978543d6
2024-01-18 09:55:37 +01:00
Zuul 43c9071f4f Merge "Allow to distribute custom key with the role" 2023-10-10 11:34:38 +00:00
Andrew Bonney 5351a2a96d Add AppArmor configuration for ceph read/write caching
When Ceph read/write caching uses paths which aren't already
covered by the libvirt/qemu apparmor rules then additional
configuration is required to ensure VMs don't fail to boot.

Change-Id: I2dff4bf54191b763e25625aa7a10bceaa1f6e595
2023-10-09 12:54:20 +01:00
Dmitriy Rabotyagov eb27ca0874 Allow to distribute custom key with the role
Right now we have quite strong assumption that `nova_ceph_client` should be
present among clients to fetch. At the same time, in case the role is
included outside of the OSA context, ceph_client_filtered_clients might
not contain all users we expect to see.

With that we alter the logic to fetch nova key not only when role is launched
against compute host, but also when the client is present in the list.

Change-Id: I7810881a01b9d2f3d98a6c3ad590b9ea63358011
2023-10-02 15:10:43 +02:00
Dmitriy Rabotyagov 05e3c0f183 Apply tags to included tasks
In order to be able to use tags to run systemd_service role solely,
they must be applied properly when role is included.

Change-Id: Ic382ddfc0e79e3b9dfdeeaabdf131466127756f2
2023-07-13 13:02:41 +00:00
Dmitriy Rabotyagov 94a58e398b Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: Idb2dd6cd4bbf815e4b32c9bfbe9a66f33e1c4b97
2023-07-13 11:44:20 +00:00
Dmitriy Rabotyagov d9c1289b7a Fix retrievement keyrings from files
With [1] usage of custom owner/group has been introduced. It
converted client to be a list of mappings but it was missed in 1 place.

[1] fdd2aaa00b
Closes-Bug: #2024339

Change-Id: Icfc16ca25f0b6b45a0de0bcdf4eac71ab302a120
2023-06-19 14:43:20 +02:00
Jonathan Rosser 496cc94cc7 Add config and documentation for ceph perisistent write log cache
Change-Id: I7024e52c4750d4fd7b205cc2376d73bde7b4c11b
2023-05-18 12:26:18 +01:00
Jonathan Rosser 9ee3bb24f6 Add ceph client and configuration for immutable object cache
See [1] for details of this ceph component. Optionally deployed
on nova-compute nodes to accellerate access to read-only data
for volumes created from snapshots.

[1] https://docs.ceph.com/en/latest/rbd/rbd-persistent-read-only-cache/

Change-Id: I34f2f403d03cc95f593f21c717609b9858b8d989
2023-05-18 10:20:12 +00:00
Jonathan Rosser fdd2aaa00b Allow ceph client keyring files to have custom owner/group/mode
This is required for a future patch enabling the ceph
immutable object cache.

Change-Id: Ifd78224acf389200a79aea25461b499a7c0da5d1
2023-05-10 14:32:59 +01:00
Zuul 420e837631 Merge "Improve regexp for fetching nova secret from files" 2023-04-13 16:22:08 +00:00
Zuul 9b3bccccf2 Merge "Unify EPEL gpg key and repo provisioning" 2023-04-04 13:50:14 +00:00
Dmitriy Rabotyagov 7a70556e15 Unify EPEL gpg key and repo provisioning
At the moment we do install EPEL repo in multiple other roles, like
lxc_hosts or systemd_mount. We're trying to be consistent in ways
of adding them, while ceph_client was slightly different, by carrying on
GPG keys in-repo instead of fetching them from `centos_epel_key` url.

With this patch we unify approach with other roles and reducing
maintenance costs of the repo when adding new distributions

Change-Id: I407256dc6eee3365c4f8c191a1f50717f0b35fa8
Related-Bug: #2013276
2023-03-30 21:16:28 +02:00
Dmitriy Rabotyagov f2a40ab1cd Add thrift to includepkgs from EPEL
Latest ceph releases also require thrift package to be installed,
which is provided by EPEL. We add the package of allowed ones
to come from EPEL.

Change-Id: Id2cd34bf88efbda9ba37710d1052a6f54249b5bf
Closes-Bug: #2013276
2023-03-30 21:05:41 +02:00
Dmitriy Rabotyagov f69d7e922e Improve regexp for fetching nova secret from files
At the moment regexp we have does require keyring to contain only
key option. If that is full ceph authx file that does also contain
caps, regexp will grab them as well, which will result in a play failure

This patch does improve regexp to grab only key regardless of all other
content that can be present in the file.

Change-Id: I176fbcd4901dfacd4b608fac4d4fbd256d263b2a
2023-02-28 12:57:19 +00:00
Marcus Klein e7ebbeb5da Define libvirt secrets from keyring files in ceph_extra_confs
Previously this required always access to the mon_host of the Ceph
cluster to fetch the key for volume access. Now this key can be defined
through Ceph keyring files.

Change-Id: Ib2c755d38038b14ca3803de1bb9cbcec122eaa83
2022-12-16 13:25:49 +01:00
Marcus Klein 4054d737dd Use correct index of previous task results
Change-Id: I450515395a510e40debfcdeb04fd98169a7a835e
2022-12-16 11:24:48 +01:00
Marcus Klein 6bdf19df35 Ensure role not fail when secret_uuid is not part of ceph_extra_confs
Most tasks already check whether secret_uuid is defined but cleanup
tasks do this not and fail.

Change-Id: I31471907cafde83d73c8fa23bca377955523ec71
2022-12-08 11:12:34 +01:00
Erik Berg edbd5268d3 Remove redundant vars line
This line snuck in with I0a8fda2e71e80624edbe271139675a71196b23ef
probably to bring it in line with other OSA roles, but should already
be covered by the distribution_major_version line above.

Change-Id: Icf9258e9f7c37e7ae34f6924fae432f15487b260
2022-09-15 09:10:22 +02:00
Dmitriy Rabotyagov b555c1b8c5 Do not delegate facts when fetching keyrings
At the moment if multiple clusters are used, like for AZ deployments
when cinder should connect to different ceph clusters, if
ceph_keyrings_dir defined per group_var or host_var, ceph_client_keys
will get defined multiple times each time overriding previous value,
as facts are delegated to the localhost. In order to avoid such
behaviour we  define ceph_client_keys for host that delegates job
instead. This way value won't be overwriten and host_vars will be
respected.

Change-Id: I5109322a4ee805f9c0b53142a0e98d3f0aa2d3a5
2022-08-10 10:53:13 +02:00
Dmitriy Rabotyagov b3e7560e80 Provide opportunity to define cluster_name
In some cases, like AZ scenarios, deployments may interact with
several clusters at a time, while they will be distinguished by
the cluster_name. However, ceph_client role now assumes that
cluster name is `ceph` without any way to override such assumption.

Change-Id: I9dcad1e1c63294f4f59a1755507904808acb785e
2022-08-10 07:07:16 +02:00
Dmitriy Rabotyagov 04714473a8 Drop duplicated group creation tasks
Exact same tasks are define in tasks/ceph_auth.yml and should cover
needs.
So we can simply avoid running same set of tasks.

Change-Id: I30593660dc6ebab46e20b680b321e3c97315bff4
2022-05-18 13:59:02 +02:00
Zuul e0141577da Merge "Simpify selection of the python interpreter." 2022-02-03 19:28:39 +00:00
Jonathan Rosser 1c427078c2 Simpify selection of the python interpreter.
We only support python3 so remove the logic supporting python2

Change-Id: I2bfbd657bf7ed5b042c3640586d8ae80c5b85136
2022-02-02 04:41:28 -05:00
Jonathan Rosser 3482f1b4d7 Refactor use of include_vars
Use a first_found lookup instead of a with_first_found loop so that
the 'paths' parameter can be used.

This ensures that only vars from the role are included, and not vars
from a parent calling role. This can happen when a parent role has
a higher priority vars file available for inclusion than the role
it calls.

Change-Id: I0a8fda2e71e80624edbe271139675a71196b23ef
2022-01-12 08:51:26 +00:00
Dmitriy Rabotyagov 93ca6c6d69 Use config_template as a collection
Since we still use ceph-ansible that has their own implementation of
config_template module it's worth to use mentioned module as a collection
explicitly.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/819814



Change-Id: Iee883f6d9240918c9168a7cd7c6b9dbce02eabfc
2021-11-30 15:17:09 +02:00
Dmitriy Rabotyagov ae7cdd2a97 Ensure role not fail when mon_host is not part of ceph_extra_confs
Currently we do not check if mon_host is defined and part of
ceph_extra_confs while attempting to remove files created by previous
steps. This causes failure since keys are not defined and are not required

Change-Id: Id41f9eef3408b75dc1b58a94442910b0394be062
Closes-Bug: #1939454
2021-10-19 17:08:40 +03:00
Dmitriy Rabotyagov 5c686751cb Enable fmt package instalaltion from EPEL
Ceph requires fmt package to be installed for CentOS, which is provided
by EPEL nowadays. So we extend list of packages that needs
to be installed from EPEL.

Change-Id: Idabce1111690b74617f825dfa843c835f53db368
Closes-Bug: #1936182
2021-07-14 17:01:28 +03:00
Jonathan Rosser e4d8d7836e Remove references to unsupported operating systems
All references to Gentoo, SUSE, Debian stretch and Centos-7  are removed.
Conditional tasks, ternary operators and variables are simplified where possible
OS specific variables files are generalised where possible

Change-Id: I8ccd8ef5cbb4a29b782418ffa33e635962f0941e
2021-03-21 21:06:47 +01:00
Marc Gariepy 8948abae9a Fix Remove revoked ceph apt-keys
when running the playbook it does appens that the apt_key task fails.
let's retry in case of failure to mimic the apt-key add that runs later.

Change-Id: Ie745496f515af1461bb8d03ba6b5c7cac5e71150
2021-03-04 14:55:03 -05:00
Jonathan Rosser 8e7d64641c Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I46311bb1fafb9d5c401c4899aab64d562117d658
2021-02-23 19:35:36 +00:00
Dmitriy Rabotyagov 097673afa8 Allow to proceed with role if ceph_conf_file is set
We shouldn't stop role execution if ceph_mons is an epty list, since
deployer can provide ceph_conf_file and keys instead.

Change-Id: I35b23e266aa9c5e29e79ea040994039e47242c9c
2020-10-06 14:33:45 +00:00
Jonathan Rosser 05de11a024 Fix linter errors
Add noqa on two occasions, see http://paste.openstack.org/show/798684/

Depends-On: https://review.opendev.org/756244
Change-Id: I508ce393cf31e6f0fd8df2bd72e19fcadc62ee65
2020-10-06 13:45:51 +00:00
Erik Berg 4aa644c110 Remove cleanup logic for trailing '/'
Cleans up logic from
https://review.opendev.org/#/c/736977/4

Change-Id: I7e1748e1dc3dfd4cde0ca6904030f2efc17dfed0
2020-09-04 15:51:01 +02:00
Erik Berg 0255bef843 Remove trailing '/' from ceph_apt_repo_url
This little trailing '/' results in a duplicate entry for ceph packages
if the repository has already been set up by ceph-ansible.  This patch
removes the entry with the trailing '/' (for convenience) and matches
what ceph-ansible does.

Change-Id: I445a3fcc5cec1234c2282eacf1e0704c5a0df11b
2020-08-27 12:54:33 +02:00
Dmitriy Rabotyagov b0cde5f695 Add centos8 epel GPG key
This also fixes EPEL url for CentOS 8

Change-Id: Ic6dc92895d2b35a955424de9ace485e3a894aaf8
2020-07-29 15:19:16 +03:00
Marc Gariepy 662bf12050 Cleanup ansible_python_interpreter
ansible_pyhton_interpreter is set to auto, it's not needed anywhere now.

Change-Id: I0faf571466d0c5ea95a96517af5363f6725f7c99
2020-06-17 11:14:23 -04:00
Dmitriy Rabotyagov d572e873df Do not try to connect to mons when everything is provided
We shouldn't try to access monitors in case deployer has provided both
ceph config and ceph auth.
So that deployers wouldn't have to provide access to their ceph clusters
to the deploy host.

Change-Id: If0b4319826abd8991a81d39ca049e8063a667685
2020-04-28 21:32:04 +03:00
Dmitriy Rabotyagov 1fa727160c Be more specific about python binary to use
Since python3 may be used as default bython and symlinked to
/usr/bin/python we should be more specific about what python to use.

Change-Id: I293c4e0bb6d7ede80c3f879f26fa005f75f2c33a
2020-02-06 17:54:27 +02:00
Dmitriy Rabotyagov 028ec5225d Fix facts gathering for "from files" scenario
delegate_facts should be used as futher we're asking these facts from
localhost, while they will be assigned to original host.
Also _keys are supposed to be dict, but defined as list and `client`
is expected instead of `item`

Change-Id: I719016f454427fcc751d872408c44d665278a0d0
Closes-Bug: 1860572
2020-01-22 17:44:18 +02:00
Dmitriy Rabotyagov b9610ff808 Use print function
In py3 usage of print as a fucntion instead of a stetement is a
hard requirement. This patch fixes symlink of python ceph libraries.

Change-Id: I07db988f607b8f4ab041437edff2903a8e07e381
2020-01-15 16:45:53 +00:00
Zuul ec77f7a895 Merge "Importing keyrings from files rather than from mons" 2019-12-02 23:34:11 +00:00
Mikael Loaec db3e9536d4 Importing keyrings from files rather than from mons
This change permits users to specify a directory where the keyrings are
located.
It is useful when openstack-ansible have no ssh access to the ceph
cluster.

Change-Id: I6693a7f9d0bc7fe1e20eee53a96de8df8985e148
2019-11-28 17:30:07 +01:00
Zuul 93cf14c3ff Merge "Add ceph.conf override option" 2019-11-21 11:43:44 +00:00
Dmitriy Rabotyagov b9b1275917 Add ceph.conf override option
This commit implements option to partially override ceph.conf with regular
config_template action plugin.

Change-Id: I60cc9d3a4dde0483aa92714a521675a26ad9cd78
2019-11-20 17:39:13 +00:00
ShangXiao 9d373171c8 Fix a typo in yml file
Change-Id: I3348a07f4c34fd25c52df42af2661c027102d0f8
2019-11-19 16:24:32 +08:00
Jonathan Rosser 31cf98b69a Ensure python libs are linked to service venvs consistently
Several different libraries are linked and some had hardcoded python2.7
paths, which are now auto-detected.

In addition, the detected python interpreter is always used rather than
sometimes being hardcoded to 'python'.

Change-Id: Ibe512c614e1a830b7b160e45c970b953a4d08e23
2019-09-07 19:34:25 +01:00
Jonathan Rosser 76c3a4eb6b Remove deprecated use of tests as filters
Change-Id: I1b7a1a4afcfce45ac9c04abef1e30625d9f49d9b
2019-05-12 17:07:52 +00:00
Zuul 907c62d37d Merge "yum: add liboath to packages installed from EPEL" 2019-04-26 20:30:22 +00:00