- Add blackbox exporter role and playbooks - Add cadvisor, docker, httpbin roles - Add app3 deployment playbooks - Configure blackbox monitoring
43 lines
974 B
YAML
43 lines
974 B
YAML
---
|
|
- name: Ensure httpbin container is running
|
|
community.docker.docker_container:
|
|
name: "{{ httpbin_container_name }}"
|
|
image: "{{ httpbin_image }}"
|
|
state: started
|
|
restart_policy: unless-stopped
|
|
ports:
|
|
- "{{ httpbin_port }}:80"
|
|
tags: httpbin
|
|
|
|
- name: Configure UFW for httpbin
|
|
ufw:
|
|
rule: allow
|
|
port: "{{ httpbin_port }}"
|
|
proto: tcp
|
|
comment: "httpbin API"
|
|
tags: httpbin
|
|
|
|
- name: Wait for httpbin to be ready
|
|
wait_for:
|
|
port: "{{ httpbin_port }}"
|
|
host: "{{ ansible_host }}"
|
|
delay: 2
|
|
timeout: 60
|
|
tags: httpbin
|
|
|
|
- name: Verify httpbin is accessible
|
|
uri:
|
|
url: "http://{{ ansible_host }}:{{ httpbin_port }}/get"
|
|
return_content: true
|
|
status_code: 200
|
|
register: httpbin_check
|
|
until: httpbin_check.status == 200
|
|
retries: 5
|
|
delay: 3
|
|
tags: httpbin
|
|
|
|
- name: Show httpbin status
|
|
debug:
|
|
msg: "httpbin successfully deployed at http://{{ ansible_host }}:{{ httpbin_port }}/"
|
|
tags: httpbin
|