forked from mubn/ansible-mail-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_user.yml
37 lines (32 loc) · 1.15 KB
/
add_user.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
# Playbook pro pridani uzivatele
- hosts: mail
vars_prompt:
- name: username
prompt: Zadejte uzivatelske jmeno
private: false
confirm: true
- name: user_pw_hash
prompt: Zadejte heslo
private: true
confirm: true
encrypt: sha512_crypt
salt_size: 8
tasks:
- name: Pridani zaznamu do databaze
community.mysql.mysql_query:
login_db: vmail
query: INSERT INTO accounts (username, domain, password, quota, enabled, sendonly) values ('{{ username }}', '{{ domain }}', '{{ user_pw_hash }}', 2048, true, false)
# JINE ZPUSOBY RESENI
#####
## zbytecne komplikovane
#query: INSERT INTO accounts (username, domain, password, quota, enabled, sendonly) values ('%s', '%s', '%s', 2048, true, false)
# positional_args:
#- "{{ username }}"
#- "{{ domain }}"
#- "{{ user_pw_hash }}"
## nepouziva modul ansiblu
#shell: "mysql << EOF
# USE vmail;
# INSERT INTO accounts (username, domain, password, quota, enabled, sendonly) values ('{{ username }}', '{{ domain }}', '{{ user_pw_hash }}', 2048, true, false);
# EOF"