You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mariadb_users.yml 883 B

1 week ago
1 week ago
1 week ago
1 week ago
123456789101112131415161718192021222324252627282930313233
  1. ---
  2. - hosts: something
  3. vars:
  4. MARIADB_PASSWORD: "{{ lookup('markuman.nextcloud.passwords', 'root_mariadb_password') }}"
  5. dbs:
  6. - nextcloud
  7. - gitea
  8. - grafana
  9. tasks:
  10. - name: "databases must be present"
  11. mysql_db:
  12. login_host: 127.0.0.1
  13. login_password: "{{ MARIADB_PASSWORD }}"
  14. login_port: 3306
  15. login_user: m
  16. name: "{{ item }}"
  17. state: present
  18. encoding: utf8mb4
  19. with_items: "{{ dbs }}"
  20. - name: "add or update user"
  21. mysql_user:
  22. login_host: 127.0.0.1
  23. login_password: "{{ MARIADB_PASSWORD }}"
  24. login_port: 3306
  25. login_user: m
  26. name: "{{ item }}"
  27. host: "%"
  28. password: "{{ lookup('markuman.nextcloud.passwords', item + '_mariadb_password') }}"
  29. priv: "{{ item }}.*:ALL"
  30. state: present
  31. with_items: "{{ list }}"