Skip to content
Snippets Groups Projects
Commit d1de0fdf authored by Alexander Weidinger's avatar Alexander Weidinger
Browse files

Allow to remove DB user

parent 49e4a819
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ include: ...@@ -34,6 +34,7 @@ include:
{% set state_id = 'mysql_user_' ~ name ~ '_' ~ host%} {% set state_id = 'mysql_user_' ~ name ~ '_' ~ host%}
{{ state_id }}: {{ state_id }}:
{%- if user.get('present', True) %}
mysql_user.present: mysql_user.present:
- name: {{ name }} - name: {{ name }}
- host: '{{ host }}' - host: '{{ host }}'
...@@ -43,12 +44,17 @@ include: ...@@ -43,12 +44,17 @@ include:
- password: '{{ user['password'] }}' - password: '{{ user['password'] }}'
{%- else %} {%- else %}
- allow_passwordless: True - allow_passwordless: True
{%- endif %}
{%- else %}
mysql_user.absent:
- name: {{ name }}
- host: '{{ host }}'
{%- endif %} {%- endif %}
- connection_host: '{{ mysql_host }}' - connection_host: '{{ mysql_host }}'
- connection_user: '{{ mysql_salt_user }}' - connection_user: '{{ mysql_salt_user }}'
{% if mysql_salt_pass %} {%- if mysql_salt_pass %}
- connection_pass: '{{ mysql_salt_pass }}' - connection_pass: '{{ mysql_salt_pass }}'
{% endif %} {%- endif %}
- connection_charset: utf8 - connection_charset: utf8
{%- if 'grants' in user %} {%- if 'grants' in user %}
......
...@@ -143,6 +143,12 @@ mysql: ...@@ -143,6 +143,12 @@ mysql:
- database: foo - database: foo
grants: ['select', 'insert', 'update'] grants: ['select', 'insert', 'update']
# Remove a user
obsoleteuser:
host: localhost
# defaults to True
present: False
# Override any names defined in map.jinja # Override any names defined in map.jinja
# serverpkg: mysql-server # serverpkg: mysql-server
# clientpkg: mysql-client # clientpkg: mysql-client
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment