Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kubespray
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Kubespray
Commits
f6b72fa8
Commit
f6b72fa8
authored
8 years ago
by
Matthew Mosesohn
Browse files
Options
Downloads
Patches
Plain Diff
Make resolvconf preinstall idempotent
parent
4c682951
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
roles/kubernetes/preinstall/tasks/resolvconf.yml
+26
-24
26 additions, 24 deletions
roles/kubernetes/preinstall/tasks/resolvconf.yml
with
26 additions
and
24 deletions
roles/kubernetes/preinstall/tasks/resolvconf.yml
+
26
−
24
View file @
f6b72fa8
...
@@ -3,25 +3,16 @@
...
@@ -3,25 +3,16 @@
command
:
cp -f /etc/resolv.conf "{{ resolvconffile }}"
command
:
cp -f /etc/resolv.conf "{{ resolvconffile }}"
when
:
ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
when
:
ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
-
name
:
Remove search/domain/nameserver options
-
name
:
Add domain/search/nameservers/options to resolv.conf
lineinfile
:
dest
:
"
{{item[0]}}"
state
:
absent
regexp
:
"
^{{
item[1]
}}.*$"
backup
:
yes
follow
:
yes
with_nested
:
-
"
{{
[resolvconffile]
+
[base|default('')]
+
[head|default('')]
}}"
-
[
'
search
'
,
'
nameserver
'
,
'
domain
'
,
'
options
'
]
notify
:
Preinstall | restart network
-
name
:
Add domain/search/nameservers to resolv.conf
blockinfile
:
blockinfile
:
dest
:
"
{{resolvconffile}}"
dest
:
"
{{resolvconffile}}"
block
:
|-
block
:
|-
{% for item in [domainentry] + [searchentries] + nameserverentries.split(',') -%}
{% for item in [domainentry] + [searchentries] + nameserverentries.split(',') -%}
{{ item }}
{{ item }}
{% endfor %}
{% endfor %}
options ndots:{{ ndots }}
options timeout:2
options attempts:2
state
:
present
state
:
present
insertbefore
:
BOF
insertbefore
:
BOF
create
:
yes
create
:
yes
...
@@ -30,21 +21,32 @@
...
@@ -30,21 +21,32 @@
marker
:
"
#
Ansible
entries
{mark}"
marker
:
"
#
Ansible
entries
{mark}"
notify
:
Preinstall | restart network
notify
:
Preinstall | restart network
-
name
:
Add options to resolv.conf
-
name
:
Remove search/domain/nameserver options before block
lineinfile
:
replace
:
line
:
options {{ item }}
dest
:
"
{{item[0]}}"
dest
:
"
{{resolvconffile}}"
regexp
:
'
^{{
item[1]
}}[^#]*(?=#
Ansible
entries
BEGIN)'
state
:
present
regexp
:
"
^options.*{{
item
}}$"
insertafter
:
EOF
backup
:
yes
backup
:
yes
follow
:
yes
follow
:
yes
with_
items
:
with_
nested
:
-
ndots:{{ ndots
}}
-
"
{{
[resolvconffile]
+
[base|default('')]
+
[head|default('')]
}}
"
-
timeout:2
-
[
'
search
'
,
'
nameserver
'
,
'
domain
'
,
'
options
'
]
-
attempts:2
when
:
item[0] != ""
notify
:
Preinstall | restart network
notify
:
Preinstall | restart network
-
name
:
Remove search/domain/nameserver options after block
replace
:
dest
:
"
{{item[0]}}"
regexp
:
'
(#
Ansible
entries
END\n(?:(?!^{{
item[1]
}}).*\n)*)(?:^{{
item[1]
}}.*\n?)+'
replace
:
'
\1'
backup
:
yes
follow
:
yes
with_nested
:
-
"
{{
[resolvconffile]
+
[base|default('')]
+
[head|default('')]
}}"
-
[
'
search
'
,
'
nameserver
'
,
'
domain
'
,
'
options
'
]
when
:
item[0] != ""
notify
:
Preinstall | restart network
-
name
:
get temporary resolveconf cloud init file content
-
name
:
get temporary resolveconf cloud init file content
command
:
cat {{ resolvconffile }}
command
:
cat {{ resolvconffile }}
register
:
cloud_config
register
:
cloud_config
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment