On the 'how do i apply roles to specific hosts, I'd go for a full
ntp_server role and an ntp_client role.
Then your site.yml looks like


--------------8<---------------

- hosts: ntpservers
  roles:
    - ntp_server

- hosts: servers
  roles:
    - ntp_client
    - presumably_something_useful

--------------8<------------------

if you want to avoid hardcoding a group into the ntp_client roles
templates, you can pass in a group
name using 'parameterised roles' - though TBH that might be overkill.

the folder layout is then something like (for completeness)

.
├── hosts
├── roles
│   ├── ntp_client
│   │   ├── tasks
│   │   │   └── main.yml
│   │   └── templates
│   │       └── etc
│   │           └── ntp.conf.j2
│   └── ntp_server
│       ├── tasks
│       │   └── main.yml
│       └── templates
│           └── etc
│               └── ntp.conf.j2
└── site.yml



On 22 November 2016 at 14:58, Jon Forrest <[email protected]> wrote:
>
>
> On 11/22/16 12:14 AM, Dick Davies wrote:
>>
>> That playbook tells ansible to create the template on the 'all' group
>> i.e. everything in the inventory.
>>
>> That's what it's trying to do.
>
>
> The moment I read this I realized my mistake. You're absolutely
> right! I had stupidly been thinking that this would happen on
> the control machine. Maximum mea culpa. Changing 'all' to
> 'localhost' fixes the problem and lets me test the template.
> This was driving me crazy.
>
>> for your use case, just make 2 roles: ntp_server and ntp_client, and
>> apply them to groups as required.
>
>
> The issue I was trying to address in my posting is how to
> recognize which role to apply to a host. I think my basic
> idea is sound. All I have to do is avoid making more stupid
> mistakes.
>
> Thank you *very* much!
>
> Jon Forrest
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8d610703-3c86-0c33-0f22-da2e9ed7e86d%40gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAK5eLPQtGV%3D__ztTPgcCoCZCPhN5eQeczVLFXfvjbEX9GM-nJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to