Compare commits

...

4 Commits

Author SHA1 Message Date
f90f251763 Add linter pipeline
Some checks failed
continuous-integration/drone/push Build is failing
2020-06-20 22:49:42 +02:00
8c6dd29da3 Update role acertmgr add var acertmgr_version
Defining variable acertmgr_version from role defaults, allows version
string to be overridden. Role defaults are set in connection: local scope.
This also shortens long line to make this role linter compliant
2020-06-20 22:36:29 +02:00
9cd6777a7c Mitigate lint E204 in roles nginx, web-gw and web-svc 2020-06-20 22:12:05 +02:00
33d86b9ebb Add role common-handlers fixes linter E303
Commonly used handlers can be loaded by dependency. This also replaces
systemctl daemon-reload invocation by its ansible module equivalent.
2020-06-20 21:44:09 +02:00
21 changed files with 63 additions and 32 deletions

12
.drone.yml Normal file
View File

@ -0,0 +1,12 @@
---
name: playbook
kind: pipeline
type: docker
steps:
- name: lint
image: alpine:latest
commands:
- apk add git ansible ansible-lint
- ansible-lint -x305,403,701

View File

@ -0,0 +1,3 @@
---
acertmgr_version: "{{ lookup('url', 'https://raw.githubusercontent.com/moepman/acertmgr/master/version.txt') | trim }}"

View File

@ -8,16 +8,9 @@
- python3-yaml - python3-yaml
- python3-pkg-resources - python3-pkg-resources
- name: Find current acertmgr version
get_url:
url: "https://raw.githubusercontent.com/moepman/acertmgr/master/version.txt"
dest: /tmp/acertmgr.version
vars:
ansible_connection: local
- name: Install acertmgr - name: Install acertmgr
apt: apt:
deb: "https://github.com/moepman/acertmgr/releases/download/{{ lookup('file', '/tmp/acertmgr.version') }}/python3-acertmgr_{{ lookup('file', '/tmp/acertmgr.version') }}-1_all.deb" deb: "https://github.com/moepman/acertmgr/releases/download/{{ acertmgr_version }}/python3-acertmgr_{{ acertmgr_version }}-1_all.deb"
- name: Create config directories - name: Create config directories
file: file:

View File

@ -0,0 +1,4 @@
---
- name: 'Reload systemd'
systemd: daemon_reload=yes

View File

@ -1,7 +1,4 @@
--- ---
- name: Reload systemd
command: systemctl daemon-reload
- name: Restart fastd-exporter - name: Restart fastd-exporter
service: name=fastd-exporter state=restarted service: name=fastd-exporter state=restarted

View File

@ -0,0 +1,4 @@
---
dependencies:
- { role: common-handlers }

View File

@ -3,6 +3,3 @@
- name: Restart fastd - name: Restart fastd
service: name=fastd@{{ site_code }}{{ item }} state=restarted service: name=fastd@{{ site_code }}{{ item }} state=restarted
with_sequence: start=0 count={{ fastd_instances }} with_sequence: start=0 count={{ fastd_instances }}
- name: Reload systemd
command: systemctl daemon-reload

View File

@ -0,0 +1,4 @@
---
dependencies:
- { role: common-handlers }

View File

@ -2,6 +2,3 @@
- name: Reload interfaces - name: Reload interfaces
command: /sbin/ifreload -a command: /sbin/ifreload -a
- name: Reload systemd
command: systemctl daemon-reload

View File

@ -0,0 +1,4 @@
---
dependencies:
- { role: common-handlers }

View File

@ -8,7 +8,13 @@
when: nginx_ssl when: nginx_ssl
- name: Ensure certificates are available - name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ ansible_fqdn }}.key -out /etc/nginx/ssl/{{ ansible_fqdn }}.crt -days 730 -subj "/CN={{ ansible_fqdn }}" creates=/etc/nginx/ssl/{{ ansible_fqdn }}.crt command:
cmd: >
openssl req -x509 -nodes -newkey rsa:2048
-keyout /etc/nginx/ssl/{{ ansible_fqdn }}.key
-out /etc/nginx/ssl/{{ ansible_fqdn }}.crt
-days 730 -subj "/CN={{ ansible_fqdn }}"
creates: /etc/nginx/ssl/{{ ansible_fqdn }}.crt
when: nginx_ssl when: nginx_ssl
notify: Restart nginx notify: Restart nginx

View File

@ -1,7 +1,4 @@
--- ---
- name: Reload systemd
command: systemctl daemon-reload
- name: Restart node_exporter - name: Restart node_exporter
service: name=node_exporter state=restarted service: name=node_exporter state=restarted

View File

@ -0,0 +1,4 @@
---
dependencies:
- { role: common-handlers }

View File

@ -1,8 +1,5 @@
--- ---
- name: Reload systemd
command: systemctl daemon-reload
- name: Restart prometheus - name: Restart prometheus
service: name=prometheus state=restarted service: name=prometheus state=restarted

View File

@ -0,0 +1,4 @@
---
dependencies:
- { role: common-handlers }

View File

@ -1,7 +1,4 @@
--- ---
- name: Reload systemd
command: systemctl daemon-reload
- name: Restart respondd - name: Restart respondd
service: name=respondd state=restarted service: name=respondd state=restarted

View File

@ -1,4 +1,5 @@
--- ---
dependencies: dependencies:
- { role: common-handlers }
- { role: git } - { role: git }

View File

@ -1,7 +1,13 @@
--- ---
- name: Ensure certificates are available - name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ ansible_fqdn }}.key -out /etc/nginx/ssl/{{ ansible_fqdn }}.crt -days 730 -subj "/CN={{ ansible_fqdn }}" creates=/etc/nginx/ssl/{{ ansible_fqdn }}.crt command:
cmd: >
openssl req -x509 -nodes -newkey rsa:2048
-keyout /etc/nginx/ssl/{{ ansible_fqdn }}.key
-out /etc/nginx/ssl/{{ ansible_fqdn }}.crt
-days 730 -subj "/CN={{ ansible_fqdn }}"
creates: /etc/nginx/ssl/{{ ansible_fqdn }}.crt
notify: Restart nginx notify: Restart nginx
- name: Create web content directory - name: Create web content directory

View File

@ -1,7 +1,13 @@
--- ---
- name: Ensure certificates are available - name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ domain }}.key -out /etc/nginx/ssl/{{ domain }}.crt -days 730 -subj "/CN={{ domain }}" creates=/etc/nginx/ssl/{{ domain }}.crt command:
cmd: >
openssl req -x509 -nodes -newkey rsa:2048
-keyout /etc/nginx/ssl/{{ domain }}.key
-out /etc/nginx/ssl/{{ domain }}.crt
-days 730 -subj "/CN={{ domain }}"
creates: /etc/nginx/ssl/{{ domain }}.crt
notify: Restart nginx notify: Restart nginx
- name: Configure certificate manager - name: Configure certificate manager

View File

@ -1,8 +1,5 @@
--- ---
- name: Reload systemd
command: systemctl daemon-reload
- name: Restart yanic - name: Restart yanic
service: name=yanic state=restarted service: name=yanic state=restarted

View File

@ -1,4 +1,5 @@
--- ---
dependencies: dependencies:
- { role: common-handlers }
- { role: go } - { role: go }