diff options
author | Christian Pointner <equinox@spreadspace.org> | 2022-07-21 02:32:05 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2022-07-21 02:32:05 +0200 |
commit | 42bf77ee5763090d2c02f5d2d7a7a686ce09a5e8 (patch) | |
tree | 3b92e824064a5d4be16b73d1e98dcd53672e429c /roles/monitoring/sachet/tasks | |
parent | ele-* playbook refactoring and ele-calypso base install (diff) |
add role for sachet
Diffstat (limited to 'roles/monitoring/sachet/tasks')
-rw-r--r-- | roles/monitoring/sachet/tasks/main.yml | 61 | ||||
-rw-r--r-- | roles/monitoring/sachet/tasks/smstools.yml | 13 |
2 files changed, 74 insertions, 0 deletions
diff --git a/roles/monitoring/sachet/tasks/main.yml b/roles/monitoring/sachet/tasks/main.yml new file mode 100644 index 00000000..bb77dc44 --- /dev/null +++ b/roles/monitoring/sachet/tasks/main.yml @@ -0,0 +1,61 @@ +--- +- name: check if prometheus apt component of spreadspace repo is enabled + assert: + msg: "please enable the 'prometheus' component of spreadspace repo using 'spreadspace_apt_repo_components'" + that: + - spreadspace_apt_repo_components is defined + - "'prometheus' in spreadspace_apt_repo_components" + +- name: generate apt pin file for sachet package + when: sachet_version is defined + copy: + dest: "/etc/apt/preferences.d/sachet.pref" + content: | + Package: sachet + Pin: version {{ sachet_version }}-1 + Pin-Priority: 1001 + +- name: remove apt pin file for sachet package + when: sachet_version is not defined + file: + path: "/etc/apt/preferences.d/sachet.pref" + state: absent + +- name: install apt packages + apt: + name: "sachet{% if sachet_version is defined %}={{ sachet_version }}-1{% endif %}" + state: present + allow_downgrade: yes + notify: restart sachet + +- name: add user for sachet + user: + name: sachet + system: yes + home: /nonexistent + create_home: no + +- name: install and configure smstools + when: "'smstools' in sachet_providers" + include_tasks: smstools.yml + +- name: generate configuration file + template: + src: sachet.yml.j2 + dest: /etc/sachet.yml + owner: sachet + mode: 0600 + notify: restart sachet + +- name: generate systemd service unit + template: + src: sachet.service.j2 + dest: /etc/systemd/system/sachet.service + notify: restart sachet + +- name: make sure sachet is enabled and started + systemd: + name: sachet.service + daemon_reload: yes + state: started + enabled: yes diff --git a/roles/monitoring/sachet/tasks/smstools.yml b/roles/monitoring/sachet/tasks/smstools.yml new file mode 100644 index 00000000..9631a3b7 --- /dev/null +++ b/roles/monitoring/sachet/tasks/smstools.yml @@ -0,0 +1,13 @@ +--- +- name: install smstools + apt: + name: smstools + state: present + +- name: add user sachet to smsd group + user: + name: sachet + groups: smsd + append: yes + +## TODO: configure smstools |