Antonio Pulido 2 rokov pred
rodič
commit
29eb026b23

+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/README.md → T2/Ej4-Playbooks-sencillos/README.md


+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/ansible.cfg → T2/Ej4-Playbooks-sencillos/ansible.cfg


+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/borra_fichero_hola.yaml → T2/Ej4-Playbooks-sencillos/borra_fichero_hola.yaml


+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/borra_user_pepe.yml → T2/Ej4-Playbooks-sencillos/borra_user_pepe.yml


+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/crea_fichero_hola.yaml → T2/Ej4-Playbooks-sencillos/crea_fichero_hola.yaml


+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/crea_user_pepe.yml → T2/Ej4-Playbooks-sencillos/crea_user_pepe.yml


+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/host_vars/localhost → T2/Ej4-Playbooks-sencillos/host_vars/localhost


+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/modifica_motd.yaml → T2/Ej4-Playbooks-sencillos/modifica_motd.yaml


+ 0 - 0
T2-Ej/Ej4-Playbooks-sencillos/systems → T2/Ej4-Playbooks-sencillos/systems


+ 54 - 0
T3/variables.yml

@@ -0,0 +1,54 @@
+---
+
+- name: Deploy & start apache
+  hosts: webserver
+  vars:
+    web_pkg: httpd
+    firewall_pkg: firewalld
+    web_service: httpd
+    firewall_service: firewalld
+    python_pkg: python3-PyMySQL
+    rule: http
+
+  tasks:
+    - name: required packages installed and updated
+      yum:
+        name:
+          - "{{ web_pkg }}"
+          - "{{ firewall_pkg }}"
+          - "{{ python_pkg }}"
+        state: latest
+
+    - name: fw started and enabled
+      service:
+        name: "{{ firewall_service }}"
+        state: started
+        enabled: true
+
+    - name: http started and enabled
+      service:
+        name: "{{ web_service }}"
+        state: started
+        enabled: true
+    
+    - name: web content is in place
+      copy:
+        content: "This is an example web content"
+        dest: /var/www/html/index.html
+
+    - name: firewall port open
+      firewalld:
+        service: "{{ rule }}"
+        permanent: true
+        immediate: true
+        state: enabled
+
+
+- name: Verify Apache service
+  hosts: localhost
+  become: false
+  tasks:
+    - name: ensure webserver is reachable
+      uri:
+        url: http://servera.lab.example.com
+        status_code: 200