Ansible role to manage systemd mount points
Go to file
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
defaults Add basic tests 2018-03-23 18:12:18 -05:00
doc Add base role tests 2018-03-19 23:00:29 -05: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 Initial Commit 2018-03-13 02:06:48 -05:00
releasenotes Add base role tests 2018-03-19 23:00:29 -05:00
tasks Change mount states to ensure uptime 2018-03-30 14:47:13 -05:00
templates Change mount states to ensure uptime 2018-03-30 14:47:13 -05:00
tests Update run_tests.sh and remove tests-repo-clone.sh 2018-03-28 08:42:21 +01:00
vars Change mount states to ensure uptime 2018-03-30 14:47:13 -05:00
zuul.d Add base role tests 2018-03-19 23:00:29 -05:00
.gitignore Updated from OpenStack Ansible Tests 2018-03-28 09:23:25 +00:00
.gitreview Fix gitreview repo name 2018-03-19 14:47:31 -05:00
CONTRIBUTING.rst Initial Commit 2018-03-13 02:06:48 -05:00
LICENSE Initial Commit 2018-03-13 02:06:48 -05:00
README.md Initial Commit 2018-03-13 02:06:48 -05:00
Vagrantfile Updated from OpenStack Ansible Tests 2018-03-28 09:23:25 +00:00
ansible-role-requirements.yaml Initial Commit 2018-03-13 02:06:48 -05:00
bindep.txt Add base role tests 2018-03-19 23:00:29 -05:00
manual-test.rc Initial Commit 2018-03-13 02:06:48 -05:00
run_tests.sh Update run_tests.sh and remove tests-repo-clone.sh 2018-03-28 08:42:21 +01:00
setup.cfg Add base role tests 2018-03-19 23:00:29 -05:00
setup.py Initial Commit 2018-03-13 02:06:48 -05:00
test-requirements.txt Initial Commit 2018-03-13 02:06:48 -05:00
tox.ini Update run_tests.sh and remove tests-repo-clone.sh 2018-03-28 08:42:21 +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

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