Created
August 17, 2016 08:07
-
-
Save timss/956b84d5b7c368b0f4f164808e6a8d4c to your computer and use it in GitHub Desktop.
Disable autostart of services after first installation on Debian/Ubuntu
This file contains hidden or 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
--- | |
- 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