Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.6 kB
4
Indexable
Never

apache-basic-playbook:
    |_uninstall_packages.yml
    |_instances.txt
    |_hito.yml
    |_roles
        |_apache-hito
            |_defaults
            |   |_main.yml
            |_vars
            |   |_main.yml
            |_handlers
            |   |_main.yml
            |_tasks
            |   |_main.yml
---
uninstall_packages.yml
#Para deshacer los cambios del playbook hito, pruebas, etc

- hosts: web
  name: Uninstall packages
  become: yes
  tasks:
    - name: uninstall apache
      apt:
       name: apache2
       state: absent
    - name: uninstall php
      apt:
       name: php
       state: absent
    - name: uninstall ntpdate
      apt:
       name: ntpdate
       state: absent
    - name: uninstall apache-utils
      apt:
       name: apache2-utils
       state: absent

---
hito.yml
- hosts: web
  name: This is a play within a playbook
  become: yes

  roles:
    - apache-hito
---
instances.txt
[web]
node-1 ansible_host=192.168.56.21
node-2 ansible_host=192.168.56.22
---
defaults/main.yml
# defaults file for apache-hito
apache_test_message: This is a test message
apache_max_keep_alive_requests: 115

---
vars/main.yml
# vars file for apache-hito
http_port: 8080
admin: ansible-devops
content_dir: /webcontent
apache2_packages:
  - apache2
  - apache2-utils
---
handlers/main.yml
# NO EDITAR
---
tasks/main.yml
# tasks file for apache-hito
- name: install apache
  apt:
    name: "{{ item }}"
    state: present
  with_items: "{{ apache2_packages }}"
- name: install php
  apt:
    name: php
    state: present
- name: install ntpdate
  apt:
    name: ntpdate
    state: present

Leave a Comment