summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node/files/bootstrap.yml
blob: ea280640f71e69ab92eff67f06e8258df3379801 (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
#!/usr/bin/ansible-playbook
---
- hosts: localhost
  gather_facts: yes
  vars:
    origin_dns:
      file: /etc/dnsmasq.d/origin-dns.conf
      lines:
      - regex: ^listen-address
        state: present
        line: "listen-address={{ ansible_default_ipv4.address }}"
    node_dns:
      file: /etc/dnsmasq.d/node-dnsmasq.conf
      lines:
      - regex: "^server=/in-addr.arpa/127.0.0.1$"
        line: server=/in-addr.arpa/127.0.0.1
      - regex: "^server=/cluster.local/127.0.0.1$"
        line: server=/cluster.local/127.0.0.1

  tasks:
  - include_vars: openshift_settings.yaml

  - name: set the data for node_dns
    lineinfile:
      create: yes
      insertafter: EOF
      path: "{{ node_dns.file }}"
      regexp: "{{ item.regex }}"
      line: "{{ item.line | default(omit) }}"
    with_items: "{{ node_dns.lines }}"

  - name: set the data for origin_dns
    lineinfile:
      create: yes
      state: "{{ item.state | default('present') }}"
      insertafter: "{{ item.after | default(omit) }}"
      path: "{{ origin_dns.file }}"
      regexp: "{{ item.regex }}"
      line: "{{ item.line | default(omit)}}"
    with_items: "{{ origin_dns.lines }}"

  - when:
    - openshift_group_type is defined
    - openshift_group_type != ''
    - openshift_group_type != 'master'
    block:
    - name: determine the openshift_service_type
      stat:
        path: /etc/sysconfig/atomic-openshift-node
      register: service_type_results

    - name: set openshift_service_type fact based on stat results
      set_fact:
        openshift_service_type: "{{ service_type_results.stat.exists | ternary('atomic-openshift', 'origin') }}"

    - name: update the sysconfig to have necessary variables
      lineinfile:
        dest: "/etc/sysconfig/{{ openshift_service_type }}-node"
        line: "{{ item.line }}"
        regexp: "{{ item.regexp }}"
      with_items:
      - line: "BOOTSTRAP_CONFIG_NAME=node-config-{{ openshift_group_type }}"
        regexp: "^BOOTSTRAP_CONFIG_NAME=.*"