Commit Graph

91 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov cf3bb3b46b Set correct permissions for rootwrap.d
Recursive task against /etc/cinder/rootwrap.d set directory permissions
to 0640 as well, which is not really valid. Also it was not idempotent
with dir creation from pre-install step.

Change-Id: Idbd09c78943d954f42f89acce40096c3754024be
2024-04-30 20:55:07 +02:00
Dmitriy Rabotyagov dc5845335d Define lock directory for oslo_concurrency
With [1] it become required to define lock directory for oslo_concurrency
which was missing previously.

[1] https://review.opendev.org/c/openstack/os-brick/+/814139

Change-Id: Ibe3eb5d50f8e0904d73b93713dda2be0a6b38df7
2024-04-02 13:28:33 +02:00
Zuul 2b0da5f562 Merge "Fix linters and metadata" 2023-08-14 10:37:13 +00:00
Dmitriy Rabotyagov cf448d95c5 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.

Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/888223
Change-Id: Ifb3711157e77d5c917d05e4a384dead2abe72a7c
2023-07-14 14:56:14 +02:00
Dmitriy Rabotyagov bf912df1e3 Apply tags to systemd_service include
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: I121167e87b7aa68a75af17cbde084de5b1961264
2023-07-13 14:58:22 +02:00
Dmitriy Rabotyagov f7c7e4864e Ensure service is restarted on unit file changes
At the moment we don't restart services if systemd unit file is changed.

We knowingly prevent systemd_service role handlers to execute
by providing `state: started` as otherwise service will be restarted twice.
With that now  we ensure that role handlers will also listen for systemd
unit changes.

Change-Id: I5a52c0de14ee3a6215edb64dbc3bd48512d57e2e
Closes-Bug: #2009029
2023-04-07 08:27:38 +00:00
Dmitriy Rabotyagov ee521f91f2 Stop using need_service_restart local fact
We can reduce complexity of logic on when to restart glance as we
anyway leverage in-role handlers to restart service when needed.

Patch adds also triggering service restart when install_packages
are changed.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/866693
Change-Id: Ieeeb9bc3b8922700e0c70f150cf1af0a75c805ea
Needed-By: https://review.opendev.org/c/openstack/openstack-ansible/+/866126
2022-12-06 12:53:09 +01:00
Dmitriy Rabotyagov 887a59256e Use systemd_mount native syntax for mounts
Currently we have bunch of limitations related to the format
of ``glance_nfs_client``. While systemd_mount role is flexible enough
to allow mount cephfs or s3fs, variable format has weird assumptions
that we want to change for better flexability.

Since keys of variable are changing, new name for it was picked to
reflect purpose of the variable better.

Change-Id: Ic0d91a3a873b4253255beac79becf01b4a304695
2022-04-12 12:56:38 +02:00
Dmitriy Rabotyagov 0af66c540f Stop managing NFS mount destinations
Systemd mount role now takes care of creating mount destinations
so there is no reason to handle this manually.

In addition to that, if user/group were not provided explicitly to the
ones set for NFS export, role was failing with permission denied
during re-run

Change-Id: Ib158e14c6f296795bb1f6eabdcfc23b80cbcd871
2021-12-09 16:14:42 +00:00
Jonathan Rosser 7f2614ce4e 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: Id4f43e11bb02733b90f8bdf49e86f7a37656c68f
2021-03-10 12:16:38 +00:00
Jonathan Rosser ae6c72997c Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I03b51e2cf342b8b1434503f2bd0f4b30dcd5258e
2021-02-23 18:05:14 +00:00
Dmitriy Rabotyagov ed736fd783 Cleanup glance-registry service
Glance-registry service has been removed in V cycle with [1]

We do all necessary cleanup to fully remove service deployment.

[1] https://review.opendev.org/738671/

Change-Id: I0b2e2e39040fd0daef04724f94a39f2d11e4d105
2020-07-07 07:30:17 +03:00
Dmitriy Rabotyagov 4e966b4f4a Drop duplicated keys
Change-Id: Ib8def3441b6c3a634cbb53a44d295b71586fed8a
2019-10-16 17:32:20 +03:00
Panagiotis Karalis c27d0123ab Turn the filesystem directory to be configurable
Update the ownership of the directory about NFS mount point(s).

This patch could be also stand as an improvement for future use.

Making the filesystem directory configurable, we are able to store
the image in the different directory (or in a new path) under
glance_system_user_home repo, which is able to be configured
dynamically, for instance, via deployment of a scenario.

