Skip to content

Instantly share code, notes, and snippets.

@DavesCodeMusings
Created January 26, 2022 03:33
Show Gist options
  • Select an option

  • Save DavesCodeMusings/fca7fde0f3ed31e81a67b2fe7bf4e7bf to your computer and use it in GitHub Desktop.

Select an option

Save DavesCodeMusings/fca7fde0f3ed31e81a67b2fe7bf4e7bf to your computer and use it in GitHub Desktop.
Ansible playbook to create mailboxes for users on Raspberry Pi OS
---
- name: Configure mailboxes for users
hosts: localhost
connection: local
become: true
vars:
accounts:
- pi
tasks:
- name: Creating mailbox
ansible.builtin.file:
path: "/var/mail/{{ item }}"
owner: "{{ item }}"
group: mail
state: touch
mode: "0660"
with_items: "{{ accounts }}"
- name: Adding user to mail group
user:
name: "{{ item }}"
groups: mail
append: yes
with_items: "{{ accounts }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment