mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-11-04 12:18:17 +00:00 
			
		
		
		
	Normalized run_once_, made openresty handlers without when aviable and forced flush in run_once when blocks to avoid handlers with when conditions
This commit is contained in:
		@@ -1,36 +1,30 @@
 | 
			
		||||
- name: Create Docker network for PostgreSQL
 | 
			
		||||
  docker_network:
 | 
			
		||||
    name: "{{ postgres_network_name }}"
 | 
			
		||||
    state: present
 | 
			
		||||
    ipam_config:
 | 
			
		||||
      - subnet: "{{ postgres_subnet }}"
 | 
			
		||||
  when: run_once_svc_db_postgres is not defined
 | 
			
		||||
- block:
 | 
			
		||||
  - name: Create Docker network for PostgreSQL
 | 
			
		||||
    docker_network:
 | 
			
		||||
      name: "{{ postgres_network_name }}"
 | 
			
		||||
      state: present
 | 
			
		||||
      ipam_config:
 | 
			
		||||
        - subnet: "{{ postgres_subnet }}"
 | 
			
		||||
 | 
			
		||||
- name: "include docker-compose role"
 | 
			
		||||
  include_role: 
 | 
			
		||||
    name: docker-compose
 | 
			
		||||
  when: run_once_svc_db_postgres is not defined
 | 
			
		||||
  - name: "include docker-compose role"
 | 
			
		||||
    include_role: 
 | 
			
		||||
      name: docker-compose
 | 
			
		||||
 | 
			
		||||
- name: Wait for Postgres inside the container
 | 
			
		||||
  shell: "docker exec {{ postgres_name }} pg_isready -U postgres"
 | 
			
		||||
  register: pg_ready
 | 
			
		||||
  until: pg_ready.rc == 0
 | 
			
		||||
  retries: 30
 | 
			
		||||
  delay: 5
 | 
			
		||||
  when:
 | 
			
		||||
    - run_once_svc_db_postgres is not defined
 | 
			
		||||
  - name: Wait for Postgres inside the container
 | 
			
		||||
    shell: "docker exec {{ postgres_name }} pg_isready -U postgres"
 | 
			
		||||
    register: pg_ready
 | 
			
		||||
    until: pg_ready.rc == 0
 | 
			
		||||
    retries: 30
 | 
			
		||||
    delay: 5
 | 
			
		||||
 | 
			
		||||
- name: install python-psycopg2
 | 
			
		||||
  pacman: 
 | 
			
		||||
    name: python-psycopg2
 | 
			
		||||
    state: present
 | 
			
		||||
  - name: install python-psycopg2
 | 
			
		||||
    pacman: 
 | 
			
		||||
      name: python-psycopg2
 | 
			
		||||
      state: present
 | 
			
		||||
      
 | 
			
		||||
  - include_tasks: utils/run_once.yml
 | 
			
		||||
  when: run_once_svc_db_postgres is not defined
 | 
			
		||||
 | 
			
		||||
- name: "Initialize database for '{{ database_name }}'"
 | 
			
		||||
  include_tasks: init.yml
 | 
			
		||||
  when: "{{ postgres_init }}"
 | 
			
		||||
 | 
			
		||||
- name: Run the docker_postgres tasks once
 | 
			
		||||
  set_fact:
 | 
			
		||||
    run_once_svc_db_postgres: true
 | 
			
		||||
  when: run_once_svc_db_postgres is not defined
 | 
			
		||||
  when: "{{ postgres_init }}"
 | 
			
		||||
		Reference in New Issue
	
	Block a user