ansible-development-environ.../roles/service/molecule/default/converge.yml

59 lines
2.2 KiB
YAML

---
- name: Converge
hosts: all
become: yes
gather_facts: yes
vars:
_service_test_command:
default: /usr/bin/sleep
Alpine: /bin/sleep
Debian: /bin/sleep
Ubuntu-16: /bin/sleep
Ubuntu-18: /bin/sleep
service_test_command: "{{ _service_test_command[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_service_test_command[ansible_os_family] | default(_service_test_command['default'])) }}" # noqa 204 Just long.
roles:
- role: ansible-role-service
service_list:
- name: simple-service
description: Simple Service
start_command: "{{ service_test_command }} 3600"
state: started
enabled: yes
- name: stopped-service
description: Simple Service
start_command: "{{ service_test_command }} 3601"
state: stopped
enabled: no
- name: specific-stop-service
description: Specific Stop Service
start_command: "{{ service_test_command }} 1440"
stop_command: /usr/bin/killall -f "sleep 1440"
- name: specific-user-group-service
description: Specific User Group Service
start_command: "{{ service_test_command }} 28800"
user_name: root
group_name: root
- name: specific-workingdirectory-service
description: Specific WorkingDirectory Service
start_command: "{{ service_test_command }} 57600"
working_directory: /tmp
- name: specific-pattern-service
description: Specific Status Pattern Service
start_command: "{{ service_test_command }} 115200"
status_pattern: 115200
- name: variable-service
description: Service with environment variables
start_command: "{{ service_test_command }} ${time}"
environment_variables:
time: 230400
- name: pidfile-service
description: Service with pidfile
start_command: "{{ service_test_command }} 460800"
pidfile: /var/run/pidfile-service.pid
- name: environmentfile-service
description: Service with environmentfile
start_command: "{{ service_test_command }} 921600"
environmentfile: /environmentfile.txt