Ansible Playbook to push hostname to ip addresses -


i have csv file has host name corresponding ip address in it. trying write ansible playbook using lineinfile = command variable read csv file , place hostname of corresponding ipaddress on host ipaddress. don't know if way go. want run playbook addressed host.

if need connect hosts in csv file , set hostname corresponding name value file, do:

--- - hosts: localhost   tasks:     - add_host: name="{{ item.split(',')[1] | trim }}" ansible_host="{{ item.split(',')[0] }}" group=csv       with_lines: cat host-ip.csv  - hosts: csv   tasks:     - hostname: name="{{ inventory_hostname }}" 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -