Files
wordpress_setup/site.yml
2022-01-04 23:25:26 +01:00

48 lines
1.3 KiB
YAML

---
- name: Playbook for Wordpress
hosts: localhost
become: true
vars_prompt:
- name: ansible_become_password
prompt: "Enter sudo password: "
private: true
tasks:
- name: Find existing jails
become: true
shell: |
bastille list | cut -f2 -d ' ' |tail -n +2
register: existing_jails
- name: Find started jails
become: true
shell: |
jls| tr -s ' ' |cut -d ' ' -f4|tail -n +2
register: started_jails
- block:
- name: Stop existing jails
command: "bastille stop {{ item.value.name }}"
when: skip_create_jail==0 and item.value.name in started_jails.stdout_lines
loop: "{{jails|dict2items}}"
ignore_errors: true
- name: delete existing jails
command: "bastille destroy -f {{ item.value.name }}"
when: skip_create_jail==0 and item.value.name in existing_jails.stdout_lines
loop: "{{jails|dict2items}}"
register: jail_destroy
failed_when: jail_destroy.stderr != ""
- name: Create Jail
command: "bastille create {{item.value.name}} {{item.value.fbsd_version}} {{item.value.ip}} {{item.value.host_interface}}"
when: skip_create_jail==0
loop: "{{jails|dict2items}}"
- import_tasks: db.yml
- import_tasks: webserver.yml
tags: webserver
- import_tasks: proxy.yml