ansible-course/04-create-inventory/site.yml

46 lines
794 B
YAML
Raw Permalink Normal View History

2024-07-12 22:39:02 +02:00
---
- hosts: all
become: true
pre_tasks:
- name: install updates for RHEL distros
package:
update_only: yes
update_cache: yes
when: ansible_os_family == "RedHat"
- name: install updates for Debian distros
package:
upgrade: dist
update_cache: yes
when: ansible_os_family == "Debian"
- hosts: all
become: true
tasks:
- name: Install common packages
package:
name:
- htop
- neofetch
- hosts: web_servers
become: true
tasks:
- name: Install apache on web servers
package:
name:
- apache2
- libapache2-mod-php
- hosts: db_servers
become: true
tasks:
- name: install mariadb package on db servers
package:
name: mariadb
state: latest