Hi,
I try to use function “with_subelements” to create a folder tree for MySQL installation with multiple element in vars, but I can’t do this …
Exemple :
vars.yml :
mysqld_instance:
- name: “HOSTNAME”
port:- ‘3307’
user: ‘mysql’
mysql_data_path: ‘/opt/mysql’
mysql_data_tree:- { file: ‘run’, mode: ‘755’ }
- { file: ‘var’, mode: ‘755’ }
- { file: ‘var/log’, mode: ‘755’ }
- { file: ‘var/data’, mode: ‘755’ }
- { file: ‘var/tmp’, mode: ‘755’ }
- { file: ‘var/iblogs’, mode: ‘755’ }
- { file: ‘var/ibdata’, mode: ‘755’ }
task.yml :
- name: “Create MySQL Tree”
file:
path: “{{ item.0.mysql_data_path }}/{{ item.1 }}/{{ item.2.file }}”
owner: “{{ item.0.user }}”
group: “{{ item.0.user }}”
mode: “{{ item.1.mode }}”
state: directory
with_subelements:- “{{ mysqld_instance }}”
- port
- mysql_data_tree
Output :
fatal: [XXXXXXXXXXXXXXXXXXXX]: FAILED! => {“failed”: true, “msg”: “subelements lookup expects a list of two or three items, the optional third item must be a dict with flags skip_missing”}
Someone would tell me how to do this?
Thx