ansible-course/08-adding-users/site.yml

62 lines
1.0 KiB
YAML
Raw Permalink Normal View History

2024-07-14 04:10:18 +02:00
---
- hosts: all
become: true
pre_tasks:
- name: install updates for RHEL distros
tags: always
package:
update_only: yes
update_cache: yes
when: ansible_os_family == "RedHat"
- name: install updates for Debian distros
tags: always
package:
upgrade: dist
update_cache: yes
when: ansible_os_family == "Debian"
- hosts: all
become: true
tasks:
- name: Install common packages
package:
name:
- htop
- neofetch
2024-07-14 05:10:41 +02:00
2024-07-14 04:10:18 +02:00
- hosts: web_servers
become: true
tasks:
- name: Install apache on web servers
tags: apache
package:
name:
- apache2
- libapache2-mod-php
- name: Copy html file
tags: website
copy:
src: default_site.html
dest: /var/www/html/index.html
owner: root
group: root
mode: 0644
- hosts: db_servers
tags: db, el
become: true
tasks:
- name: install mariadb package on db servers
package:
name: mariadb
state: latest