Autogenerate service config

This commit is contained in:
Alexandre Iooss 2019-05-04 11:46:54 +02:00
parent 5939d434fd
commit 8b7d4207b8
No known key found for this signature in database
GPG key ID: 6C79278F3FCDCC02
2 changed files with 23 additions and 0 deletions

View file

@ -4,6 +4,10 @@
vars: vars:
service_repo: https://gitlab.federez.net/re2o/dhcp.git service_repo: https://gitlab.federez.net/re2o/dhcp.git
service_name: dhcp service_name: dhcp
service_config:
hostname: re2o-server.adm.auro.re
username: service-user
password: V28GJvhhY2OSE
dhcp: dhcp:
authoritative: true authoritative: true
roles: roles:

View file

@ -10,6 +10,25 @@
become: true become: true
become_user: "{{ service_user }}" 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 - name: Indicate in motd service location
template: template:
src: update-motd.d/05-service.j2 src: update-motd.d/05-service.j2