How to assign an array to a variable in an Ansible-Playbook

前端 未结 5 802
南方客
南方客 2020-12-23 14:49

In a playbook I got the following code:

---
- hosts: db
  vars:
    postgresql_ext_install_contrib: yes
    postgresql_pg_hba_passwd_hosts: [\'10.129.181.241         


        
5条回答
  •  忘掉有多难
    2020-12-23 15:35

    Variables can be represented as standard YAML structures so you can assign a list value to a key like this:

    ---
    - hosts: db
      vars:
        postgresql_ext_install_contrib: yes
        postgresql_pg_hba_passwd_hosts:
          - '10.129.181.241/32'
          - '1.2.3.0/8'
    

提交回复
热议问题