1 # Copyright (c) 2018 Intel Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 shell: hostname {{ ansible_hostname }}
18 - name: Delete hosts between markers
21 marker: "# {mark} generated hosts file"
25 block_str: "{{ block_str | default('') + hostvars[item].host_ip + ' ' + hostvars[item].ansible_host + '\n'}}"
26 with_items: "{{ groups['ostack'] }}"
28 - name: Update /etc/hosts
33 marker: "# {mark} generated hosts file"
35 - name: Update /etc/hosts
38 regexp: ".*{{ hostvars[groups['jumphost'][0]].proxy_host }}.*"
39 line: "{{ hostvars[groups['jumphost'][0]].proxy_host_ip }} {{ hostvars[groups['jumphost'][0]].proxy_host }}"
43 path: /etc/sysctl.conf
44 regexp: '^{{ item }}.*'
45 line: "{{ item }} = 1"
47 - 'net.ipv6.conf.all.disable_ipv6'
48 - 'net.ipv6.conf.default.disable_ipv6'
49 - 'net.ipv6.conf.lo.disable_ipv6'
51 - name: Update IP configuration
54 - name: Update resolv.conf
55 shell: echo "{{ 'nameserver ' + hostvars[ansible_host].ansible_default_ipv4.gateway }}" > /etc/resolvconf/resolv.conf.d/base
57 - name: Update name servers
60 - name: Update /etc/environment
62 path: /etc/environment
63 regexp: "{{ item.find }}"
64 line: "{{ item.add }}"
66 - { find: 'http_proxy=', add: "{{ 'export http_proxy=' + lookup('env', 'http_proxy') }}" }
67 - { find: 'https_proxy=', add: "{{ 'export https_proxy=' + lookup('env', 'https_proxy') }}" }
68 - { find: 'ftp_proxy=', add: "{{ 'export ftp_proxy=' + lookup('env', 'ftp_proxy') }}" }
69 - { find: 'no_proxy=', add: "{{ 'export no_proxy=' + lookup('env', 'no_proxy') + ',' + ansible_host + ',' + hostvars[ansible_host].ansible_default_ipv4.address }}" }