[Unit] Before=postgresql.service [Service] Type=oneshot RemainAfterExit=true Environment=PGDATA={{ pgdata_dir }} Environment=LANG={{ pg_locale }} User=postgres Group=postgres ExecStart=/bin/sh -c "[ -f ${PGDATA}/PG_VERSION ] || initdb -D ${PGDATA}"