-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from Oefenweb/pr-59
Add userlist support
- Loading branch information
Showing
6 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM ubuntu:16.04 | ||
MAINTAINER Mischa ter Smitten <[email protected]> | ||
|
||
# python | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal python-dev curl && \ | ||
apt-get clean | ||
RUN curl -sL https://bootstrap.pypa.io/get-pip.py | python - | ||
RUN rm -rf $HOME/.cache | ||
|
||
# ansible | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \ | ||
apt-get clean | ||
RUN pip install ansible==2.3.2.0 | ||
RUN rm -rf $HOME/.cache | ||
|
||
# provision | ||
COPY . /etc/ansible/roles/ansible-role | ||
WORKDIR /etc/ansible/roles/ansible-role | ||
RUN ansible-playbook -i tests/inventory tests/test.yml --connection=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,3 +70,6 @@ haproxy_frontend: [] | |
|
||
# back-end section | ||
haproxy_backend: [] | ||
|
||
# user-lists section | ||
haproxy_userlists: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% for userlist in haproxy_userlists %} | ||
{% set groups = [] %} | ||
userlist {{ userlist.name }} | ||
{% for user in userlist.users %} | ||
{% if user['groups'] is defined %} | ||
{% set _ = groups.extend(user['groups']) %} | ||
{% set user_groups = ' groups ' ~ user['groups'] | join(',') %} | ||
{% else %} | ||
{% set user_groups = '' %} | ||
{% endif %} | ||
{% if user['password'] is defined %} | ||
user {{ user.name }} password {{ user.password }}{{ user_groups }} | ||
{% elif user['insecure_password'] is defined %} | ||
user {{ user.name }} insecure-password {{ user.insecure_password }}{{ user_groups }} | ||
{% endif %} | ||
{% endfor %} | ||
{% for group in groups | unique %} | ||
group {{ group }} | ||
{% endfor %} | ||
|
||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters