Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for conf.d like configuration handling. #47

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nesh
Copy link

@nesh nesh commented Jun 28, 2017

  • Instead of managing just one haproxy.cfg file with this final configuration file will be assembled from all files residing inside of haproxy_cfg_path.
    It will give users option to add own files into the main configuration for cases which are not covered with standard configuration options in the role, i.e. generated frontend/backend lists from external sources.
  • Moved few hardcoded paths into variables.
  • Added a fix to the .travis.yml so it can work again with latest trusty image changes.
  • Created additional Vagrantfile which can be used to test any distro / ansible version combination instead waiting for Travis to complain.

@tersmitten tersmitten modified the milestones: 2.0.0, 6.0.0 Jun 28, 2017
@tersmitten
Copy link
Member

Looks really interesting! However it might take some time from my side for it to be merged. I'll keep you posted.

@nesh
Copy link
Author

nesh commented Jun 30, 2017

NP, for now I'll use my forked version.

I may in the meantime find a better way to inject additional configuration files than using pre_task section.

Assemble should really be a handler but I did not manage to find a good way (at simple one) to fire it from the main task when files are changed or removed other than duplicating it as task which does not look good to me (ansible newbie :)).

@logan2211
Copy link
Contributor

Nice change. The assemble as a task is probably better than running it as a handler because it facilitates dropping configuration parts into conf.d outside the scope of this role while still maintaining idempotency in regenerating the compiled config. :)

owner: root
group: root
mode: 0640
validate: 'haproxy -f %s -c'
validate: "{{ haproxy_validation_command }}"
notify: restart haproxy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This notification is unnecessary. Only the assemble tasks below need to notify the reload handler.

@haad
Copy link
Contributor

haad commented Sep 3, 2017

With haproxy version 1.7 you can just pass -f /path/to/conf.d and it will load all .conf files there. for older haproxiees you have to name all files present -f conf.d/file1.conf .... I think that would be better solution to this problem as we do not need to merge files into one.

@haad
Copy link
Contributor

haad commented Sep 3, 2017

You can see it implemented at #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants