2021-11-09 16:01:39 -06:00
|
|
|
---
|
|
|
|
- name: Install python-webssh
|
|
|
|
become: yes
|
|
|
|
package:
|
|
|
|
name: python-webssh
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Standardize the servicefile
|
|
|
|
become: yes
|
|
|
|
register: servicefile
|
2022-11-20 20:03:01 -06:00
|
|
|
copy:
|
2021-11-09 16:01:39 -06:00
|
|
|
src: cyberbrain.service
|
|
|
|
dest: /usr/lib/systemd/system/cyberbrain.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
|
|
|
|
- name: Ensure default webssh service file is off.
|
|
|
|
become: yes
|
|
|
|
service:
|
|
|
|
name: webssh
|
|
|
|
state: stopped
|
2022-11-20 20:03:01 -06:00
|
|
|
enabled: no
|
2021-11-09 16:01:39 -06:00
|
|
|
|
|
|
|
- systemd:
|
|
|
|
daemon_reload: true
|
|
|
|
when: servicefile.changed
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
- name: Ensure service is restarted
|
|
|
|
when: servicefile.changed
|
|
|
|
become: yes
|
|
|
|
service:
|
|
|
|
name: cyberbrain.service
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
|
|
|
|
- name: Ensure service is started
|
|
|
|
when: not servicefile.changed
|
|
|
|
become: yes
|
|
|
|
service:
|
|
|
|
name: cyberbrain.service
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
|
|
|
|
- name: Add the webserver conf file
|
|
|
|
become: yes
|
|
|
|
register: webserver_conf
|
|
|
|
copy:
|
|
|
|
src: cyberbrain.conf
|
|
|
|
dest: /opt/openresty/nginx/conf.d/cyberbrain.conf
|
|
|
|
owner: root
|
|
|
|
group: http
|
|
|
|
mode: 0750
|
|
|
|
|
|
|
|
- name: Ensure the password file is seeded
|
|
|
|
become: yes
|
|
|
|
template:
|
|
|
|
src: cyberbrain.htpasswd.j2
|
|
|
|
dest: /opt/openresty/nginx/passwords/cyberbrain.htpasswd
|
|
|
|
owner: root
|
|
|
|
group: http
|
|
|
|
mode: 0750
|
|
|
|
|
|
|
|
- name: Reload openresty
|
|
|
|
become: yes
|
|
|
|
when: webserver_conf.changed
|
|
|
|
service:
|
|
|
|
name: openresty.service
|
|
|
|
state: reloaded
|
|
|
|
|