Maciej Kwiek e51ac240c3 Change sudo to become in ansible resources
As we are using ansible 2.0, we should move from sudo to become to avoid
deprecation.

Change-Id: Ia084759b9c38f5c045ab14eab3af63a2ad33069f
Closes-bug: 1547430
2016-02-22 10:05:54 +01:00

23 lines
816 B
YAML

# TODO
- hosts: [{{host}}]
become: yes
vars:
config_dir: {src: {{ config_dir['src'] }}, dst: {{ config_dir['dst'] }}}
haproxy_ip: {{ ip }}
haproxy_services:
{% for single in config %}
- name: {{ single['name'] }}
listen_port: {{ single['listen_port'] }}
protocol: {{ single['protocol'] }}
servers:
{% for backend in single['backends'] %}
- name: {{ backend['server'] }}_{{ backend['port'] }}
ip: {{ backend['server'] }}
port: {{ backend['port'] }}
{% endfor %}
{% endfor %}
tasks:
- file: path={{ config_dir['src'] }}/ state=directory
- file: path={{ config_dir['src'] }}/haproxy.cfg state=touch
- template: src={{templates_dir}}/haproxy.cfg dest=/etc/haproxy/haproxy.cfg