Change-Id: I7403ac9bd85ea3ed149e13cb57c51039602f6ba1
Signed-off-by: Panagiotis Karalis <pkaralis@intracom-telecom.com>
2019-09-19 19:45:04 +03:00
Zuul ae681ded4e Merge "Allow venv python interpreter to be overridden" 2019-09-10 05:03:16 +00:00
Jonathan Rosser a46cb9cfb2 Allow venv python interpreter to be overridden
Change-Id: I31d0d5bb3f65006a8b4b617aba70c3524df6e255
2019-09-05 17:34:23 +01:00
Dmitriy Rabotyagov 4b2724b44b Start using uWSGI role
Move service to use uWSGI role instead of iternal task for uwsgi
deployment. This aims to ease the maintenance of uWSGI and speedup
metal deployments as the same uwsgi environment will be used
across all services.

Depends-On: https://review.opendev.org/678025/
Change-Id: I6f129940e55130c289d94138171cee54dbd28fc1
2019-09-04 15:32:08 +03:00
Dmitriy Rabotyagov 002d2a91ea Use systemd-journald instead of log files
This patch aims to migrate service from usage of regular syslog files
to journald. We also disable uwsgi logging, since it dublicates
requests that are logged by service itself.

Change-Id: I12c5a117d9ca508f24a36a477d2d71c36e6c8c96
2019-07-16 16:09:28 +03:00
Dmitriy Rabotjagov a70275c653 Drop private argument for include/import role
Since ansible 2.8 dropped private argument is not supported anymore:
https://github.com/ansible/ansible/issues/45038

Change-Id: I13a46af91e3ccd754e71f0ed7c49a187d488f090
2019-05-17 11:34:53 +03:00
Jesse Pretorius 522bba6f30 Update role for new source build process
The variables glance_developer_mode and glance_venv_download
no longer carry any meaning. This review changes glance to
do the equivalent of what developer_mode was all the time,
meaning that it always builds the venv and never requires
the repo server, but it will use a repo server when available.

As part of this, we move the source build out of its own file
because it's now a single task to include the venv build role.
This is just to make it easier to follow the code.

We also change include_tasks to import_tasks and include_role
to import_role so that the tags in the python_venv_build role
will work.

Depends-On: https://review.openstack.org/620339
Depends-On: https://review.openstack.org/637240
Depends-On: https://review.openstack.org/637503
Depends-On: https://review.openstack.org/644391
Change-Id: I1e5bd71b164676031fcde9890be43554e67048bf
2019-03-20 05:17:22 +00:00
Zuul 77148fb080 Merge "Cleanup files and templates using smart sources" 2019-02-25 22:49:10 +00:00
Kevin Carter c22d786120 Remove the private option from include_role
The private option on include role was never implemented and
will no longer be developed. This change removes the option
so ansible no longer raises a deprecation warning.

Change-Id: I011fba2674dc4c6888ba93c0ea90f4d60e4b7657
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2019-02-22 00:39:38 +00:00
Kevin Carter 9748e6b154
Cleanup files and templates using smart sources
The files and templates we carry are almost always in a state of
maintenance. The upstream services are maintaining these files and
there's really no reason we need to carry duplicate copies of them. This
change removes all of the files we expect to get from the upstream
service. while the focus of this change is to remove configuration file
maintenance burdens it also allows the role to execute faster.

  * Source installs have the configuration files within the venv at
    "<<VENV_PATH>>/etc/<<SERVICE_NAME>>". The role will now link the
    default configuration path to this directory. When the service is
    upgraded the link will move to the new venv path.
  * Distro installs package all of the required configuration files.

To maintain our current capabilities to override configuration the
role will fetch files from the disk whenever an override is provided and
then push the fetched file back to the target using `config_template`.

Change-Id: I3e7283bf778a9d686f3ae500b289c1fb43b42b92
Signed-off-by: cloudnull <kevin@cloudnull.com>
2019-02-18 09:06:26 -06:00
Juri Hudolejev 414df67f86 Fix Glance NFS mount point ownership
Glance NFS mounts are owned by `root` and are not writable by `glance`
user. Proposed change sets the `glance_nfs_client.local_path`
directory ownership to
`glance_system_user_name:glance_system_group_name` so that
Glance can write to that.

Change-Id: I226827d4f44da098961b16fd4450104d7a367205
Closes-Bug: 1813300
Related-Bug: 1759552
2019-02-01 14:19:34 +00:00
Zuul b8890c4841 Merge "Fix ansible deprecation warnings" 2018-12-21 14:17:11 +00:00
Jonathan Rosser ede416aac3 Fix ansible deprecation warnings
===
[DEPRECATION WARNING]: Using tests as filters is deprecated.
Instead of using `result|search` use `result is search`. This
feature will be removed in version 2.9.
===

