initial commit
This commit is contained in:
34
tasks/configure.yml
Normal file
34
tasks/configure.yml
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
- name: haproxy | ensure certs directory
|
||||
file:
|
||||
path: '{{ item }}'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: root
|
||||
group: root
|
||||
with_items:
|
||||
- '/etc/haproxy/ssl/certs'
|
||||
- '/etc/haproxy/ssl/self'
|
||||
|
||||
- name: haproxy | create default self-signed certificate
|
||||
shell: |
|
||||
openssl req -newkey rsa:2048 -nodes -sha256 -x509 -subj "{{ haproxy_ssl_self_signed_subj }}/CN={{ item }}" -days {{ haproxy_ssl_self_signed_days }} -keyout "{{ item }}.key" -out "{{ item }}.crt" -extensions v3_ca
|
||||
cat {{ item }}.crt {{ item }}.key >> {{ haproxy_ssl_certs_dir }}/{{ item }}.pem
|
||||
chmod 0600 {{ item }}.crt {{ item }}.key {{ haproxy_ssl_certs_dir }}/{{ item }}.pem
|
||||
args:
|
||||
chdir: '{{ haproxy_ssl_self_dir }}'
|
||||
creates: '{{ haproxy_ssl_certs_dir }}/{{ item }}.pem'
|
||||
with_items: '{{ haproxy_ssl_self_signed_domains }}'
|
||||
notify:
|
||||
- haproxy restarted
|
||||
|
||||
- name: haproxy | copy configuration file
|
||||
template:
|
||||
src: haproxy.cfg.j2
|
||||
dest: '/etc/haproxy/haproxy.cfg'
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0440'
|
||||
validate: 'haproxy -f %s -c {% if haproxy_accept_warnings %}-q{% endif %}'
|
||||
notify:
|
||||
- haproxy reloaded
|
7
tasks/install.yml
Normal file
7
tasks/install.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: haproxy | installation
|
||||
apt:
|
||||
name: haproxy
|
||||
state: present
|
||||
default_release: {{ ansible_distribution_release }}-backports
|
||||
|
10
tasks/main.yml
Normal file
10
tasks/main.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: haproxy | requirements
|
||||
include_tasks: requirements.yml
|
||||
|
||||
- name: haproxy | installation
|
||||
include_tasks: install.yml
|
||||
|
||||
- name: haproxy | configuration
|
||||
include_tasks: configure.yml
|
||||
|
11
tasks/requirements.yml
Normal file
11
tasks/requirements.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: haproxy | add backports repository
|
||||
apt_repository:
|
||||
repo: deb http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main
|
||||
state: present
|
||||
filename: "{{ ansible_distribution_release }}-backports"
|
||||
|
||||
- name: haproxy | update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 86400
|
Reference in New Issue
Block a user