Files
2026-10-18 16:41:04 +02:00

36 lines
841 B
YAML

---
- hosts: all
post_tasks:
- name: Check all port numbers are accessible from current host
wait_for:
host: "{{inventory_hostname}}"
port: "{{ item }}"
state: started
delay: 0
timeout: 1
ignore_errors: yes
with_items:
- 443
- 80
- 8080
pre_tasks:
- name: "debug"
debug:
msg: "PRE task played at {{ansible_date_time.date}} {{ansible_date_time.time}}"
tasks:
- name: "Main tasks :"
debug:
msg: " server {{inventory_hostname}}"
- name: "Main task"
become: true
apt:
name: apache2
state: present
- name: "Start Apache"
become: true
ansible.builtin.service:
name: apache2
state: started