On 2/14/20 11:26 AM, John Simmons wrote:
> Hi all
> 
> Run into a bit of a problem when trying to run this command inside a docker 
> container:
> 
>         *CREATE USER '{{ item.user }}'@'%' IDENTIFIED BY '{{ item.password 
> }}';*
> 
> 
> this is what I've done but it's not working. Does anybody see where I'm going 
> wrong? (where mysql in the example
> command-line is the container name)
> 
>         *- name: Build the environment*
> 
>         *  hosts: server1*
> 
>         *  tasks*
> 
>         *    - name: create db users via command line*
> 
>         *      shell: "docker exec -i mysql sh -c 'mysql -u root -e \"CREATE 
> USER '{{ item.user }}'@'%' IDENTIFIED BY
>         '{{ item.password }}';\" ' "*
> 
>         *      with_items:*
> 
>         *        - { user: "user1", password: "aaaaaaaaa", db: "db1" }*
> 
>         *        - { user: "user2", password: "bbbbbbbbb", db: "db2" }*
> 
>         *        - { user: "user3", password: "cccccccccc", db: "db3" }*
> 
> 
> Hope you can point me in the right direction

Hello John,

I don't see the point why you want to do this from inside the container. You 
should be able to use "mysql_user" module
with the MySQL port exposed by the docker container.

Regards
         Racke

> 
> Regards
> 
> John 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/dcfffe3b-cb6f-4e4a-a85c-abbd5ff2b7be%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/dcfffe3b-cb6f-4e4a-a85c-abbd5ff2b7be%40googlegroups.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/25fbdade-8ae7-3cb1-b191-cb89519167cf%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to