и mysql),  и есть group_vars/
                  
                  
                  
                  
                  
                  # /group_vars/web
                  
                  
                  ufw_vars:
                  
                  
                    - { port: "80", protocol: "tcp", policy: "allow", from: "any", comment: "allow incoming connection on standard HTTP port" }
                  
                  
                    - { port: "443", protocol: "tcp", policy: "allow", from: "any", comment: "allow incoming connection on standard HTTPS port" }
                  
                  
                  
                  
                  
                  # /group_vars/mysql
                  
                  
                  ufw_vars:
                  
                  
                    - { port: "3306", protocol: "tcp", policy: "allow", from: "any", comment: "allow incoming connection on standard MySQL port" }
                  
                  
                  
                  
                  
                  
                  
                  
                  Я хочу в loop / with_items применить правила UFW фаерволла, для этого мне нужно как-то обратиться к значениям списка (массива?)
                  
                  
                  
                  
                  
                  
                  
                  
                      - debug:
                  
                  
                          msg: '{{ ufw_vars }}'
                  
                  
                  
                  
                  
                  возвращает корректные значения всего списка:
                  
                  
                  
                  
                  
                  ok: [ansible5] => {
                  
                  
                      "msg": [
                  
                  
                          {
                  
                  
                              "comment": "allow incoming connection on standard HTTP port",
                  
                  
                              "from": "any",
                  
                  
                              "policy": "allow",
                  
                  
                              "port": "80",
                  
                  
                              "protocol": "tcp"
                  
                  
                          },
                  
                  
                          {
                  
                  
                              "comment": "allow incoming connection on standard HTTPS port",
                  
                  
                              "from": "any",
                  
                  
                              "policy": "allow",
                  
                  
                              "port": "443",
                  
                  
                              "protocol": "tcp"
                  
                  
                          }
                  
                  
                      ]
                  
                  
                  }
                  
                  
                  Но в loop, нужно конкретно по "port", "protocol", "policy" обращаться
                  
                  
                
наверно вам сюда https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html
Обсуждают сегодня