Reputation: 8509
We have a new open source ansible role that automates compilation of some custom router (OpenWRT) images called openwisp2-image-generator
The root password of the root user can be defined in the playbook YAML, but the process to do so is cumbersome.
I would like to let users to define their password and salt in clear text on the YAML and then behind the scene do something like:
import crypt;
password = crypt.crypt('password', '$1$salt-here$')
That value should be stored in a variable so I can easily add it into the right role templates.
Can I run that python code locally instead of remotely? What's the best way to do this?
Upvotes: 0
Views: 64
Reputation: 45223
There is local_action
module in ansible, you should be fine to run it locally.
Example from http://docs.ansible.com/ansible/playbooks_delegation.html
- name: take out of load balancer pool
local_action: command /usr/bin/take_out_of_pool {{ inventory_hostname }}
# ...
- name: add back to load balancer pool
local_action: command /usr/bin/add_back_to_pool {{ inventory_hostname }}
Upvotes: 1