Skip to content

Instantly share code, notes, and snippets.

@rmn-lux
rmn-lux / gist:cfeef675d6770114752cd4aa07cc87c1
Created March 30, 2017 08:15
Conditionals in Ansible, examples
---
- hosts: test
tasks:
- name: Check OS family
debug: msg="This is my OS"
when: ansible_os_family == "Debian"
- name: Check if Apache2 is installed
command: dpkg-query -W apache2
@rmn-lux
rmn-lux / gist:7e6caf6900353f9144af0d2125b673aa
Created March 28, 2017 08:04
elegant method for create files in Ansible
- name: ensure file exists
copy:
content: ""
dest: /etc/nologin
force: no
group: sys
owner: root
mode: 0555