refs #8025 README added, intentories dir, lab inventory added

This commit is contained in:
Juan Ferrer 2024-09-24 12:20:42 +02:00
parent 876dc60606
commit e43c32fdf0
7 changed files with 81 additions and 5 deletions

36
README.md Normal file
View File

@ -0,0 +1,36 @@
# Verdnatura Ansible playbooks
Collection of Ansible playbooks used in the Verdnatura server farm.
## Install Ansible
Instal Ansible on Debian.
```
apt install ansible
```
## Run playbook
Before merging changes into protected branches, playbooks should be tested
locally to ensure they work properly.
To runan Ansible playbook locally on a temporary host without registering it in
the inventory (on the fly) run the following command.
```
ansible-playbook playbooks/test.yml -u root -i <ip_or_hostname>,
```
*Note the comma at the end of the hostname or IP.*
## Basic playbooks
* **facts.yml**: Collect and display facts from a host.
* **ping.yml**: Checking that a host is alive and reachable by Ansible.
* **test.yml**: Test an specific role. Don't forget to undo changes before pushing!
* **debian.yml**: Setup base Debian server
## Documentation
* https://docs.ansible.com/ansible/latest/reference_appendices/config.html
* https://docs.ansible.com/ansible/latest/collections/ansible/builtin/gather_facts_module.html
* https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html

View File

@ -1,6 +1,6 @@
[defaults]
roles_path = ./roles
inventory = ./hosts
inventory = ./inventories/production
gathering = smart
interpreter_python = auto_silent
remote_user = awx-user

42
inventories/laboratory Normal file
View File

@ -0,0 +1,42 @@
[laboratory]
corelab-proxy1 ansible_host=corelab-proxy1.lab.verdnatura.es
docker-itlab ansible_host=docker-itlab.lab.verdnatura.es
zammad ansible_host=zammad.lab.verdnatura.es
matrix ansible_host=matrix.lab.verdnatura.es
ansible-test ansible_host=ansible-test.lab.verdnatura.es
[network]
opnsense1-test ansible_host=opnsense1-test.lab.verdnatura.es
opnsense2-test ansible_host=opnsense2-test.lab.verdnatura.es
[cephlab]
cephlab01 ansible_host=cephlab01.lab.verdnatura.es
cephlab02 ansible_host=cephlab02.lab.verdnatura.es
cephlab03 ansible_host=cephlab03.lab.verdnatura.es
[cephtest]
cephtest01 ansible_host=cephtest01.lab.verdnatura.es
cephtest02 ansible_host=cephtest02.lab.verdnatura.es
cephtest03 ansible_host=cephtest03.lab.verdnatura.es
[kubepre]
kubepre-helm ansible_host=kubepre-helm.lab.verdnatura.es
kubepre-proxy1 ansible_host=kubepre-proxy1.lab.verdnatura.es
kubepre-proxy2 ansible_host=kubepre-proxy2.lab.verdnatura.es
kubepre-master1 ansible_host=kubepre-master1.lab.verdnatura.es
kubepre-master2 ansible_host=kubepre-master2.lab.verdnatura.es
kubepre-master3 ansible_host=kubepre-master3.lab.verdnatura.es
kubepre-worker1 ansible_host=kubepre-worker1.lab.verdnatura.es
kubepre-worker2 ansible_host=kubepre-worker2.lab.verdnatura.es
kubepre-worker3 ansible_host=kubepre-worker3.lab.verdnatura.es
kubepre-worker4 ansible_host=kubepre-worker4.lab.verdnatura.es
[kubetest]
kubetest-helm ansible_host=kubetest-helm.lab.verdnatura.es
kubetest-master01 ansible_host=kubetest-master01.lab.verdnatura.es
kubetest-master02 ansible_host=kubetest-master02.lab.verdnatura.es
kubetest-master03 ansible_host=kubetest-master03.lab.verdnatura.es
kubetest-worker01 ansible_host=kubetest-worker01.lab.verdnatura.es
kubetest-worker02 ansible_host=kubetest-worker02.lab.verdnatura.es
kubetest-worker03 ansible_host=kubetest-worker03.lab.verdnatura.es
kubetest-worker04 ansible_host=kubetest-worker04.lab.verdnatura.es

View File

@ -1,5 +1,3 @@
# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html
- hosts: all
gather_facts: yes
tasks:
@ -8,4 +6,4 @@
var: ansible_facts
- name: Print variable value
debug:
msg: "Variable: {{ awx_pub_key }}"
msg: "Variable: {{ ansible_fqdn }}"

View File

@ -2,4 +2,4 @@
tasks:
- name: Test role
import_role:
name: linux-base
name: debian-base