Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python replace list of ips from yaml file with new list

import yaml

fname = "some.yaml"

stream = open(fname, 'r')
data = yaml.load(stream)

data['instances'][0]['host'] = '1.2.3.4'
data['instances'][0]['username'] = 'Username'
data['instances'][0]['password'] = 'Password'

with open(fname, 'w') as yaml_file:
    yaml_file.write( yaml.dump(data, default_flow_style=False))
Comment

PREVIOUS NEXT
Code Example
Python :: mad libs game prompt python 
Python :: sphinx, where to write the glossary of a sofware project 
Python :: Create a python for loop that sums the numbers from 100 to 200 
Python :: rapids - convert nerworkx to cugraph 
Python :: notebook python static website generator 
Python :: command to update pip 
Shell :: install git ec2 linux 
Shell :: remove angular cli 
Shell :: ubuntu uninstall chrome 
Shell :: check nginx status 
Shell :: git update gitignore 
Shell :: centos 7 apache restart 
Shell :: Remove composer for ubuntu 
Shell :: git username email 
Shell :: mvn clean install skip tests 
Shell :: stop a process running on a port ubuntu 
Shell :: how to pronounce ubuntu 
Shell :: how to disable maintenance mode in magento 2 
Shell :: conda install sklearn 
Shell :: sudo: aptitude: command not found 
Shell :: Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xeu mongod.service" for details. 
Shell :: Building wheels for collected packages: opencv-python Building wheel for opencv-python (PEP 517) ... 
Shell :: zsh: command not found: jq 
Shell :: apache disable autostart linux 
Shell :: remove stopped containers 
Shell :: not digitally signed. you cannot run this script on the current system 
Shell :: install yarn ubuntu 20.04 
Shell :: linux remove mysql server 
Shell :: remove mongodb from mac 
Shell :: remove git from folder 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =