Condition, Loops and handlers
tasks:
- name: Install httpd service Ubuntu
yum:
name: httpd
state: present
when: ansible_distribution == 'Ubuntu'
- name: Install httpd service Centos
apt:
name: httpd
state: present
when: ansible_distribution == 'Centos' tasks:
- name: Install httpd, git, zip service in Ubuntu
yum:
name: "{{item}}"
state: present
when: ansible_distribution == 'Ubuntu'
loop:
- httpd
- git
- zip
- name: Install httpd, git, zip service in Centos
apt:
name: "{{item}}"
state: present
update_cache: yes
when: ansible_distribution == 'Centos'
loop:
- httpd
- git
- zipLast updated