Change-Id: I158a42b82d1818fa4e9296343b1b4ab787e8d89d
2018-12-03 17:26:08 +00:00
Mohammed Naser 55f9e3600c Fix permissions on /var/lib/glance/cache
During deployment, it is possible that the folder was previously
created by something else (i.e. in this case, the nspawn deployment
tooling).

We already set the permissions for the subfolders but we don't set
it to the root folder which is causing Glance to fail to start
properly.

Change-Id: I91b3529fd1896ecde814801c0297465f1b956871
2018-11-21 14:35:05 -05:00
zhulingjie 5b44a334fc Remove the unnecessary space
Change-Id: Ic219247ccc57bc174c3e2eae0eb00d234be6b739
2018-07-11 23:19:16 -04:00
Jean-Philippe Evrard fb2802d2e4 Fix usage of "|" for tests
With the more recent versions of ansible, we should now use
"is" instead of the "|" sign for the tests.

This should fix it.

Change-Id: I6749670146cc64cb39b67efb26a9226208828ae7
2018-07-12 16:44:20 +02:00
Jesse Pretorius 4aedfc612d Cleanup directory creation tasks
Using the realpath filter, we can idempotently create/modify
the log directory whether it is a symlink or not. This allows
us to consolidate two tasks into the common directory creation
task.

The extra task to create the images directory can be consolidated
into the same common directory creation task.

We also convert the items list to yaml dictionary format to
match the desired style according to the style guide.

Change-Id: I46e8b7c3be005681efc8a520318e7945c9c9a259
2018-06-29 10:17:37 +01:00
Zuul 0d4ea81077 Merge "Add systemd tags to include role" 2018-06-29 00:58:33 +00:00
Zuul 0642f458a9 Merge "Correct role rerun when using glance with NFS" 2018-06-28 22:39:10 +00:00
Kevin Carter c6cd170fb7 Correct role rerun when using glance with NFS
When using glance + NFS the role deploys everything perfectly the first
time however if the role is executed again it will result in failure due
to some base directories being a mount. This change adds a new variable
which will create a list of all NFS mount points. This list is then used
in the required tasks to ensure we're not attempting to recreate
directories that should already exist and are being used as
mount-points.

Change-Id: Id28176833c0b783c20ee1d2ce71fa0654ccf683e
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-06-28 14:47:53 +00:00
Kevin Carter 2f9c0e7a1f
Add systemd tags to include role
There are times when a deployer will need to reconfigure parts of
an environment and having a general purpose tag to run said operation
will be important especicially should the deployer be needing to
reconfigure systemd unit files in a downtime event. This change adds
a general purpose systemd tag where include_role and systemd is found
which will assit operators with day2 operational tasks.

Change-Id: Id46c2aa56cd5498d022d29cf102dcbd2014c086d
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-06-27 19:00:17 -05:00
Kevin Carter cc95d3980d
correct typo in service setup
Change-Id: Ic3ce4176d0eb948e046b6101e77480d68bf0c36b
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-06-27 18:04:58 -05:00
Jesse Pretorius 2377702b33 Simplify fact setting
The conditionals are currently difficult to follow.
This simplifies them by splitting the fact setting
up and doing a fact refresh after the first one is
set.

Change-Id: I3f74d06ba3b246674e3ea3eb6ee1e5ca6e86a79b
2018-05-15 10:55:31 +01:00
Markos Chandras 3d7cf92bda vars: Do not install build dependencies for distro installs
The glance_distro_packages contain packages which are build dependencies
to the 'PIP' ones so we don't need to install them when we are using the
Glance distribution packages. This also renames the '*glance_wsgi_bin'
to '*glance_uwsgi_bin' since it refers to the actual uwsgi package.
Finally, we add the missing 'install_method' conditional when recording
the local facts.

Implements: blueprint openstack-distribution-packages
Change-Id: I063a73ca7d50a0ad0bee57ccc42604802ab08220
2018-05-14 12:01:53 +01:00
Markos Chandras ba64ce3083 Add support for using distribution packages for OpenStack services
Distributions provide packages for the OpenStack services so we add
support for using these instead of the pip ones.

Change-Id: I026a440b6a0fda43b613e30f359b2a23c3c1151f
Depends-On: I5a78e2120e596d36629b4ba978b2b5df76b149b0
Implements: blueprint openstack-distribution-packages
2018-05-04 15:42:26 +01:00
Jesse Pretorius 622fa8d5cf Only replace python when re-initializing the venv
We reinitialize the venv to ensure that the right version of
python is in the venv, but we do not want virtualenv to also
replace pip, setuptools and wheel so we tell it not to. If we
don't do this then virtualenv will install the latest available
version, which is not what we want.

