feat(install): add repositories for ubuntu and debian

This commit is contained in:
Bertrand Lanson 2024-01-30 23:20:26 +01:00
parent c8749accd8
commit 782cc8d878
6 changed files with 104 additions and 0 deletions

View File

@ -31,4 +31,5 @@ deploy_haproxy_frontend:
- default_backend default
deploy_haproxy_backend: []
deploy_haproxy_listen: []

View File

@ -0,0 +1,5 @@
---
# requirements file for molecule
roles:
- name: ednxzu.manage_repositories
- name: ednxzu.manage_apt_packages

9
tasks/install_host.yml Normal file
View File

@ -0,0 +1,9 @@
---
# task/install_host file for deploy_haproxy
- name: "Configure haproxy repository"
ansible.builtin.include_role:
name: ednxzu.manage_repositories
vars:
manage_repositories_enable_default_repo: false
manage_repositories_enable_custom_repo: true
manage_repositories_custom_repo: "{{ deploy_haproxy_repository[ansible_distribution|lower] }}"

View File

@ -1,2 +1,7 @@
---
# task/main file for deploy_haproxy
- name: "Import prerequisites.yml"
ansible.builtin.include_tasks: prerequisites.yml
- name: "Import install_host.yml"
ansible.builtin.include_tasks: install_host.yml

View File

@ -1,2 +1,53 @@
---
# task/prerequisites file for deploy_haproxy
- name: "Prerequisites for host installation"
when: deploy_haproxy_deploy_method == 'host'
block:
- name: "Create group {{ deploy_haproxy_group }}"
ansible.builtin.group:
name: "{{ deploy_haproxy_group }}"
state: present
- name: "Create user {{ deploy_haproxy_user }}"
ansible.builtin.user:
name: "{{ deploy_haproxy_user }}"
group: "{{ deploy_haproxy_group }}"
home: "{{ deploy_haproxy_chroot }}"
create_home: false
shell: /bin/false
state: present
- name: "Create directory {{ deploy_haproxy_config_dir }}"
ansible.builtin.file:
path: "{{ deploy_haproxy_config_dir }}"
state: directory
owner: "{{ deploy_haproxy_user }}"
group: "{{ deploy_haproxy_group }}"
mode: "0755"
- name: "Create directory {{ deploy_haproxy_chroot }}"
ansible.builtin.file:
path: "{{ deploy_haproxy_chroot }}"
state: directory
owner: "{{ deploy_haproxy_user }}"
group: "{{ deploy_haproxy_group }}"
mode: "0755"
- name: "Prerequisites for docker installation"
when: deploy_haproxy_deploy_method == 'docker'
block:
- name: "Create directory {{ deploy_haproxy_config_dir }}"
ansible.builtin.file:
path: "{{ deploy_haproxy_config_dir }}"
state: directory
owner: "{{ deploy_haproxy_user }}"
group: "{{ deploy_haproxy_group }}"
mode: "0755"
- name: "Create directory {{ deploy_haproxy_chroot}}"
ansible.builtin.file:
path: "{{ deploy_haproxy_chroot }}"
state: directory
owner: "{{ deploy_haproxy_user }}"
group: "{{ deploy_haproxy_group }}"
mode: "0755"

View File

@ -1,2 +1,35 @@
---
# vars file for deploy_haproxy
deploy_haproxy_config_dir: /etc/haproxy
deploy_haproxy_socket: /var/lib/haproxy/stats
deploy_haproxy_chroot: /var/lib/haproxy
deploy_haproxy_user: haproxy
deploy_haproxy_group: haproxy
deploy_haproxy_version_map:
latest: "2.9"
deploy_haproxy_repository:
debian:
- name: haproxy
uri: "http://haproxy.debian.net"
comments: "haproxy repository"
types:
- deb
suites:
- "{{ ansible_distribution_release }}-backports-{{ deploy_haproxy_version_map[deploy_haproxy_version] | default(deploy_haproxy_version) }}"
components:
- main
options:
Signed-By: "https://haproxy.debian.net/bernat.debian.org.gpg"
ubuntu:
- name: haproxy
uri: "https://ppa.launchpadcontent.net/vbernat/haproxy-{{ deploy_haproxy_version_map[deploy_haproxy_version] | default(deploy_haproxy_version) }}/ubuntu/"
comments: "haproxy repository"
types:
- deb
suites:
- "{{ ansible_distribution_release }}"
components:
- main
options:
Signed-By: "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcffb779aadc995e4f350a060505d97a41c61b9cd"