creating inventories

This commit is contained in:
Caleb Fultz 2024-07-12 16:39:02 -04:00
parent 1450cd913a
commit 23cd031851
4 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,5 @@
[defaults]
inventory = inventory
private_key_file = ~/.ssh/hetzner

View File

@ -0,0 +1,15 @@
---
- hosts: all
become: true
tasks:
#### Ubuntu/Debian Section ####
- name: Install apache2 package with php support
package:
name:
- "{{ apache_package }}"
- "{{ php_package }}"
state: latest
update_cache: yes

View File

@ -0,0 +1,7 @@
[web_servers]
10.0.0.7
10.0.0.8
[db_servers]
10.0.0.5
10.0.0.11

45
create-inventory/site.yml Normal file
View File

@ -0,0 +1,45 @@
---
- 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