Tok
2018-11-09 04259f14a042c84a1164402d9ac2009c9db6adf5
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# vim: set ft=ansible:
---
- name: Ensure directory /etc/ansible exists
  file:
    path: /etc/ansible
    state: directory
 
- name: Copy over ansible hosts file
  copy:
    src: "{{ ANSIBLE_REPO_PATH }}/workdir/hosts-{{ env_type }}-{{ guid }}"
    dest: /etc/ansible/hosts
 
- name: get idm certificate
  get_url:
    url: "{{idm_ca_url}}"
    dest: /root/ca.crt
    mode: 0440
  when: >
    (install_idm is defined and install_idm == "ldap")
    or 'ldap' in install_idms|d([])
 
- when: >
    (install_idm is defined and install_idm == "htpasswd")
    or 'htpasswd' in install_idms|d([])
  block:
    - name: Install httpd-tools
      package:
        name: httpd-tools
 
    # NOTE: We do not use 'htpasswd' module here because we have 200 entries to
    # create in the htpasswd file. It would take >1min instead of <1s using a
    # jinja2 template.
    - name: Generate htpasswd hash for user_password
      shell: >-
        htpasswd -nb "userN" "{{user_password}}"|cut -d: -f2
      register: htpasswd_line
      when:
        - user_password is defined
        - user_password_hash is not defined
 
    - name: Set fact user_password_hash
      set_fact:
        user_password_hash: "{{htpasswd_line.stdout}}"
      when:
        - user_password is defined
        - user_password_hash is not defined
        - htpasswd_line is succeeded
 
    - name: Generate htpasswd hash for admin user
      shell: >-
        htpasswd -nb "admin" "{{admin_password}}"|cut -d: -f2
      register: htpasswd_line
      when:
        - admin_password_hash is not defined
        - admin_password is defined
 
    - name: Set fact admin_password_hash
      set_fact:
        admin_password_hash: "{{htpasswd_line.stdout}}"
      when:
        - admin_password is defined
        - admin_password_hash is not defined
        - htpasswd_line is succeeded
 
    - name: Generate htpasswd file
      template:
        src: "{{ ANSIBLE_REPO_PATH }}/configs/{{env_type}}/files/htpasswd.openshift"
        dest: /root/htpasswd.openshift
 
- name: Install Host packages for releases before 3.10
  yum:
    state: present
    name:
      - "atomic-openshift-clients-{{ osrelease }}"
      - "atomic-openshift-utils"
      - "atomic-openshift-{{ osrelease }}"
      - "httpd-tools"
  when:
    - osrelease is version_compare('3.10', '<')
  tags:
    - install_openshift_node_packages
 
- name: Install Host packages for releases starting with 3.10
  yum:
    state: present
    name:
      - "atomic-openshift-clients-{{ osrelease }}"
      - "atomic-openshift-{{ osrelease }}"
      - "openshift-ansible-{{ osrelease }}"
      - "httpd-tools"
      - "glusterfs-fuse"
  when:
    - osrelease is version_compare('3.10', '>=')
    - osrelease is version_compare('3.10.45', '!=')
  tags:
    - install_openshift_node_packages
 
- name: Install Host packages for releases starting with 3.10
  yum:
    state: present
    name:
      - "atomic-openshift-clients-{{ osrelease }}"
      - "atomic-openshift-{{ osrelease }}"
      - "openshift-ansible-3.10.47"
      - "httpd-tools"
      - "glusterfs-fuse"
  when:
    - osrelease is version_compare('3.10', '>=')
    - osrelease is version_compare('3.10.45', '==')
  tags:
    - install_openshift_node_packages
 
- name: For OCP 3.10.14 update openshift-ansible package to latest available release (3.10.21)
  yum:
    name: openshift-ansible-3.10.21
    state: present
  when:
    - osrelease is version_compare('3.10.14', '==')
  tags:
    - install_openshift_node_packagee