<p>After further research, it's evident that it's currently impossible to do this natively.  Therefore, we have to do this in the shell with the <code>command</code> module:</p>

<pre class="lang-sh prettyprint-override"><code>command: openstack container set --property Full-Key={{ KEY }} {{ CONTAINER }}
</code></pre>

CC BY-SA 4.0
2019-11-22T20:04:06.893Z
2019-11-22T20:04:06.893Z
colan
<p>I've got the following OpenStack commands for setting up Swift object storage containers:</p>

<pre class="lang-sh prettyprint-override"><code>openstack container create $CONTAINER_NAME
openstack container set --property Full-Key=$CONTAINER_API_KEY $CONTAINER_NAME
</code></pre>

<p>I'd like to convert them to Ansible so they can be run as part of a role.</p>

<p>For the first command, I know I can use the <a href="https://docs.ansible.com/ansible/latest/modules/os_object_module.html" rel="nofollow noreferrer">os_object</a> module for creating the container, but it doesn't appear to provide a parameter for setting a property, which in this case is for setting up key access to the container.  (It's based on the documentation at <a href="http://docs.clouda.ca/bulk-storage/container-keys" rel="nofollow noreferrer">Container Specific API Keys</a>.)</p>

<p>So how would I execute the second command within Ansible natively, without resorting to running the shell command directly?</p>

CC BY-SA 4.0
2019-09-23T17:36:22.803Z
I created an issue for this at [Allow `os_object` to set container properties](https://github.com/ansible/ansible/issues/62760).
colan
<ansible><storage><openstack>
How does one set up OpenStack Swift (object) storage container-specific API keys with Ansible?
colan
# How does one set up OpenStack Swift (object) storage container-specific API keys with Ansible?

(Asked by: username_0 on 2019-09-21)

I've got the following OpenStack commands for setting up Swift object storage containers:
openstack container create $CONTAINER_NAME
openstack container set --property Full-Key=$CONTAINER_API_KEY $CONTAINER_NAME

I'd like to convert them to Ansible so they can be run as part of a role.
For the first command, I know I can use the os_object module for creating the container, but it doesn't appear to provide a parameter for setting a property, which in this case is for setting up key access to the container.  (It's based on the documentation at Container Specific API Keys.)
So how would I execute the second command within Ansible natively, without resorting to running the shell command directly?

**Tags:** ansible, storage, openstack

> **Comments:**
> **username_0**: I created an issue for this at [Allow `os_object` to set container properties](https://github.com/ansible/ansible/issues/62760).  

---

## 1 answers

### Answer by username_0 on 2019-11-22. Score: 0 | Accepted answer

After further research, it's evident that it's currently impossible to do this natively.  Therefore, we have to do this in the shell with the command module:
command: openstack container set --property Full-Key={{ KEY }} {{ CONTAINER }}


---

