On 11. april 2017 17:22, Soufiane Benmalek wrote:
I use Ansible to launch new servers on an OpenStack public cloud provider. This is my playbook:--- - name: launch an instance hosts: localhost gather_facts: false tasks: - name: launch an instance os_server: state: present auth: auth_url: https://auth.cloud.ovh.net/v2.0/ username: secret password: secret project_name: secret region_name: SBG3 name: mariadbserver-01 image: CentOS 7 state: present network: Ext-Net flavor: s1-2 key_name: DBaaSOVHKey meta: hostname: mariadb register: newnode - name: Show Server's IP debug: var=item with_items: openstack.instances #newnode.openstack.public_v4 - name: Register the hosts in the inventory add_host: name: "{{ newnode.openstack.public_v4 }}" group: "{{mariadbservers}}" Error: fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'mariadbservers' is undefined\n\nThe error
The reason is in the error message "The error was: 'mariadbservers' is undefined"
Your group: should not be a variable, but name of the group that you would like to add the host in.
-- Kai Stian Olstad -- 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/f7b25847-4ab4-bff6-00a3-3bd992f4a969%40olstad.com. For more options, visit https://groups.google.com/d/optout.
