From b696417ec7eb8dbecdcb0f3e9dd56d515f2ddba0 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 17 Jan 2020 22:22:32 -0500 Subject: [PATCH] Update & Rename wordpress/tasks/enable.yml to enable-or-disable.yml --- roles/wordpress/tasks/enable-or-disable.yml | 35 ++++++++++++ roles/wordpress/tasks/enable.yml | 62 --------------------- 2 files changed, 35 insertions(+), 62 deletions(-) create mode 100644 roles/wordpress/tasks/enable-or-disable.yml delete mode 100644 roles/wordpress/tasks/enable.yml diff --git a/roles/wordpress/tasks/enable-or-disable.yml b/roles/wordpress/tasks/enable-or-disable.yml new file mode 100644 index 000000000..b4f7db83c --- /dev/null +++ b/roles/wordpress/tasks/enable-or-disable.yml @@ -0,0 +1,35 @@ +# Apache + +- name: Enable http://box{{ wp_url }} via Apache + command: a2ensite wordpress.conf + when: apache_install and wordpress_enabled + +- name: Disable http://box{{ wp_url }} via Apache + command: a2dissite wordpress.conf + when: apache_install and not wordpress_enabled + +- name: Restart Apache systemd service ({{ apache_service }}) + systemd: + name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/.yml + state: restarted + when: apache_install and apache_enabled + +# NGINX + +- name: Enable http://box{{ wp_url }} via NGINX, by installing {{ nginx_config_dir }}/wordpress-nginx.conf from template + template: + src: wordpress-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/wordpress-nginx.conf" # /etc/nginx/conf.d + when: wordpress_enabled # and nginx_enabled + +- name: Disable http://box{{ wp_url }} via NGINX, by removing {{ nginx_config_dir }}/wordpress-nginx.conf + file: + path: "{{ nginx_config_dir }}/wordpress-nginx.conf" # /etc/nginx/conf.d + state: absent + when: not wordpress_enabled + +- name: Restart 'nginx' systemd service + systemd: + name: nginx + state: restarted + #when: nginx_enabled | bool diff --git a/roles/wordpress/tasks/enable.yml b/roles/wordpress/tasks/enable.yml deleted file mode 100644 index b9b2cf0aa..000000000 --- a/roles/wordpress/tasks/enable.yml +++ /dev/null @@ -1,62 +0,0 @@ -# Apache - -- name: Enable http://box{{ wp_url }} via Apache - command: a2ensite wordpress.conf - when: apache_install and wordpress_enabled - -- name: Disable http://box{{ wp_url }} via Apache - command: a2dissite wordpress.conf - when: apache_install and not wordpress_enabled - -- name: Restart Apache systemd service ({{ apache_service }}) - systemd: - name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/.yml - state: restarted - when: apache_enabled | bool - -# NGINX - -- name: Enable http://box{{ wp_url }} via NGINX, by installing {{ nginx_config_dir }}/wordpress-nginx.conf from template - template: - src: wordpress-nginx.conf.j2 - dest: "{{ nginx_config_dir }}/wordpress-nginx.conf" - when: nginx_install and wordpress_enabled - -- name: Disable http://box{{ wp_url }} via NGINX, by removing {{ nginx_config_dir }}/wordpress-nginx.conf - file: - path: "{{ nginx_config_dir }}/wordpress-nginx.conf" - state: absent - when: nginx_install and not wordpress_enabled - -- name: Restart 'nginx' systemd service - systemd: - name: nginx - state: restarted - when: nginx_enabled | bool - - -- name: Add 'wordpress' variable values to {{ iiab_ini_file }} - ini_file: - path: "{{ iiab_ini_file }}" - section: wordpress - option: "{{ item.option }}" - value: "{{ item.value | string }}" - with_items: - - option: name - value: WordPress - - option: description - value: '"WordPress is a blog and web site management application."' - - option: wordpress_src - value: "{{ wordpress_src }}" - - option: wp_abs_path - value: "{{ wp_abs_path }}" - - option: wp_db_name - value: "{{ wp_db_name }}" - - option: wp_db_user - value: "{{ wp_db_user }}" - - option: wp_url - value: "{{ wp_url }}" - - option: wp_full_url - value: "{{ wp_full_url }}" - - option: wordpress_enabled - value: "{{ wordpress_enabled }}"