Change-Id: Iefe83a8b6002f423503c11f860a2f85f555a2f0a
Partial-Bug: #1764470
2018-04-18 10:18:23 +01:00
Zuul e791506386 Merge "Revert "Use a common python build/install role for source-base deployment"" 2018-03-29 15:19:44 +00:00
Jesse Pretorius (odyssey4me) 49ed28890e Revert "Use a common python build/install role for source-base deployment"
This is causing some trouble with the integrated build. For now,
while we work out the role's build/storage delegation, let's revert
this.

This reverts commit 975675b659, except
for the a-r-r entry which is left in place as it will be needed later.

Change-Id: I111baaf1e3d70c036508cccc31887e0f328a67ce
2018-03-29 13:25:42 +01:00
Zuul d06d951578 Merge "Convert role to use a common systemd service role" 2018-03-29 05:16:49 +00:00
Kevin Carter 9eb319c22b
Convert role to use a common systemd service role
This removes the systemd service templates and tasks from this role and
leverages a common systemd service role instead. This change removes a
lot of code duplication across all roles all without sacrificing features
or functionality. The intention of this change is to ensure uniformity and
reduce the maintenance burden on the community when sweeping changes are
needed. The exterior role is built to be OSA compatible and may be pulled
into tree should we deem it necessary.

Change-Id: Ie558875fcfbcd92c38d55e2d24087fce90889eaf
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-27 14:27:13 -05:00
Jesse Pretorius 975675b659 Use a common python build/install role for source-base deployment
Instead of copying a common set of code between all the roles,
switch to using a common role which checks whether a deploy host
already has the appropriate venv package. If it does not, build
it on the fly and pull it to the deploy host.

Implementing this does away with the requirement to do builds
on the repo container. Once this has been implemented into all
roles then the repo_build role will be retired.

Depends-On: https://review.openstack.org/556840
Change-Id: I57e87406bee5c7d10aa824f18d3142f8f3ac6ab4
2018-03-27 13:37:10 +01:00
Mohammed Naser a022d2ba3a Move uwsgi to install task file
When deploying from source, certain distros have their own way of
laying services and deploying them.  In this case, Glance uses
eventlet rather than UWSGI when deploying from binary.

This patch moves it into it the specific install file so that
it does not have to be done by binary installs.

Change-Id: If22beb98464b3b41112ffd54a66e8d7603bda2ae
2018-03-01 04:27:06 +00:00
Mohammed Naser f74e9f8db3 Drop init_systemd and merge it into install
As we are adding binary deployments, it is no longer necessary
for the existance of init_systemd for now.  Binary deployments
typically manage and create their own systemd files.

Change-Id: I89ab551c045e7510c347b4991fd69599c66c7995
2018-03-01 03:23:33 +00:00
Mohammed Naser 2a70e809e5 Drop pre_install and merge it into install
As we are adding binary deployments, it is no longer necessary
for the existance of pre_install for now.  Every install method
will have it's own pre_install inside it's install type tasks
file.

Change-Id: Ia8aadbae6da955912256ebdb97af0fd7a0673a9c
2018-02-28 18:42:15 +00:00
Jean-Philippe Evrard 4e2dddf278 Replace virtualenv-tools by a script
virtualenv-tools has a bug which gets triggered in gates: it can't
change the shebang of a virtualenv python bin/ files if they
were generated with a virtualenv script whose shebang ends with
python2 instead of python.

Because we can't modify virtualenv-tools, we use shell scripts
instead.

Change-Id: I6cc40b4fc473df29c6e3d7844fde6340694d43bb
Partial-Bug: #1741634
2018-01-28 20:15:25 +00:00
Logan V 5842a24cd3 Add external LB management handler hook interface
Based on conversation on an ansible issue[1], I implemented
a LB orchestration role[2] similar to the POC here[3].

This will allow external loadbalancer management roles to hook
into a universal notify listener "Manage LB" to perform before/
after endpoint management actions when the service is being
restarted.

[1]: https://github.com/ansible/ansible/issues/27813
[2]: https://github.com/Logan2211/ansible-haproxy-endpoints
[3]: https://github.com/Logan2211/tmp-ansible-27813

Change-Id: I7d2f47e94826526e9a5a99d32575f691fb6b30fd
2017-11-03 02:55:24 +00:00
Markos Chandras a6f93be5c1 tasks: glance_install: Fix virtualenv-tools issue on openSUSE
openSUSE is also suffering from the same virtualenv-tools issue so
we need to remove the existing python-2.7 symlink.

Link: https://github.com/fireteam/virtualenv-tools/issues/5
Related-Bug: #1637509
Partial-Bug: #1644629
Change-Id: Iff9ddc29903a278dac7ab941fe7bd5bae1702bb7
2017-08-16 12:34:25 +01:00