summaryrefslogtreecommitdiffstats
path: root/ansible/infrastructure.yml
blob: 789f8716715c6397a15af70b2da844f9cfd6f7cc (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
- name: Perform common environment setup for nodes
  hosts: infrastructure, kubernetes
  tasks:
    - name: Setup resolv.conf
      lineinfile:
        line: "nameserver {{ hostvars[groups.infrastructure[0]].ansible_host }}"
        path: /etc/resolv.conf
        state: present
        insertbefore: BOF
      become: yes
    - name: Add application offline rpm repository
      yum_repository:
        name: "{{ app_name }}"
        file: "{{ app_name | lower }}"
        description: "{{ app_name }} offline repository"
        baseurl: "{{ 'http://repo.infra-server' if 'infrastructure' not in group_names else 'file://' + app_data_path + '/pkg/rhel' }}"
        gpgcheck: no
        enabled: yes
      when: deploy_rpm_repository
      become: yes

- name: Setup firewall
  hosts: infrastructure, kubernetes
  roles:
    - role: firewall
      vars:
        state: disable

- name: Setup infrastructure servers
  hosts: infrastructure
  roles:
    - certificates
    - docker
    - dns
    - vncserver
    - role: nexus
      vars:
        phase: install
    - nginx
  tasks:
    - name: "wait for nexus to come up"
      uri:
        url: "{{ nexus_url }}/service/metrics/healthcheck"
        user: admin
        password: admin123
        force_basic_auth: yes
        method: GET
      register: nexus_wait
      until: not nexus_wait.failed
      retries: 30
      delay: 10

- name: Nexus changes in runtime
  hosts: infrastructure
  roles:
    - role: nexus
      vars:
        phase: configure
      when: populate_nexus | bool
    - role: nexus
      vars:
        phase: runtime-populate
      when: runtime_images is defined

- name: Setup base for Kubernetes nodes
  hosts: kubernetes
  roles:
    - docker
  tasks:
    - import_tasks: roles/certificates/tasks/upload_root_ca.yml