Hi,
I try to use function “with_subelements” with module mysql_user to create an user with multiple host with a dict.
But i can’t do this
roles/vars/main.yml :
TEST:
- name: TEST300
app_MySQLHost: “127.0.0.1”
app_MySQLPort: “3306”
app_MySQLAuth: “{{ mysql_auth_file }}”
app_MySQLDatabase: “TEST”
app_MySQLUser: “TEST”
app_MySQLAuthorizeHostname:
‘127.0.0.1’
‘192.168.0.1’
roles/tasks/main.yml
- name: “[MySQL] Check user”
mysql_user:
name: “{{ item.0.app_MySQLUser }}”
host: “{{ item.1 }}”
login_host: “{{ item.0.app_MySQLHost }}”
login_port: “{{ item.0.app_MySQLPort }}”
config_file: “{{ item.0.app_MySQLAuth }}”
password: “{{ lookup(‘password’, ‘roles/TEST/credentials/mysql.pass length=15 chars=ascii_letters,digits’) }}”
update_password: on_create
priv: “{{ item.0.app_MySQLUser }}.*:ALL”
state: present
with_subelements:- “{{ project }}”
- app_MySQLAuthorizeHostname
But ansible return :
[WARNING]: Failure when attempting to use callback plugin (<ansible.plugins.callback.default.CallbackModule object at 0x1a42350>): not all arguments converted during string formatting
Any idea ?
Thx