Forked from anonymous/gist:b2a8a719d99bbb6c64d2848802c88b39
Created
September 1, 2017 15:43
-
-
Save ardeshir/72ed952041871aa2490d30bcc2581bd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# 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