Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipaautomountmap: add support for indirect maps #1075

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

rjeffman
Copy link
Member

Indirect maps were not supported by ansible-freeipa ipaautomountmap. This patch adds support for adding indirect automount maps using the "parent" and "mount" parameters, if the map do not yet exist. An existing map cannot be modified.

The "parent" parameter must match an existing automount map, and the "mount" parameter is required if "parent" is used.

A new test playbook was added to test the feature:

tests/automount/test_automountmap_indirect.yml

Related:

Fixes #804

Copy link
Collaborator

@varunmylaraiah varunmylaraiah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The "mount point" option is missing in PR#1075

  2. The "automount map indirect" should be successfully added without the parent option.

  3. Noticed an wrong error message when trying to add an indirect map

tasks:

  • ipaautomountmap:
    ipaadmin_principal: admin
    ipaadmin_password:
    automountlocation: 01automuntmap_testlocation
    name: 01_automountmap_testmap
    mount: indirect

TASK [ipaautomountmap] *************************************************************************************************************
task path: /root/02map.yaml:7
fatal: [master.ipadomain.test]: FAILED! => {"changed": false, "msg": "automountmap_add: 01automuntmap_testlocation: Unknown option: key"}

PLAY RECAP *************************************************************************************************************************
master.ipadomain.test : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

CLI Console output:
[root@master ~]# ipa automountmap-add-indirect 01automuntmap_testlocation 01_automountmap_testmap
Mount point: /usr/share/test
---------------------------------------------
Added automount map "01_automountmap_testmap"
---------------------------------------------
  Map: 01_automountmap_testmap

@varunmylaraiah
Copy link
Collaborator

from this PR, the expected options
The "automountmap_type" is either "direct" or "indirect, default: direct
The "mountpoint" option should be specified.
The "parentmap" option needs to be included.

@rjeffman
Copy link
Member Author

@varunmylaraiah I believe I have fixed all this issues, but I found a few more, so the patch is a little more complex.

I've also reviewed the names used in the command-line and fixed both in the module and the README file (a second pair of eyes to check consistency would be really nice).

@varunmylaraiah
Copy link
Collaborator

@rjeffman Thanks for the quick fix. yes, all issues have been fixed. However, I'm still unsure about how to provide a mount point for an indirect map. In CLI, it appears that we cannot add an automount map indirectly without specifying a mount point.

[root@master ~]# ipa automountmap-add-indirect
Location: 01automuntmap_testlocation
Map: 01_automountmap_testmap
Mount point:
ipa: ERROR: 'mount' is required

@rjeffman
Copy link
Member Author

So, for the CLI you can use something like:

ipa automountmap-add-indirect my_location indirect_map --mount indirect

Use --parentmap if you want to provide a parent map.

This same command translates to the task:

- ipaautomountmap:
    ipaadmin_password: SomeADMINpassword
    location: my_location
    name: indirect_map
    mount: indirect

There is no mount_ponint paramater as this is used neither on the CLI nor the API. The mount parameter is the actual relative mount point (relative to the parent map).

Note that deleting an automount map created with automountmap-add-indirect leaves some configuration around (see https://pagure.io/freeipa/issue/9397), and it should be clear if you are using the CLI. The module does the proper cleaning (or should do).

Copy link
Collaborator

@varunmylaraiah varunmylaraiah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
New test cases for the automount map of type "indirect" have been successfully passed in the downstream

@@ -54,6 +54,19 @@ Example playbook to ensure presence of an automount map:
desc: "this is a map for servers in the DMZ"
```

Example playbook to ensure an indirect automount map is present:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain what an indirect map is and what it is used for.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. I also added a new example playbook for indirect maps.

README-automountmap.md Outdated Show resolved Hide resolved
Indirect maps were not supported by ansible-freeipa ipaautomountmap.
This patch adds support for adding indirect automount maps using the
"parent" and "mount" parameters, if the map do not yet exist. An
existing map cannot be modified.

The "parent" parameter must match an existing automount map, and the
"mount" parameter is required if "parent" is used.

A new example playbook can be found at:

    playbooks/automount/automount-map-indirect-map.yml

A new test playbook was added to test the feature:

    tests/automount/test_automountmap_indirect.yml
Copy link
Member

@t-woerner t-woerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@t-woerner t-woerner merged commit 5d08214 into freeipa:master Jul 19, 2023
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for creating indirect automount maps
3 participants