Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ardeshir/c1218b2bd848f9eee9080762097bd582 to your computer and use it in GitHub Desktop.
Save ardeshir/c1218b2bd848f9eee9080762097bd582 to your computer and use it in GitHub Desktop.
---
# tasks file for app_service_setup
#
- block:
- name: Deploy application service script
template:
src: service.j2
dest: /etc/init.d/app-{{ app_name }}
owner: root
group: root
mode: 0755
- name: Enable the application service
service:
name: "app-{{ app_name }}"
enabled: True
- name: Set sudo privileges to manage service
blockinfile:
path: /etc/sudoers.d/10_app_support
create: yes
marker: "#{mark} ANSIBLE MANAGED BLOCK: {{ app_name }}"
block: |
%{{ sudogroup }} ALL= NOPASSWD: /sbin/service app-{{ app_name }} st*,\
/sbin/service app-{{ app_name }} restart,\
/sbin/chkconfig app-{{ app_name }} o*
validate: 'visudo -cf %s'
# when: (app_name is defined and deploy_model is defined)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment