Skip to content

Instantly share code, notes, and snippets.

@timss
Created August 17, 2016 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timss/956b84d5b7c368b0f4f164808e6a8d4c to your computer and use it in GitHub Desktop.
Save timss/956b84d5b7c368b0f4f164808e6a8d4c to your computer and use it in GitHub Desktop.
Disable autostart of services after first installation on Debian/Ubuntu
---
- name: Check if service is installed
stat:
path: /etc/init.d/{{ item }}
register: services
with_items:
- apache2
- mysql
- name: Disable autostart of services after installation
file:
src: /dev/null
dest: /etc/systemd/system/{{ item.item }}.service
state: link
when: not item.stat.exists
with_items: services.results
- name: Install services
apt:
name: "{{ item }}"
state: present
with_items:
- apache2
- mysql-common
- mysql-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment