automation - Working with ansible to create a wordpress user creater -
so have script working, , looks this
- name: create test user shell: /usr/local/bin/wp/wp-cli.phar user create {{ item.name }} {{ item.email }} --user_pass={{ item.password }} --role={{ item.role }} --path=/var/www/wp with_items: - { name: 'testuser1', email: 'testuser1@123.com', password: 123, role: author } - { name: 'testuser2', email: 'testuser2@123.com', password: 123, role: author }
and works in creating wordpress users, wondering if there way take information in "with_items" , move separate file of usernames , information.
in variable file (referenced vars_files
):
users: - name: testuser1 email: testuser1@123.com password: 123 role: author - name: testuser2 email: testuser2@123.com password: 123 role: author
then:
- name: create test user shell: /usr/local/bin/wp/wp-cli.phar user create {{ item.name }} {{ item.email }} --user_pass={{ item.password }} --role={{ item.role }} --path=/var/www/wp with_items: "{{users}}"
Comments
Post a Comment