Skip to content
Snippets Groups Projects

well it does not get more ugly than his :( I don't have a reliable way of...

Merged Andreas Hamacher requested to merge mysqlgrantpriviliges into master
1 unresolved thread
1 file
+ 15
1
Compare changes
  • Side-by-side
  • Inline
@@ -52,7 +52,16 @@
mysql_user: name={{ mysql_user_name }} host={{ mysql_user_host }} password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present
when: mysql_user_host is defined
- name: "Giving priviliges to user with fqdn"
- name: "Giving priviliges to user with shortname"
mysql_user: name={{ mysql_user_name }} host={{ item }} password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present
with_items: "{{ mysql_user_hosts_group }}"
when: mysql_user_hosts_group is defined
- name: "Giving priviliges to user with hardcoded hostname"
mysql_user: name={{ mysql_user_name }} host='HARDCODE YOUR HOSTNAME' password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present
    • How do we label 'HARDCODE your HOSTNAME' ? with this task when we are going deploy this ?

      By specifying another variable ?

Please register or sign in to reply
tags: [never]
- name: "Giving priviliges to user with fdqn works only when run with --limit=ManagementNodes,SQLNodes"
mysql_user: name={{ mysql_user_name }} host={{ hostvars[item].ansible_fqdn }} password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present
with_items: "{{ mysql_user_hosts_group }}"
when: mysql_user_hosts_group is defined
@@ -65,3 +74,8 @@
- name: "Giving priviliges to user with item.domain"
mysql_user: name={{ mysql_user_name }} host="{{ item }}.{{ domain }}" password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present
with_items: "{{ mysql_user_hosts_group }}"
- debug:
msg: "{{ hostvars[item].ansible_fqdn }}"
with_items: "{{ mysql_user_hosts_group }}"
tags: [never]
Loading