Like i said move your ansible-hostname into the roles folder (if you don't have one make one). As far as i know ansible only loads roles from the roles folder, which is probably your issue.
Also his documentation is wrong, he doesn't use hostname_domain, he actually in the code uses hostname_fqdn instead. On Tuesday, September 15, 2015 at 1:41:52 AM UTC-4, Kuberboef wrote: > > > > On Monday, 14 September 2015 18:01:34 UTC+2, Frank Perks wrote: >> >> ansible-hostname is a role, and should be in the roles directory. >> >> Assuming /home/stefaansm/trusty64/Ansible/ is where your playbooks are. >> Then ansible-hostname should be located at >> /home/stefaansm/trusty64/Ansible/roles/ansible-hostname >> >> >> >> On Monday, September 14, 2015 at 8:20:06 AM UTC-4, Kuberboef wrote: >>> >>> >>> Morning all >>> >>> I am sure this has been asked before, I just struggle to find it. >>> I cloned https://github.com/knopki/ansible-hostname >>> Looks good and vagrant calls ansible successfully and all goes wel, >>> untill.... >>> I need to specify variables in the vars/main.yml file. >>> >>> hostname_name = mozzi >>> hostname_domain = mozzi.mydomain.com >>> >>> My error: >>> ERROR: vars from >>> '/home/stefaansm/trusty64/Ansible/ansible-hostname/vars/main.yml' are not a >>> dict >>> >>> Now being a nube at this and not a programmers backside, I seem to be >>> lost here and doc's seem scarce. >>> >>> Mozzi >>> >>> > Morning > > Okay contents of ~/trusty64/Ansible > Ansible > │ ├── ansible-hostname > │ │ ├── defaults > │ │ │ └── main.yml > │ │ ├── LICENSE > │ │ ├── meta > │ │ │ └── main.yml > │ │ ├── README.md > │ │ ├── tasks > │ │ │ └── main.yml > │ │ └── vars > │ │ └── main.yml > > │ └── playbook.yml > > config in playbook: > > - hosts: all > roles: > - { role: ansible-hostname } > > So according to me the role is found and executed correctly, but there is > something wrong > with the way I specify the hostnames in vars/main.yml. > > From the README.md: > > Role Variables > -------------- > > * *hostname_name* - new hostname (not FQDN, before first dot) > * *hostname_domain* - new domain name > > Config in vars/main.yml: > > --- > # vars file for hostname > hostname_name = mozzi > hostname_domain = mozzi.mydomain.com > > Error I get: > > ERROR: vars from > '/home/stefaansm/trusty64/Ansible/ansible-hostname/vars/main.yml' are not a > dict > > How do I make this a dict? > > Again apologies for such a n00b question. > > -- 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/c55ece08-0b4a-416d-87df-112b51206bb7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
