Ansible role to manage systemd mount points
Go to file
Damian Dabrowski 9850f00be4 Fix mount's systemd unit dependency logic
Improve logic for making systemd mount dependent on
network-online.target when network filesystem is being used.

This change improves feature implemented in commit [1].

Currently when device is specified by UUID or LABEL, dependency for
network-online.target is added even it's not a network filesystem.
We should be careful with this as it may create circular dependency.
In my case, circular dependency looked like this:

network.target ->
  network-pre.target ->
    netfilter-persistent.service ->
      local-fs.target ->
        var-lib-nova.mount ->
          network-online.target ->
            network.target

Additionally, this commit was originally supposed to add dependency also
for CIFS mounts(these ones starting from '//') but it never worked in my
opinion. It was also fixed by this change.

[1] 6a9dcb6886

Change-Id: I5d2d9c074aa0390a6f8b7c8c0ba1c839fe26f6c5
(cherry picked from commit 480bb0c871)
2023-01-12 14:29:43 +00:00
defaults Use ansible_facts[] instead of fact variables 2021-02-23 09:25:49 +00:00
doc Fix linter errors 2020-10-02 07:36:28 +01:00
examples Initial Commit 2018-03-13 02:06:48 -05:00
handlers Initial Commit 2018-03-13 02:06:48 -05:00
html-docs Initial Commit 2018-03-13 02:06:48 -05:00
meta Remove references to unsupported operating systems 2021-03-16 08:57:25 +00:00
releasenotes Add option to use s3fs with role 2021-01-05 13:52:45 +02:00
tasks Use config_template as a collection 2021-11-30 15:17:07 +02:00
templates Fix mount's systemd unit dependency logic 2023-01-12 14:29:43 +00:00
tests Remove references to unsupported operating systems 2021-03-16 08:57:25 +00:00
vars Add option to use s3fs with role 2021-01-05 13:52:45 +02:00
zuul.d [reno] Stop publishing release notes 2021-01-22 18:23:01 +02:00
.gitignore Updated from OpenStack Ansible Tests 2019-08-20 03:07:45 +00:00
.gitreview Update .gitreview for stable/xena 2021-12-07 10:05:57 +00:00
CONTRIBUTING.rst [ussuri][goal] Update contributor documentation 2020-05-13 00:07:02 +03:00
LICENSE Initial Commit 2018-03-13 02:06:48 -05:00
README.md Add release note link in README 2018-06-29 14:47:06 +08:00
Vagrantfile Updated from OpenStack Ansible Tests 2021-03-22 08:54:16 +00:00
ansible-role-requirements.yaml Update to opendev 2019-04-24 01:10:14 +00:00
bindep.txt Updated from OpenStack Ansible Tests 2021-03-12 22:23:34 +00:00
manual-test.rc Initial Commit 2018-03-13 02:06:48 -05:00
run_tests.sh Updated from OpenStack Ansible Tests 2021-03-12 22:23:34 +00:00
setup.cfg Cleanup py27 support 2020-04-25 15:47:33 +02:00
setup.py Cleanup py27 support 2020-04-25 15:47:33 +02:00
tox.ini Update tox.ini to work with 4.0 2022-12-29 17:28:41 +01:00

README.md

Ansible systemd_mount

This Ansible role configures systemd mount files.

This role requires the openstack-ansible-plugins repository to be available on your local system. The Ansible galaxy resolver will not retrieve this role for you. To get the plugins role in place clone the plugins repository before running this role.

# git clone https://github.com/openstack/openstack-ansible-plugins /etc/ansible/roles/plugins

You can also use the ansible-galaxy command on the ansible-role-requirements.yml file.

# ansible-galaxy install -r ansible-role-requirements.yml

Release notes for the project can be found at: https://docs.openstack.org/releasenotes/ansible-role-systemd_mount


Example playbook

See the "defaults.yml" file for a full list of all available options.

- name: Create a systemd mount file for Mount1 and 2
  hosts: localhost
  become: true
  roles:
    - role: "systemd_mount"
      systemd_mounts:
        - what: '/var/lib/machines.raw'
          where: '/var/lib/machines'
          type: 'btrfs'
          options: 'loop'
          unit:
            ConditionPathExists:
              - '/var/lib/machines.raw'
          state: 'started'
          enabled: true
        - config_overrides: {}
          what: "10.1.10.1:/srv/nfs"
          where: "/var/lib/glance/images"
          type: "nfs"
          options: "_netdev,auto"
          unit:
            After:
              - network.target