Authored by chunhua.zhang

init

  1 +hostfile = ./inventories/test
  2 +roles_path = ./roles
  1 +---
  2 +nameservers:
  3 + - 10.66.4.17
  4 + - 10.66.4.17
  1 +[java-nginx]
  2 +10.66.0.2
  3 +10.66.0.3
  4 +
  5 +
  6 +[java-gateway]
  7 +10.66.70.204
  8 +10.66.70.22
  9 +10.66.0.240
  10 +10.66.0.5
  11 +10.66.0.4
  12 +
  13 +[java-users]
  14 +10.66.70.128
  15 +10.66.70.9
  16 +
  17 +[java-resources]
  18 +10.66.70.128
  19 +10.66.70.9
  20 +
  21 +[java-order]
  22 +10.66.70.170
  23 +10.66.70.41
  24 +
  25 +[java-promotion]
  26 +10.66.70.170
  27 +10.66.70.41
  28 +
  29 +# all java services
  30 +[java-services:children]
  31 +java-users
  32 +java-resources
  33 +java-order
  34 +java-promotion
  35 +
  36 +
  1 +---
  2 +nameservers:
  3 + - 10.66.105.5
  4 + - 10.66.105.9
  5 +
  1 +[java-nginx]
  2 +10.66.104.15
  3 +10.66.104.13
  1 +---
  2 +nameservers:
  3 + - 10.66.200.10
  4 + - 10.66.200.12
  5 +
  1 +[java-nginx-az3]
  2 +10.66.202.5
  3 +10.66.202.12
  1 +---
  2 +nameservers:
  3 + - 10.66.4.17
  4 + - 10.66.4.17
  5 +
  6 +nameserver_timeout: 1
  7 +
  8 +
  9 +
  1 +[server1]
  2 +10.66.200.11
  3 +
  4 +
  1 +- hosts: all
  2 + vars:
  3 + resolv_nameservers:
  4 + - 8.8.8.8
  5 + - 8.8.4.4
  6 + resolv_domain: foo.org
  7 + resolv_search:
  8 + - foo.bar
  9 + - foobar.com
  10 + resolv_options:
  11 + - timeout:2
  12 + - rotate
  13 + roles:
  14 + - ahuffman.resolv
  1 +# Role on galaxy
  2 +- you.rolename
  3 +# Public role on github
  4 +- name: role-public
  5 + src: https://github.com/erasme/role-public.git
  6 +# Private role on github
  7 +- name: role-private
  8 + src: git+ssh://git@github.com/you/role-private.git
  1 +Ansible Role to config /etc/resolv.conf
  2 +=========
  3 +
  4 +An Ansible role to configure /etc/resolv.conf
  5 +
  6 +
  7 +Requirements
  8 +------------
  9 +
  10 +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.
  11 +
  12 +Role Variables
  13 +--------------
  14 +
  15 +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.
  16 +
  17 +Dependencies
  18 +------------
  19 +
  20 +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.
  21 +
  22 +Example Playbook
  23 +----------------
  24 +
  25 +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
  26 +
  27 + - hosts: servers
  28 + roles:
  29 + - { role: username.rolename, x: 42 }
  30 +
  31 +License
  32 +-------
  33 +
  34 +BSD
  35 +
  36 +Author Information
  37 +------------------
  38 +
  39 +An optional section for the role authors to include contact information, or a website (HTML is not allowed).
  1 +---
  2 +nameservers: ''
  3 +nameserver_timeout: 1
  1 +---
  2 +# handlers file for resolv
  1 +galaxy_info:
  2 + author: chunhua.zhang@yoho.cn
  3 + description: ansible roles for configure /etc/resolv.conf
  4 + company: yohobuy.com
  5 +
  6 + # If the issue tracker for your role is not on github, uncomment the
  7 + # next line and provide a value
  8 + # issue_tracker_url: http://example.com/issue/tracker
  9 +
  10 + # Some suggested licenses:
  11 + # - BSD (default)
  12 + # - MIT
  13 + # - GPLv2
  14 + # - GPLv3
  15 + # - Apache
  16 + # - CC-BY
  17 + license: license (GPLv2, CC-BY, etc)
  18 +
  19 + min_ansible_version: 1.2
  20 +
  21 + # If this a Container Enabled role, provide the minimum Ansible Container version.
  22 + # min_ansible_container_version:
  23 +
  24 + # Optionally specify the branch Galaxy will use when accessing the GitHub
  25 + # repo for this role. During role install, if no tags are available,
  26 + # Galaxy will use this branch. During import Galaxy will access files on
  27 + # this branch. If Travis integration is configured, only notifications for this
  28 + # branch will be accepted. Otherwise, in all cases, the repo's default branch
  29 + # (usually master) will be used.
  30 + #github_branch:
  31 +
  32 + #
  33 + # platforms is a list of platforms, and each platform has a name and a list of versions.
  34 + #
  35 + # platforms:
  36 + # - name: Fedora
  37 + # versions:
  38 + # - all
  39 + # - 25
  40 + # - name: SomePlatform
  41 + # versions:
  42 + # - all
  43 + # - 1.0
  44 + # - 7
  45 + # - 99.99
  46 +
  47 + galaxy_tags: []
  48 + # List tags for your role here, one per line. A tag is a keyword that describes
  49 + # and categorizes the role. Users find roles by searching for tags. Be sure to
  50 + # remove the '[]' above, if you add tags to this list.
  51 + #
  52 + # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
  53 + # Maximum 20 tags per role.
  54 +
  55 +dependencies: []
  56 + # List your role dependencies here, one per line. Be sure to remove the '[]' above,
  57 + # if you add dependencies to this list.
  1 +---
  2 +# Configure resolv.conf
  3 +- name: Configure resolv.conf
  4 + template:
  5 + src: resolv.conf.j2
  6 + dest: /etc/resolv.conf
  7 + mode: 0644
  1 +# {{ ansible_managed }}
  2 +
  3 +
  4 +{% for i in nameservers %}
  5 +nameserver {{ i }}
  6 +{% endfor %}
  7 +
  8 +{% if nameserver_timeout %}
  9 + options timeout: {% nameserver_timeout %} rotate
  10 +{% endif %}
  1 +localhost
  2 +
  1 +---
  2 +- hosts: localhost
  3 + remote_user: root
  4 + roles:
  5 + - resolv
  1 +---
  2 +# vars file for resolv
  1 +#!/usr/bin/env ansible-playbook
  2 +
  3 +- include: playbooks/database.yml
  4 +- include: playbooks/stuff.yml