summaryrefslogtreecommitdiffstats
path: root/ansible/roles/nginx/tasks/main.yml
blob: c59be75f72c9de557b8bff83a9d24aa0fe30c335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
- name: Create configuration directory
  file:
    path: "{{ app_data_path }}/cfg"
    state: directory

- name: Upload configuration to server
  template:
    src: nginx.conf.j2
    dest: "{{ app_data_path }}/cfg/nginx.conf"

- name: Load nginx image
  docker_image:
    name: own_nginx
    load_path: "{{ app_data_path }}/offline_data/docker_images_infra/own_nginx_latest.tar"
    state: present
    timeout: 120

- name: Start nginx
  docker_container:
    name: own_nginx
    image: own_nginx
    networks:
      - name: nexus_network
    ports:
      - "80:80"
      - "443:443"
      - "10001:443"
    volumes:
      - "{{ app_data_path }}/cfg/nginx.conf:/etc/nginx/nginx.conf:ro"
      - "{{ app_data_path }}/certs:/etc/nginx/certs:ro"
      - "{{ app_data_path }}/git-repo:/srv/git:rw"
      - "{{ app_data_path }}/http:/srv/http:rw"
      - "{{ app_data_path }}/pkg/rhel:/srv/http/repo.infra-server/rhel:rw"
      - "{{ app_data_path }}/pkg/ubuntu/xenial:/srv/http/repo.infra-server/ubuntu/xenial:rw"
      - /var/log/nginx:/var/log/nginx:rw
    state: started
    restart_policy: unless-stopped