Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ops
/
yoho-ansible-roles
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
chunhua.zhang
2018-06-28 16:03:33 +0800
Commit
de72f18d5ff3dc68e625f3dba6f491d42f41cdd8
1 parent
60f1c7ec
将dns 服务器的配置更新到inventory文件中
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
48 additions
and
12 deletions
inventories/az1/group_vars/all.yml
inventories/az1/hosts
inventories/az2/group_vars/all.yml
inventories/az2/hosts
inventories/az3/group_vars/all.yml
inventories/az3/hosts
roles/resolv/defaults/main.yml
roles/resolv/tasks/main.yml
roles/resolv/templates/resolv.conf.j2
scripts/inventory/templates/inventory-az1.j2
scripts/inventory/templates/inventory-az2.j2
scripts/inventory/templates/inventory-az3.j2
inventories/az1/group_vars/all.yml
View file @
de72f18
---
nameservers
:
-
10.66.4.18
-
10.66.4.17
dc
:
qcloud-az1
...
...
inventories/az1/hosts
View file @
de72f18
# inventory file for az1
[nameservers]
10.66.4.18
10.66.4.17
[java-nginx]
10.66.0.2
10.66.0.3
...
...
inventories/az2/group_vars/all.yml
View file @
de72f18
---
nameservers
:
-
10.66.105.5
-
10.66.105.9
dc
:
qcloud-az2
\ No newline at end of file
...
...
inventories/az2/hosts
View file @
de72f18
# inventory file for az2
[nameservers]
10.66.105.5
10.66.105.9
[java-nginx]
10.66.104.15
10.66.104.13
...
...
inventories/az3/group_vars/all.yml
View file @
de72f18
---
nameservers
:
-
10.66.200.10
-
10.66.200.12
dc
:
qcloud-az3
\ No newline at end of file
...
...
inventories/az3/hosts
View file @
de72f18
# inventory file for az2
[nameservers]
10.66.200.10
10.66.200.12
[java-nginx]
10.66.202.5
10.66.202.12
...
...
roles/resolv/defaults/main.yml
View file @
de72f18
---
nameservers
:
'
'
nameserver_timeout
:
1
\ No newline at end of file
...
...
roles/resolv/tasks/main.yml
View file @
de72f18
---
# Configure resolv.conf
# make sure group exists
-
name
:
make sure nameserver groups exist in inventory file
fail
:
msg
:
"
group
{{
item
}}
not
exist!"
when
:
item not in groups
with_items
:
-
nameservers
-
name
:
Configure resolv.conf
template
:
src
:
resolv.conf.j2
...
...
roles/resolv/templates/resolv.conf.j2
View file @
de72f18
# {{ ansible_managed }}
{% for i in
nameservers
%}
{% for i in
groups['nameservers']
%}
nameserver {{ i }}
{% endfor %}
...
...
scripts/inventory/templates/inventory-az1.j2
View file @
de72f18
# inventory file for az1
[nameservers]
10.66.4.18
10.66.4.17
[java-nginx]
10.66.0.2
10.66.0.3
...
...
scripts/inventory/templates/inventory-az2.j2
View file @
de72f18
# inventory file for az2
[nameservers]
10.66.105.5
10.66.105.9
[java-nginx]
10.66.104.15
10.66.104.13
...
...
scripts/inventory/templates/inventory-az3.j2
View file @
de72f18
# inventory file for az2
[nameservers]
10.66.200.10
10.66.200.12
[java-nginx]
10.66.202.5
10.66.202.12
...
...
Please
register
or
login
to post a comment