Thanks for the info, I am looking forward to that change :)

Currently I am making it work via the following method:
--snip--
- name: Creating Project Networks
  os_network:
    name: "{{ item.0.name }}_{{ item.1.network.name }}"
    state: "{{ item.0.state }}"
    shared: False
    external: False
  environment:
    OS_PROJECT_NAME: "{{ item.0.name }}"
    OS_TENANT_NAME: "{{ item.0.name }}"
    OS_TENANT_ID: ""
--snip--

Changing the OS_ environment vars for this task seem to work, I wouldn't 
attempt to try anything complicated with this approach. However it is 
meeting my needs of adding some defaults to newly created projects.

Michael

On Thursday, March 17, 2016 at 12:19:10 PM UTC-6, David Shrewsbury wrote:
>
> What you're trying to do is not currently supported, but lucky for you,
> a community member has already been working on this:
>
> https://github.com/ansible/ansible-modules-core/pull/3236
>
> This also requires a new release of the shade library to support the
> new project parameter.
>
>
>
> On Thursday, March 17, 2016 at 8:10:20 AM UTC-4, Michael Gale wrote:
>>
>> Hello,
>>
>>     I have an ansible playbook that is responsible for creating all of 
>> the projects we have defined in our projects.yml file. 
>>
>> This playbook currently:
>> - creates all of our projects
>> - adds our admin_group to the projects
>>
>> I am trying to use os_network to create a default private network and 
>> subnet under each project, however the network is always created under my 
>> admin project space.
>>
>> I originally had this code:
>> --snip--
>> - name: Creating Project Networks
>>   os_network:
>>     name: "{{ item.1.network.name }}"
>>     state: "{{ item.0.state }}"
>>     shared: False
>>     external: False
>>   with_subelements:
>>   - "{{ projects }}"
>>   - networks
>> --snip--
>>
>> My credentials are currently set to the default admin account and are 
>> loaded via the OS_ environment variables by sourcing an openrc file. When I 
>> execute the above code all the networks and subnets are created under the 
>> admin tenant.
>>
>> I tried using the following with a hardcoded project_name:
>> --snip--
>> - name: Creating Project Networks
>>   os_network:
>>     auth:
>>       username: admin
>>       password: my_special_password
>>       auth_url: http://<my_ip>:5000/v3
>>       project_name: testproject1
>>     auth_type: password
>>     name: "{{ item.1.network.name }}"
>>     state: "{{ item.0.state }}"
>>     shared: False
>>     external: False
>>   with_subelements:
>>   - "{{ projects }}"
>>   - networks
>> --snip--
>>
>> However the networks are still created under the admin tenant, is it safe 
>> to assume that previous os_* modules have cached an auth token? Is there a 
>> better way to interact with multiple projects when using the os_* modules?
>>
>>
>> Thanks
>> Michael
>>
>

-- 
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/e2127818-4fe6-463d-8d00-3d4b41bc4392%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to