From 8b7d4207b86862fd63f69d24ea6917b2a9a8de07 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sat, 4 May 2019 11:46:54 +0200 Subject: [PATCH] Autogenerate service config --- dhcp.yml | 4 ++++ roles/re2o-service/tasks/main.yml | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/dhcp.yml b/dhcp.yml index 4f463c9..64bf0de 100644 --- a/dhcp.yml +++ b/dhcp.yml @@ -4,6 +4,10 @@ vars: service_repo: https://gitlab.federez.net/re2o/dhcp.git service_name: dhcp + service_config: + hostname: re2o-server.adm.auro.re + username: service-user + password: V28GJvhhY2OSE dhcp: authoritative: true roles: diff --git a/roles/re2o-service/tasks/main.yml b/roles/re2o-service/tasks/main.yml index 5653856..3646cdd 100644 --- a/roles/re2o-service/tasks/main.yml +++ b/roles/re2o-service/tasks/main.yml @@ -10,6 +10,25 @@ become: true become_user: "{{ service_user }}" +- name: Configure re2o {{ service_name }} project + ini_file: + path: "{{ service_homedir }}/config.ini" + section: Re2o + option: "{{ item.key }}" + value: "{{ item.value }}" + mode: 0600 + become: true + become_user: "{{ service_user }}" + loop: "{{ service_config|dict2items }}" + +- name: Link config file + file: + src: "{{ service_homedir }}/config.ini" + dest: "{{ service_homedir }}/{{ service_name }}/config.ini" + owner: "{{ service_user }}" + group: nogroup + state: link + - name: Indicate in motd service location template: src: update-motd.d/05-service.j2