|
33 | 33 | https_proxy: "{{ https_proxy.stdout }}" |
34 | 34 |
|
35 | 35 | - debug: |
36 | | - msg: |
| 36 | + msg: |
37 | 37 | - inventory_hostname = {{ inventory_hostname }} |
38 | 38 | - ansible_default_ipv4.address = {{ ansible_default_ipv4.address }} |
39 | 39 | - mfn_server_installation_folder = {{ mfn_server_installation_folder }} |
|
52 | 52 | - python3-pip |
53 | 53 | - netcat |
54 | 54 | - rsync |
55 | | - - python-dev |
56 | | - - libffi-dev |
57 | | - - libssl-dev |
58 | | - - libxml2-dev |
| 55 | + - python3-dev |
| 56 | + - libffi-dev |
| 57 | + - libssl-dev |
| 58 | + - libxml2-dev |
59 | 59 | - libxslt1-dev |
60 | 60 | - zlib1g-dev |
61 | 61 | state: latest |
62 | 62 |
|
63 | 63 | - name: pip install pyOpenSSL |
64 | 64 | pip: |
65 | | - name: pyOpenSSL |
| 65 | + name: pyOpenSSL |
66 | 66 | executable: pip3 |
67 | 67 | environment: |
68 | 68 | http_proxy: "{{ http_proxy }}" |
69 | 69 | https_proxy: "{{ https_proxy }}" |
70 | 70 |
|
71 | | - - name: Ensure mfn root folder exists |
| 71 | + - name: configure /etc/hosts - disable 127.0.1.1 |
| 72 | + lineinfile: |
| 73 | + path: "/etc/hosts" |
| 74 | + regexp: "^127.0.1.1" |
| 75 | + line: "#127.0.1.1 {{ inventory_hostname }}" |
| 76 | + |
| 77 | + - name: configure /etc/hosts - add ip address hostname mapping |
| 78 | + lineinfile: |
| 79 | + path: "/etc/hosts" |
| 80 | + insertafter: EOF |
| 81 | + line: "{{ ansible_default_ipv4.address }} {{ inventory_hostname }} {{ inventory_hostname }}" |
| 82 | + |
| 83 | + - name: ensure docker is at the latest version |
| 84 | + apt: name=docker-ce update_cache=yes |
| 85 | + register: dockerupdate |
| 86 | + ignore_errors: True |
| 87 | + |
| 88 | + - name: Remove old docker |
| 89 | + apt: |
| 90 | + name: |
| 91 | + - docker |
| 92 | + - docker-engine |
| 93 | + - docker.io |
| 94 | + - runc |
| 95 | + state: absent |
| 96 | + when: dockerupdate.failed |
| 97 | + |
| 98 | + - name: get docker key |
| 99 | + get_url: |
| 100 | + url: https://download.docker.com/linux/ubuntu/gpg |
| 101 | + dest: /etc/apt/docker.gpg.key |
| 102 | + environment: |
| 103 | + http_proxy: "{{ http_proxy }}" |
| 104 | + https_proxy: "{{ https_proxy }}" |
| 105 | + when: dockerupdate.failed |
| 106 | + |
| 107 | + - name: install docker key |
| 108 | + shell: "apt-key add /etc/apt/docker.gpg.key" |
| 109 | + when: dockerupdate.failed |
| 110 | + |
| 111 | + - name: add docker repo |
| 112 | + apt_repository: |
| 113 | + repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable" |
| 114 | + state: present |
| 115 | + when: dockerupdate.failed |
| 116 | + |
| 117 | + - name: ensure docker is at the latest version |
| 118 | + apt: name=docker-ce update_cache=yes |
| 119 | + when: dockerupdate.failed |
| 120 | + |
| 121 | + # The below approach risks when updating the docker using regular software updates. |
| 122 | + # a better way probably is just to override the configuration with a new file |
| 123 | + #- name: fix docker service command line |
| 124 | + # lineinfile: |
| 125 | + # path: /lib/systemd/system/docker.service |
| 126 | + # backrefs: yes |
| 127 | + # regex: "^ExecStart=(.*)-H fd://(.*)$" |
| 128 | + # line: "ExecStart=\\1\\2" |
| 129 | + # when: dockerupdate.failed |
| 130 | + |
| 131 | + #- name: configure docker daemon |
| 132 | + # copy: |
| 133 | + # dest: /etc/docker/daemon.json |
| 134 | + # content: | |
| 135 | + # { |
| 136 | + # "hosts": ["fd://","unix:///var/run/docker.sock","tcp://0.0.0.0"] |
| 137 | + # } |
| 138 | + ################# |
| 139 | + |
| 140 | + # see the following links why this approach might be better |
| 141 | + # https://stackoverflow.com/questions/44052054/unable-to-start-docker-after-configuring-hosts-in-daemon-json |
| 142 | + # https://success.docker.com/article/how-do-i-enable-the-remote-api-for-dockerd |
| 143 | + - name: docker service configuration directory |
72 | 144 | file: |
73 | | - path: "{{ mfn_server_installation_folder }}" |
| 145 | + path: /etc/systemd/system/docker.service.d |
74 | 146 | state: directory |
75 | | - mode: '775' |
| 147 | + |
| 148 | + - name: add override configuration for docker start |
| 149 | + copy: |
| 150 | + dest: /etc/systemd/system/docker.service.d/startup_options.conf |
| 151 | + content: | |
| 152 | + [Service] |
| 153 | + ExecStart= |
| 154 | + ExecStart=/usr/bin/dockerd -H unix:// -H tcp://0.0.0.0:2375 |
| 155 | +
|
| 156 | + - name: override configuration for docker daemon to disable tls |
| 157 | + copy: |
| 158 | + dest: /etc/docker/daemon.json |
| 159 | + content: | |
| 160 | + { |
| 161 | + "tls": false |
| 162 | + } |
| 163 | +
|
| 164 | + - name: configure docker proxy |
| 165 | + copy: |
| 166 | + dest: /etc/systemd/system/docker.service.d/proxy.conf |
| 167 | + content: | |
| 168 | + [Service] |
| 169 | + Environment=HTTP_PROXY={{ http_proxy }} |
| 170 | + Environment=HTTPS_PROXY={{ https_proxy }} |
| 171 | + Environment=NO_PROXY={{ no_proxy }} |
| 172 | + when: http_proxy != "" and dockerupdate.failed |
| 173 | + |
| 174 | + - name: systemd restart docker |
| 175 | + systemd: |
| 176 | + daemon_reload: yes |
| 177 | + name: docker |
| 178 | + enabled: true |
| 179 | + state: restarted |
| 180 | + when: dockerupdate.failed |
76 | 181 |
|
77 | 182 | - name: ensure java is at the latest version |
78 | | - apt: |
| 183 | + apt: |
79 | 184 | name: openjdk-8-jre-headless |
80 | 185 | state: latest |
81 | 186 | update_cache: yes |
82 | 187 |
|
83 | | - - name: get http_proxy |
84 | | - shell: "su - -c 'echo $http_proxy'" |
85 | | - register: http_proxy |
86 | | - |
87 | | - - name: get https_proxy |
88 | | - shell: "su - -c 'echo $https_proxy'" |
89 | | - register: https_proxy |
90 | | - |
91 | | - - set_fact: |
92 | | - http_proxy: "{{ http_proxy.stdout }}" |
93 | | - https_proxy: "{{ https_proxy.stdout }}" |
94 | | - |
95 | | - - debug: |
96 | | - msg: |
97 | | - - http_proxy = {{ http_proxy }} |
98 | | - - https_proxy = {{ https_proxy }} |
| 188 | + - name: Ensure knix mfn root folder exists |
| 189 | + file: |
| 190 | + path: "{{ mfn_server_installation_folder }}" |
| 191 | + state: directory |
| 192 | + mode: '775' |
99 | 193 |
|
100 | 194 | - name: Copy start-all.sh script |
101 | 195 | copy: |
102 | 196 | mode: '775' |
103 | 197 | src: "./scripts/start-all.sh" |
104 | | - dest: "{{ mfn_server_installation_folder }}/" |
| 198 | + dest: "{{ mfn_server_installation_folder }}/" |
105 | 199 |
|
106 | 200 | - name: Copy stop-all.sh script |
107 | 201 | copy: |
|
110 | 204 | dest: "{{ mfn_server_installation_folder }}/" |
111 | 205 |
|
112 | 206 | - name: copy wait-for-it.sh script |
113 | | - copy: |
| 207 | + copy: |
114 | 208 | mode: '775' |
115 | 209 | src: "./scripts/wait-for-it.sh" |
116 | 210 | dest: "{{ mfn_server_installation_folder }}/" |
117 | 211 |
|
118 | 212 | - name: copy tail-service-logs.sh script |
119 | | - copy: |
| 213 | + copy: |
120 | 214 | mode: '775' |
121 | 215 | src: "./scripts/tail-service-logs.sh" |
122 | 216 | dest: "{{ mfn_server_installation_folder }}/" |
123 | 217 |
|
124 | 218 | - name: copy purge-riak.sh script |
125 | | - copy: |
| 219 | + copy: |
126 | 220 | mode: '775' |
127 | 221 | src: "./scripts/purge-riak.sh" |
128 | 222 | dest: "{{ mfn_server_installation_folder }}/" |
129 | 223 |
|
130 | 224 | #https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html |
131 | | - - name: configure /etc/sysctl.conf vm.max_map_count=262144 |
132 | | - sysctl: |
| 225 | + - name: configure /etc/sysctl.conf vm.max_map_count=262144 |
| 226 | + sysctl: |
133 | 227 | name: "vm.max_map_count" |
134 | 228 | value: "262144" |
0 commit comments