Oefenweb / ansible-wordpress

Ansible role to set up (multiple) wordpress installations in Debian-like systems (using wp-cli)
MIT License
79 stars 37 forks source link

Document ability to add users #55

Open jrogers512 opened 6 years ago

jrogers512 commented 6 years ago

The sample playbook would benefit from demonstrating how to use users, options, and queries.

tersmitten commented 6 years ago

Did you find test.yml and vagrant.yml?

tersmitten commented 6 years ago

Can you make a PR to improve the README?

jrogers512 commented 6 years ago

I have seen test.yml and vagrant.yml, however the users is empty in both, and it isn't clear to me what options is doing:

options: 
          - command: update
            name: testtest
            value: 'not existing'

What is this updating? This looks like keypairs that can be added, but what is this doing? If I were to run the command via wp-cli, what would the syntax be?

queries appears to be a way to arbitrarily execute an sql query. This seems like something that shouldn't be in this role?

tersmitten commented 6 years ago

You might want to have a look at the wp-cli commands. I'll see if I can add an example for adding users.

jrogers512 commented 6 years ago

So, for users.src, I presume the argument is the csv like this:

users.src: files/wp-users.csv

with the contents of the file being the same format that wp-cli uses.

It's the users: [] format that I'm unsure about. wp-cli users command calls for a verb (create, delete, update) and some command line switches for username, role, pass, etc. Is 'users:' supposed to be a python list of wp-cli user commands? Ie, would this:

$ wp user create bob bob@example.com --role=author
$ wp user update 123 --display_name=Mary --user_pass=marypass
$ wp user delete 123 --reassign=567

be written in the playbook as:

    users: [ 'create bob bob@example.com --role=author', 'update 123 --display_name=Mary --user_pass=marypass', 'delete 123 --reassign=567' ]

Or something else?

jrogers512 commented 6 years ago

Actually, I see in your example: user: {} which is an empty dict. This suggests key value pairs. I'm imagining some more complex nested dict structure?

user: { "bob": { "email": "bob@example.com", "role": "author" }, 123: { "display_name": "Mary", "user_pass": "marypass" }, 123: {"delete":true, "reassign":567}}

Wild guess though, I doubt that is correct.... Is my question more clear here?