Пофиксил униерсальность и добавил centos и ubuntu

This commit is contained in:
2025-03-13 17:38:44 +03:00
parent 0c3bacfe9c
commit b6286aa9b7
28 changed files with 229 additions and 101 deletions

3
roles/deploy.yaml Normal file
View File

@@ -0,0 +1,3 @@
---
- name: Import role
import_playbook: role/deploy.yaml

View File

@@ -1,6 +1,11 @@
---
- name: Deploy roles
hosts: production
hosts: all
become: true
become_user: root
become_method: ansible.builtin.sudo
gather_facts: true
roles:
- role
vars_files:
- ../vars/secrets.yml

View File

@@ -0,0 +1,4 @@
---
- name: Пример таски
debug:
msg: "Привет! Я запустился на Debian/Ubuntu! Переменная role_test равна {{ role_test }}"

View File

@@ -1,4 +1,12 @@
---
- name: Example task
debug:
msg: "Hello, Ansible!"
- name: "Определяем ОС"
set_fact:
os_family: "{{ ansible_facts['os_family'] }}"
- name: "Подключаем таски для RedHat совместимых"
include_tasks: "redhat/main.yaml"
when: os_family == "RedHat"
- name: "Подключаем таски для Debian/Ubuntu совместимых"
include_tasks: "debian/main.yaml"
when: os_family == "Debian"

View File

@@ -0,0 +1,4 @@
---
- name: Пример таски
debug:
msg: "Привет! Я запустился на RedHat/CentOS/Fedora!"

View File

@@ -1,6 +0,0 @@
$ANSIBLE_VAULT;1.1;AES256
30363439326335316131303133653930363431336539356134363933656566663330366165616366
6639353565306634613164636161353362643237353933610a323838666436363835303765323930
62333364613535656138623233666635303934376234633937666131366239323436333334646666
6364303839396532310a633636333665346538313931366666333665363163623966666236346666
6464

6
roles/vars/secrets.yml Normal file
View File

@@ -0,0 +1,6 @@
$ANSIBLE_VAULT;1.1;AES256
33333461346434666539316330333661306537303234306132383733633635656139623330346339
3735343834396131623436333737363436346137613337340a393633636663346131353135313332
35656537663832366464316538346565313236306538343537343032373161653366353665366565
3461316135353337640a613137383034663265306666353338326135613961646364373966353863
37313731623164303566383431613131353331363035653630313630353130623066