Hello ipoy
I try odoo with docker, and I success to change username and password in odoo:13.0 with an ansible task using odoo shell, that open a python prompt:
- name: Change admin user
become: true
expect:
command: docker run --name odoo_shell --rm --network pg_network -e HOST=postgres -e USER=*** -e PASSWORD=*** -it odoo:13.0 odoo shell -d mydatabase
responses:
'>>> ':
- user = env['res.users'].search([('login', '=', 'admin')])
- user.name = 'foobar'
- user.login = 'foo'
- user.password = 'bar'
- self.env.cr.commit()
- quit()
Maybe something like this could resolve your problem with ansible:
- name: Change admin user
become: true
expect:
command: odoo-bin shell -d mydatabase
responses:
'>>> ':
- user = env['res.users'].search([('login', '=', 'admin')])
- user.name = 'foobar'
- user.login = 'foo'
- user.password = 'bar'
- self.env.cr.commit()
- quit()
Without ansible, you can use linux expect command: https://linux.die.net/man/1/expect, https://www.thegeekstuff.com/2010/10/expect-examples/
An other link about odoo shell: https://www.youtube.com/watch?v=k434qcOt7nY