- name: update haproxy frontend
                  
                  
                    delegate_to: "{{ item }}"
                  
                  
                    delegate_facts: no
                  
                  
                    vars: 
                  
                  
                      hosts_content: "{{ lookup('template', 'templates/mysql_front.j2') }}"
                  
                  
                      lvs_bind_ip: "{{hostvars[item]['ansible_default_ipv4']['address']}}"
                  
                  
                    blockinfile:
                  
                  
                      path: /etc/haproxy/haproxy.cfg
                  
                  
                      insertafter: "# Frontend section ---------------------------------------------------"
                  
                  
                      marker: "# {mark} mysql frontend for {{ group_names[0] }}"
                  
                  
                      content: "{{hosts_content}}"
                  
                  
                      state: present
                  
                  
                    run_once: true
                  
                  
                    with_items: 
                  
                  
                      - "{{ groups.lvs}}"
                  
                  
                
Если конструкция выглядит так что кровь течёт из глаз, это не кошерная тема
Обсуждают сегодня