Как редактировать yaml через скрипт Shell для копирования и комментирования строк? - PullRequest
0 голосов
/ 28 апреля 2020

Я ищу что-то вроде ...

Вход

nodes:
- address: 10.148.72.63
  port: "22"
  internal_address: ""
  role:
  - controlplane
  - etcd
  hostname_override: ""
  user: user
  docker_socket: ""
  ssh_key:
  ssh_key_path: "/root/.ssh/user"
  ssh_cert: ""
  ssh_cert_path: ""
  labels: {}
  taints: []
- address: 10.148.72.192
  port: "22"
  internal_address: ""
  role:
  - worker
  hostname_override: ""
  user: user
  docker_socket: ""
  ssh_key:
  ssh_key_path: "/root/.ssh/user"
  ssh_cert: ""
  ssh_cert_path: ""
  labels: {}
  taints: []

Выход:

nodes:
- address: 10.148.72.63
  port: "22"
  internal_address: ""
  role:
  - controlplane
  - etcd
  hostname_override: ""
  user: user
  docker_socket: ""
  ssh_key:
  ssh_key_path: "/root/.ssh/user"
  ssh_cert: ""
  ssh_cert_path: ""
  labels: {}
  taints: []
- address: 10.148.72.192
  port: "22"
  internal_address: ""
  role:
  - worker
  hostname_override: ""
  user: user
  docker_socket: ""
  ssh_key:
  ssh_key_path: "/root/.ssh/user"
  ssh_cert: ""
  ssh_cert_path: ""
  labels: {}
  taints: []
#- address: 10.148.72.63
#  port: "22"
#  internal_address: ""
#  role:
#  - controlplane
#  - etcd
#  hostname_override: ""
#  user: user
#  docker_socket: ""
#  ssh_key:
#  ssh_key_path: "/root/.ssh/user"
#  ssh_cert: ""
#  ssh_cert_path: ""
#  labels: {}
#  taints: []
#- address: 10.148.72.192
#  port: "22"
#  internal_address: ""
#  role:
#  - worker
#  hostname_override: ""
#  user: user
#  docker_socket: ""
#  ssh_key:
#  ssh_key_path: "/root/.ssh/user"
#  ssh_cert: ""
#  ssh_cert_path: ""
#  labels: {}
#  taints: []
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...