mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			70 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| - name: Remove stale files (usb-lib.conf, modules.conf) from {{ nginx_conf_dir }}
 | |
|   file:
 | |
|     path: "{{ item.path }}"
 | |
|     state: absent
 | |
|   with_items:
 | |
|     - { path: "/etc/systemd/system/uwsgi.service" }
 | |
|     - { path: "{{ nginx_conf_dir }}/usb-lib.conf" }
 | |
|     - { path: "{{ nginx_conf_dir }}/modules.conf" }
 | |
| 
 | |
| - name: Ensure that Apache (({{ apache_service }})) is not running -- we may need port swap
 | |
|   systemd:
 | |
|     name: "{{ apache_service }}"
 | |
|     state: stopped
 | |
| 
 | |
| - name: "Install from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/{{ apache_service }}/ports.conf, {{ nginx_conf_dir }}/iiab.conf"
 | |
|   template:
 | |
|     src: "{{ item.src}}"
 | |
|     dest: "{{ item.dest }}"
 | |
|   with_items:
 | |
|     - { src: 'server.conf.j2', dest: '/etc/nginx/server.conf' }
 | |
|     - { src: 'nginx.conf.j2', dest: '/etc/nginx/nginx.conf' }
 | |
|     - { src: 'ports.conf.j2', dest: "/etc/{{ apache_service }}/ports.conf" }
 | |
|     - { src: 'iiab.conf.j2', dest: "{{ nginx_conf_dir }}/iiab.conf" }
 | |
|   when: nginx_enabled | bool
 | |
| 
 | |
| # the below slides in nginx's proxypass config files for apache on localhost
 | |
| # via the ports.conf file installed above
 | |
| #- name: Install proxpass to Apache running on localhost port {{ apache_port }}
 | |
| #  include_tasks: uses_apache.yml
 | |
| #  when: apache_enabled | bool
 | |
| 
 | |
| # the below task contains the same logic contained in the playbooks to enable
 | |
| # 'runrole nginx' to do the right thing but with the 'src' path set to role's
 | |
| # templates path ie roles/<rolename>/template/
 | |
| #- name: Install proxpass to other services 'dual mode' roles
 | |
| #  include_tasks: only_nginx.yml
 | |
| #  when: nginx_enabled | bool
 | |
| 
 | |
| - name: Stop & Disable 'nginx' systemd service, when not nginx_enabled
 | |
|   systemd:
 | |
|     name: nginx
 | |
|     state: stopped
 | |
|     enabled: false
 | |
|   when: not nginx_enabled
 | |
| 
 | |
| - name: Disable Apache port {{ apache_port }} localhost only, when not nginx_enabled
 | |
|   template:
 | |
|     dest: /etc/{{ apache_service }}/ports.conf
 | |
|     src: stock-apache-ports.conf
 | |
|   when: not nginx_enabled
 | |
| 
 | |
| # should have the logic to handle both modes in the playbook
 | |
| #- name: Enable Apache (a2ensite) for 'dual mode' for the role when NGINX is disabled
 | |
| #  include_tasks: disable.yml
 | |
| #  when: not nginx_enabled
 | |
| 
 | |
| - name: Enable & Restart Apache, since we stopped it ({{ apache_service }})
 | |
|   systemd:
 | |
|     name: "{{ apache_service }}"
 | |
|     daemon_reload: yes
 | |
|     state: restarted
 | |
|     enabled: true
 | |
|   when: apache_enabled or not nginx_enabled
 | |
| 
 | |
| - name: Enable & Restart NGINX, to pick up the config files installed
 | |
|   systemd:
 | |
|     name: nginx
 | |
|     state: restarted
 | |
|     enabled: true
 | |
|   when: nginx_enabled | bool
 |