Update to 2022-03-17 09:00

This commit is contained in:
Daniel Berteaud
2022-03-17 09:00:06 +01:00
parent 4f86b985c4
commit 9022589d6f
13 changed files with 245 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
---
- name: Deploy ldap2pg configuration
block:
- name: Render config template
template:
src: ldap2pg.yml.j2
dest: "/etc/ldap2pg.yml"
owner: "{{ ldap2pg_user }}"
group: "{{ ldap2pg_user }}"
mode: 0600
backup: True
register: ldap2pg_rendered_conf
notify:
- restart ldap2pg.timer
- name: Validate new configuration
command: /bin/ldap2pg --config /etc/ldap2pg.yml --dry
changed_when: False
become_user: "{{ ldap2pg_user }}"
register: ldap2pg_conf_validation
rescue:
- name: Rollback previous configuration
copy:
src: "{{ ldap2pg_rendered_conf.backup_file }}"
dest: /etc/ldap2pg.yml
remote_src: True
owner: "{{ ldap2pg_user }}"
group: "{{ ldap2pg_user }}"
mode: 0600
when: ldap2pg_rendered_conf.backup_file is defined
tags: pg
- name: Fails if new configuration isn't validated
fail:
msg: "Failed to validate /etc/ldap2pg: {{ ldap2pg_conf_validation.stdout }}"
when: ldap2pg_conf_validation.rc != 0
tags: pg

View File

@@ -0,0 +1,10 @@
---
# Load distribution specific variables
- include_vars: "{{ item }}"
with_first_found:
- "{{ role_path }}/vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ role_path }}/vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ role_path }}/vars/{{ ansible_distribution }}.yml"
- "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
tags: pg

View File

@@ -0,0 +1,15 @@
---
- name: Install packages
package: name={{ ldap2pg_packages }}
tags: pg
- name: Install systemd unit
template: src=ldap2pg.{{ item }}.j2 dest=/etc/systemd/system/ldap2pg.{{ item }}
loop:
- service
- timer
notify:
- restart ldap2pg.service
- restart ldap2pg.timer
tags: pg

View File

@@ -0,0 +1,16 @@
---
- include_tasks: user.yml
tags: always
- include_tasks: facts.yml
tags: always
- include_tasks: install.yml
tags: always
- include_tasks: conf.yml
tags: always
- include_tasks: services.yml
tags: always

View File

@@ -0,0 +1,5 @@
---
- name: Handle ldap2pg timer
systemd: name=ldap2pg.timer state={{ (ldap2pg_sync_freq == 'never') | ternary('stopped', 'started') }} enabled={{ (ldap2pg_sync_freq == 'never') | ternary(False, True) }}
tags: pg

View File

@@ -0,0 +1,6 @@
---
- name: Create ldap2pg user
user: name={{ ldap2pg_user }}
register: ldap2pg_user_info
tags: pg