Menu

Ansible added our deploy user to one group and took it out of every other
📰

Ansible added our deploy user to one group and took it out of every other

DEV Community: ansible·Sergey Shinder·about 6 hours ago
#xRzRpBBE
#devtoansible#devto#dev#user#task
Reading 0:00
15s threshold

Our customer portal is deployed to fourteen web servers by a deploy user that copies each release into /srv/portal/releases and switches a symlink. The releases directory belongs to the www-data group, and deploy is a member, which is the only reason it can write there.

In October support asked for the deploy job to collect the service's journal after each release, so they could see startup errors without logging in. Reading the system journal needs membership of the systemd-journal group, so we added one task to our base role: the user module, name deploy, groups systemd-journal.

The play ran green on all fourteen servers on a Tuesday. Nothing happened until Thursday's release, when every server failed the copy with permission denied on the releases directory.

The user module's groups parameter does not mean add the user to these groups. It means these are the user's supplementary groups, and by default the module removes the user from every group not in the list. Adding is what append: true is for.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.