mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-11-04 12:18:17 +00:00 
			
		
		
		
	Moved blocks to include_tasks to raise performance. Deploy was really slow
This commit is contained in:
		
							
								
								
									
										49
									
								
								roles/srv-web-7-4-core/tasks/01_core.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								roles/srv-web-7-4-core/tasks/01_core.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
- name: Include openresty
 | 
			
		||||
  # Outside of run_once block is necessary for handler loading
 | 
			
		||||
  # Otherwise the when: condition from the block is added to the handlers
 | 
			
		||||
  # Inside openresty their is a validation that it doesn't run multiple times
 | 
			
		||||
  include_role:
 | 
			
		||||
    name: svc-prx-openresty
 | 
			
		||||
    public: false
 | 
			
		||||
    # Explicit set to guaranty that application_id will not be overwritten.
 | 
			
		||||
    # Should be anyhow the default case
 | 
			
		||||
 | 
			
		||||
- name: "reset (if enabled)"
 | 
			
		||||
  include_tasks: 02_reset.yml
 | 
			
		||||
  when: mode_reset | bool
 | 
			
		||||
  
 | 
			
		||||
- name: Ensure nginx configuration directories are present
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ item }}"
 | 
			
		||||
    state: directory
 | 
			
		||||
    owner: "{{nginx.user}}"
 | 
			
		||||
    group: "{{nginx.user}}"
 | 
			
		||||
    mode: '0755'
 | 
			
		||||
    recurse: yes
 | 
			
		||||
  loop: >
 | 
			
		||||
    {{
 | 
			
		||||
      [ nginx.directories.configuration ] +
 | 
			
		||||
      ( nginx.directories.http.values() | list ) +
 | 
			
		||||
      [ nginx.directories.streams ] 
 | 
			
		||||
    }}
 | 
			
		||||
 | 
			
		||||
- name: Ensure nginx data storage directories are present
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ item }}"
 | 
			
		||||
    state: directory
 | 
			
		||||
    recurse: yes
 | 
			
		||||
    owner: "{{nginx.user}}"
 | 
			
		||||
    group: "{{nginx.user}}"
 | 
			
		||||
    mode:  '0755'
 | 
			
		||||
  loop: >
 | 
			
		||||
    {{ nginx.directories.data.values() | list }}
 | 
			
		||||
  
 | 
			
		||||
- name: "Include tasks to create cache directories"
 | 
			
		||||
  include_tasks: 03_cache_directories.yml
 | 
			
		||||
 | 
			
		||||
- name: create nginx config file
 | 
			
		||||
  template: 
 | 
			
		||||
    src:  nginx.conf.j2 
 | 
			
		||||
    dest: "{{ nginx.files.configuration }}"
 | 
			
		||||
  notify: restart openresty
 | 
			
		||||
  
 | 
			
		||||
@@ -1,53 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Include openresty
 | 
			
		||||
  # Outside of run_once block is necessary for handler loading
 | 
			
		||||
  # Otherwise the when: condition from the block is added to the handlers
 | 
			
		||||
  # Inside openresty their is a validation that it doesn't run multiple times
 | 
			
		||||
  include_role:
 | 
			
		||||
    name: svc-prx-openresty
 | 
			
		||||
    public: false
 | 
			
		||||
    # Explicit set to guaranty that application_id will not be overwritten.
 | 
			
		||||
    # Should be anyhow the default case
 | 
			
		||||
 | 
			
		||||
- block:  
 | 
			
		||||
  - name: "reset (if enabled)"
 | 
			
		||||
    include_tasks: 01_reset.yml
 | 
			
		||||
    when: mode_reset | bool
 | 
			
		||||
    
 | 
			
		||||
  - name: Ensure nginx configuration directories are present
 | 
			
		||||
    file:
 | 
			
		||||
      path: "{{ item }}"
 | 
			
		||||
      state: directory
 | 
			
		||||
      owner: "{{nginx.user}}"
 | 
			
		||||
      group: "{{nginx.user}}"
 | 
			
		||||
      mode: '0755'
 | 
			
		||||
      recurse: yes
 | 
			
		||||
    loop: >
 | 
			
		||||
      {{
 | 
			
		||||
        [ nginx.directories.configuration ] +
 | 
			
		||||
        ( nginx.directories.http.values() | list ) +
 | 
			
		||||
        [ nginx.directories.streams ] 
 | 
			
		||||
      }}
 | 
			
		||||
  
 | 
			
		||||
  - name: Ensure nginx data storage directories are present
 | 
			
		||||
    file:
 | 
			
		||||
      path: "{{ item }}"
 | 
			
		||||
      state: directory
 | 
			
		||||
      recurse: yes
 | 
			
		||||
      owner: "{{nginx.user}}"
 | 
			
		||||
      group: "{{nginx.user}}"
 | 
			
		||||
      mode:  '0755'
 | 
			
		||||
    loop: >
 | 
			
		||||
      {{ nginx.directories.data.values() | list }}
 | 
			
		||||
    
 | 
			
		||||
  - name: "Include tasks to create cache directories"
 | 
			
		||||
    include_tasks: 02_cache_directories.yml
 | 
			
		||||
  
 | 
			
		||||
  - name: create nginx config file
 | 
			
		||||
    template: 
 | 
			
		||||
      src:  nginx.conf.j2 
 | 
			
		||||
      dest: "{{ nginx.files.configuration }}"
 | 
			
		||||
    notify: restart openresty
 | 
			
		||||
  
 | 
			
		||||
- block:
 | 
			
		||||
  - include_tasks: 01_core.yml
 | 
			
		||||
  - include_tasks: utils/run_once.yml
 | 
			
		||||
  when: run_once_srv_web_7_4_core is not defined
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user