Hi J,
thanks for taking time to look into this.I was using kitchen-vagrant to do
testing by launching debian in virtualbox. My hosts file,kitchen.yml,
including main.yml and debian.yml files that i have so far in my play book
are attached below. I am also curios if i can call tasks directly through
the playbook or i need to mention their absolute path during the path. when
i tried just the name of the task, it failed with the message "Error: not
found".
*Kitchen.yml*
---
driver:
name: vagrant
provisioner:
name: ansible-playbook
hosts: localhost
remote_user: root
roles_path: roles
playbook: main.yml
ansible_verbose: true
platforms:
- name: debian-8.2
driver_plugin: vagrant
driver_config:
box: debian-8.2
box_url:
https://atlas.hashicorp.com/puppetlabs/boxes/debian-8.2-64-nocm
network:
- ['forwarded_port', {guest: 8080, host: 8080} ]
- ['private_network', { ip: '192.168.33.11' } ]
*main.yml*
---
- include: "roles/tasks/debian.yml"
when: ansible_os_family == 'Debian'
*roles/tasks/debian.yml*
---
- name: Debian | Set newrelic_loaded_os_family
set_fact:
newrelic_loaded_os_family: "{{ ansible_os_family }}"
when: ansible_os_family == 'Debian'
*hosts*
testserver
ansible_connection=ssh
ansible_port=2222
ansible_user=vagrant
*Commands*
1. ansible-playbook -i hosts newrelic-test/main.yml
2. ansible-playbook -i hosts newrelic-test/main.yml --syntax-check
Thanks
On Tuesday, April 19, 2016 at 2:55:24 AM UTC-5, J Hawkesworth wrote:
>
> Hi,
>
> Can you share the whole of your playbook?
>
> You probably need to specify some hosts that you want the playbook to
> apply to (something like this - not tested):
>
>
> ---
> hosts: all
> tasks:
> - name: Debian | Set newrelic_loaded_os_family
> set_fact:
> newrelic_loaded_os_family: "{{ ansible_os_family }}"
>
>
> On Monday, April 18, 2016 at 6:14:49 PM UTC+1, darknight wrote:
>>
>> Hi Everyone,
>>
>> I am a newbie using ansible and trying to write a playbook. I was
>> encountering an issue with using set_fact variable in my play and not sure
>> where i am going wrong . could any one correct me on this error. Thanks for
>> your time
>>
>>
>> *Error*:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *ERROR! 'set_fact' is not a valid attribute for a PlayThe offending line
>> appears to be:---- name: Debian | Set newrelic_loaded_os_family ^ here*
>> while i was trying to set a variable for Debian installation of newrelic.
>> ---
>> - name: Debian | Set newrelic_loaded_os_family
>> set_fact:
>> newrelic_loaded_os_family: "{{ ansible_os_family }}"
>>
>>
>> I have referred to http://docs.ansible.com/ansible/set_fact_module.html
>>
>>
>>
--
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/e0817a63-491c-4a80-86c8-fedc73d625a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.