Commit Graph

17 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov 3448df38f5 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: I8bd832c172ef87acca27f053c5223941d80f9ce1
2023-07-12 12:29:45 +02:00
Dmitriy Rabotyagov 34b6061ab5 Remove warn argument for command/shell
Since ansible-core 2.14 you can't use warn as module argument.

It's being removed to avoid module failure.

Change-Id: I7287d449b8fd0ad970e37aa63b5cb25f88197858
2023-06-30 15:28:35 +02:00
Dmitriy Rabotyagov f40c418af2 Change default mode of mount files to 644
In case of setting file permissions to 640 systemd will raise an
alert [1]. In order to avoid spamming in logs, we change default mode to
644 as no passwords or credentials are going to be stored in this file.

With that we provide a way to override file mode if needed.

[1] https://paste.openstack.org/show/b83tSrjni8iB2WNsvDfQ/

Change-Id: I73164e9d4b02d7b3fae21b912369afcd1cc64abf
2023-02-09 13:33:07 +01:00
Erik Berg fcd7137b86 Remove redundant vars line
This line was introduced by I680359ca655d0f69a40e9d29dbf1694cd0aa4ca2
for convenience, and should already be covered by the
distribution_major_version line above.

Change-Id: I8aba13ef29571730f9260dc2f6af33c168185780
2022-09-15 12:14:21 +02:00
Dmitriy Rabotyagov 13b2abebe7 Do not report changed for shell
Currently "Set the state of the mount" task reports changed state
every time, which makes impression that role is not idempotent.
We fix that by adding `changed_when: false` to the task.

Change-Id: I3deca051530b3c5497d70b9bc06f39483e8ef4ce
2022-05-18 19:09:28 +02:00
Jonathan Rosser d74c88dcb5 Add support for glusterfs mounts
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/837706
Change-Id: I2631e6f00011942954be7c776e3c99a11bdfb28d
2022-04-20 06:53:34 +00:00
Jonathan Rosser 89c7ec5292 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: Idbeb3e61d0398944af8d73db5d98352de95b91a7
2022-01-12 08:01:45 +00:00
Dmitriy Rabotyagov fd0926d201 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: I69c8682c40a61e87156c1615c3b3eab67a76abe8
2021-11-30 15:17:07 +02:00
Jonathan Rosser f1132fcc47 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: I55037805e59cb6d727593f467e98568a4c030e74
2021-03-16 08:57:25 +00:00
Jonathan Rosser e5cc6f8990 Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I5a83a7f237e4b7d86e8d7ee08b0e8c6b4f8a44f8
2021-02-23 09:25:49 +00:00
Dmitriy Rabotyagov 483b10e5e9 Add option to use s3fs with role
Change-Id: I5cf6353a30190aa0a2f0856530a65c48437ed5ea
2021-01-05 13:52:45 +02:00
Dmitriy Rabotyagov 8e23ee78bb Install required packages for NFS/CephFS mounts
Currently it's deployer resposibility to install required binaries for
mounts to succeed, which is not really convenient. Instead of this
we can try to provide at least some basic binaries installation in case
supported type is set.

Depends-On: https://review.opendev.org/755484
Change-Id: I680359ca655d0f69a40e9d29dbf1694cd0aa4ca2
2020-10-02 18:21:09 +03:00
Jonathan Rosser 081382486a Remove fail: tasks before creating mounts
We assume that the deployer knows what they are doing so remove
these tasks which add extra runtime to deployments and CI tests.

Change-Id: I4806ce34a38375461f4de1cc69c7e05cd86ff602
2020-06-17 16:05:27 +01:00
Kevin Carter 29412148c3 Add mount state rescue block
The mount state could be volitile making it so the "restart-or-reload"
option fails to execute. If this happens the task will now be rescued
and the mount state will be attempted using the regular systemd
module.

Change-Id: I86fc03ad7c72fa4cfdfc598f552f936dda653926
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-10-22 19:43:39 +00:00
Kevin Carter d1dc867ef1
Change mount states to ensure uptime
The mount role was using the systemd module to start / stop mounts
however if a mount was restarted when it could have been reloaded
the role could create a fair amount of chaos in a running environment.
This change maps the mount states appropriately to the systemctl command
options to ensure we're not needlessly restarting mounts should the unit
files change. The `systemd_mount_states` has been added which will map
the normal Ansible states to suitable systemd mount states and the mount
state is being managed using the `systemctl` command instead of the
ansible module.

Change-Id: I5c7e5105e54d3ff9ad040f2a1d003d3dd12e4efb
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-30 14:47:13 -05:00
Kevin Carter 031ba51726
Add basic tests
This change adds basic tests when creating a mount unit file.
This test will ensure system-mount is functional with a local mounts,
NFS mounts, and swap mounts.

Change-Id: I00dbf7f6ff3b687e622b29808197dbd7427d24fe
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-23 18:12:18 -05:00
Kevin Carter 4f37977e7b
Initial Commit
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-03-13 02:06:48 -05:00