Authored by chunhua.zhang

init

hostfile = ./inventories/test
roles_path = ./roles
\ No newline at end of file
... ...
---
nameservers:
- 10.66.4.17
- 10.66.4.17
... ...
[java-nginx]
10.66.0.2
10.66.0.3
[java-gateway]
10.66.70.204
10.66.70.22
10.66.0.240
10.66.0.5
10.66.0.4
[java-users]
10.66.70.128
10.66.70.9
[java-resources]
10.66.70.128
10.66.70.9
[java-order]
10.66.70.170
10.66.70.41
[java-promotion]
10.66.70.170
10.66.70.41
# all java services
[java-services:children]
java-users
java-resources
java-order
java-promotion
... ...
---
nameservers:
- 10.66.105.5
- 10.66.105.9
\ No newline at end of file
... ...
[java-nginx]
10.66.104.15
10.66.104.13
\ No newline at end of file
... ...
---
nameservers:
- 10.66.200.10
- 10.66.200.12
\ No newline at end of file
... ...
[java-nginx-az3]
10.66.202.5
10.66.202.12
\ No newline at end of file
... ...
---
nameservers:
- 10.66.4.17
- 10.66.4.17
nameserver_timeout: 1
\ No newline at end of file
... ...
[server1]
10.66.200.11
... ...
- hosts: all
vars:
resolv_nameservers:
- 8.8.8.8
- 8.8.4.4
resolv_domain: foo.org
resolv_search:
- foo.bar
- foobar.com
resolv_options:
- timeout:2
- rotate
roles:
- ahuffman.resolv
... ...
# Role on galaxy
- you.rolename
# Public role on github
- name: role-public
src: https://github.com/erasme/role-public.git
# Private role on github
- name: role-private
src: git+ssh://git@github.com/you/role-private.git
\ No newline at end of file
... ...
Ansible Role to config /etc/resolv.conf
=========
An Ansible role to configure /etc/resolv.conf
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
... ...
---
nameservers: ''
nameserver_timeout: 1
\ No newline at end of file
... ...
---
# handlers file for resolv
\ No newline at end of file
... ...
galaxy_info:
author: chunhua.zhang@yoho.cn
description: ansible roles for configure /etc/resolv.conf
company: yohobuy.com
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
\ No newline at end of file
... ...
---
# Configure resolv.conf
- name: Configure resolv.conf
template:
src: resolv.conf.j2
dest: /etc/resolv.conf
mode: 0644
\ No newline at end of file
... ...
# {{ ansible_managed }}
{% for i in nameservers %}
nameserver {{ i }}
{% endfor %}
{% if nameserver_timeout %}
options timeout: {% nameserver_timeout %} rotate
{% endif %}
... ...
---
- hosts: localhost
remote_user: root
roles:
- resolv
\ No newline at end of file
... ...
---
# vars file for resolv
\ No newline at end of file
... ...
#!/usr/bin/env ansible-playbook
- include: playbooks/database.yml
- include: playbooks/stuff.yml
\ No newline at end of file
... ...