Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #232 Added Volume mount support for container instances #338

Merged
merged 21 commits into from
Oct 14, 2021
Merged

Fixed issue #232 Added Volume mount support for container instances #338

merged 21 commits into from
Oct 14, 2021

Conversation

aparna-patil
Copy link
Contributor

SUMMARY

This pull request adds support for mounting volumes in container instance. With this feature, following types of Volumes can be mounted :

  1. Empty directory Volume
  2. Secret Volume
  3. Git Repo Volume
  4. Azure File Share Volume

Fixes #232

ISSUE TYPE
  • Bugfix Pull Request
  • Feature Pull Request
COMPONENT NAME

azure_rm_containerinstance
azure_rm_containerinstance_info

ADDITIONAL INFORMATION

Reference : https://docs.microsoft.com/en-us/rest/api/container-instances/containergroups/createorupdate#volume

@aparna-patil
Copy link
Contributor Author

Hi @Fred-sun
Could you please help review this PR? As part of local sanity testing, I was getting some documentation errors, so tried to correct documentation as well through this PR. Kindly let me know if that's acceptable.
Thanks for your help!

@Fred-sun
Copy link
Collaborator

ERROR: tests/sanity/ignore-2.10.txt:48:1: A100: Ignoring 'doc-type-does-not-match-spec' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.10.txt:49:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.10.txt:50:1: A100: Ignoring 'doc-elements-mismatch' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.10.txt:51:1: A100: Ignoring 'doc-required-mismatch' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.10.txt:55:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance_info.py' is unnecessary

image: httpd
memory: 1.5
volume_mounts:
- name: filesharevolume
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did this account name ? It can't access?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Fred-sun Apologies, I didn't get your question. Could you please elaborate your question so that I can understand it better and take the action? Thank you!
FYI - I am referring to this document for Azure file volumes - https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files

On line no. 165 volumes specification is initialized and there we have specified three parameters (storage_account_name, share_name and storage_account_key) which are needed in order to mount azure file volume on container instance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Fred-sun Could you please guide me here to understand what changes are required for line no. 160? Thanks for your help!

@Fred-sun Fred-sun added medium_priority Medium priority new_feature New feature requirments work in In trying to solve, or in working with contributors labels Nov 30, 2020
@aparna-patil
Copy link
Contributor Author

ERROR: tests/sanity/ignore-2.10.txt:48:1: A100: Ignoring 'doc-type-does-not-match-spec' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.10.txt:49:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.10.txt:50:1: A100: Ignoring 'doc-elements-mismatch' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.10.txt:51:1: A100: Ignoring 'doc-required-mismatch' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.10.txt:55:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance_info.py' is unnecessary

Hi @Fred-sun , Done - updated this file. Thank you!

@aparna-patil
Copy link
Contributor Author

Hi @Fred-sun , Could you please help provide your feedback on this PR ? Kindly let me know if any more changes are required ? Will incorporate those changes.
Since, currently there is no support to mount any type of volume in container instances we are using AZ command line option to do this task. Thanks for your help!

@aparna-patil
Copy link
Contributor Author

Hello @Fred-sun , Could you please help review this PR whenever you get some time? Thank you

@Fred-sun
Copy link
Collaborator

@aparna-patil Please!

ERROR: tests/sanity/ignore-2.9.txt:15:1: A100: Ignoring 'doc-type-does-not-match-spec' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.9.txt:16:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.9.txt:17:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance_info.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:50:1: A100: Ignoring 'doc-type-does-not-match-spec' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:51:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:52:1: A100: Ignoring 'doc-elements-mismatch' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:53:1: A100: Ignoring 'doc-required-mismatch' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:57:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance_info.py' is unnecessary

@aparna-patil
Copy link
Contributor Author

@aparna-patil Please!

ERROR: tests/sanity/ignore-2.9.txt:15:1: A100: Ignoring 'doc-type-does-not-match-spec' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.9.txt:16:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.9.txt:17:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance_info.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:50:1: A100: Ignoring 'doc-type-does-not-match-spec' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:51:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:52:1: A100: Ignoring 'doc-elements-mismatch' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:53:1: A100: Ignoring 'doc-required-mismatch' on 'plugins/modules/azure_rm_containerinstance.py' is unnecessary
ERROR: tests/sanity/ignore-2.11.txt:57:1: A100: Ignoring 'parameter-type-not-in-doc' on 'plugins/modules/azure_rm_containerinstance_info.py' is unnecessary

Hi @Fred-sun , Updated sanity check files. Thank you. Could you please help review the PR again post changes?

@Ompragash
Copy link
Member

@Fred-sun Could you kindly check on this PR?

@Fred-sun
Copy link
Collaborator

Fred-sun commented Apr 6, 2021

@Fred-sun Could you kindly check on this PR?

@Ompragash Okay! I'm working! Thank you very much!

@aparna-patil
Copy link
Contributor Author

Hi @Fred-sun Could you please help me review and push these changes? This feature is stuck from long time, please help me...

@aparna-patil
Copy link
Contributor Author

Hi @Fred-sun resolved merge conflicts and corrected tests/integration/targets/azure_rm_containerinstance/tasks/main.yml file.

Sharing the local integration test results below. Could you please help review once again? Thank you!

root@my-vm:~/ansible# ansible-test integration azure_rm_containerinstance --allow-destructive -vvv
RLIMIT_NOFILE: (1024, 1048576)
MAXFD: -1
>>> Container Database
{}
Run command: /usr/bin/python /root/ansible/test/lib/ansible_test/_data/yamlcheck.py
Working directory: /root/ansible
Program found: /usr/bin/python
HOME=/root
LC_ALL=en_US.UTF-8
PATH=/root/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Run command: /usr/bin/python /root/ansible/test/lib/ansible_test/_data/versions.py
Working directory: /root/ansible
Program found: /usr/bin/python
HOME=/root
LC_ALL=en_US.UTF-8
PATH=/root/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Run command: /usr/bin/python3 /root/ansible/test/lib/ansible_test/_data/versions.py
Working directory: /root/ansible
Program found: /usr/bin/python3
HOME=/root
LC_ALL=en_US.UTF-8
PATH=/root/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Run command: /usr/bin/python3.8 /root/ansible/test/lib/ansible_test/_data/versions.py
Working directory: /root/ansible
Program found: /usr/bin/python3.8
HOME=/root
LC_ALL=en_US.UTF-8
PATH=/root/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
>>> Environment Description
{
    "known_hosts_hash": "b0709d04e0374eb987a2282fdbcbc8b6349e418038aa0c7972062d8eac2998c9",
    "pip_interpreters": {
        "": "#!/usr/bin/python3",
        "3": "#!/usr/bin/python3",
        "3.8": "#!/usr/bin/python3"
    },
    "pip_paths": {
        "": "/usr/local/bin/pip",
        "2": null,
        "2.6": null,
        "2.7": null,
        "3": "/usr/local/bin/pip3",
        "3.5": null,
        "3.6": null,
        "3.7": null,
        "3.8": "/usr/local/bin/pip3.8",
        "3.9": null
    },
    "program_versions": {
        "": [
            "3.8.2 (default, Jul 16 2020, 14:00:26)",
            "[GCC 9.3.0]",
            "pip 21.1.1 from /usr/local/lib/python3.8/dist-packages/pip-21.1.1-py3.8.egg/pip"
        ],
        "3": [
            "3.8.2 (default, Jul 16 2020, 14:00:26)",
            "[GCC 9.3.0]",
            "pip 21.1.1 from /usr/local/lib/python3.8/dist-packages/pip-21.1.1-py3.8.egg/pip"
        ],
        "3.8": [
            "3.8.2 (default, Jul 16 2020, 14:00:26)",
            "[GCC 9.3.0]",
            "pip 21.1.1 from /usr/local/lib/python3.8/dist-packages/pip-21.1.1-py3.8.egg/pip"
        ]
    },
    "python_paths": {
        "": "/usr/bin/python",
        "2": null,
        "2.6": null,
        "2.7": null,
        "3": "/usr/bin/python3",
        "3.5": null,
        "3.6": null,
        "3.7": null,
        "3.8": "/usr/bin/python3.8",
        "3.9": null
    },
    "warnings": []
}
Running azure_rm_containerinstance integration test role
Preparing temporary directory: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ
Copying test/integration/targets/azure_rm_containerinstance/ to /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets/azure_rm_containerinstance/
Copying /root/ansible/test/integration/integration_config.yml to /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/integration_config.yml
Copying /root/ansible/test/lib/ansible_test/_data/ansible.cfg to /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/integration.cfg
Copying /root/ansible/test/lib/ansible_test/_data/inventory to /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/inventory
>>> Playbook: azure_rm_containerinstance-n1nw0lp0.yml
[
    {
        "gather_facts": true,
        "hosts": "testhost",
        "roles": [
            "azure_rm_containerinstance"
        ],
        "vars": {
            "output_dir": "/root/ansible/test/results/.tmp/output_dir"
        },
        "vars_files": [
            "integration_config.yml"
        ]
    }
]
Injecting "/tmp/python-410n1wz8-ansible/python" as a execv wrapper for the "/usr/bin/python" interpreter.
Run command: ansible-playbook azure_rm_containerinstance-n1nw0lp0.yml -i inventory -vvv
Working directory: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration
Program found: /root/ansible/test/lib/ansible_test/_data/injector/ansible-playbook
ANSIBLE_CACHE_PLUGINS=/root/ansible/test/support/integration/plugins/cache
ANSIBLE_CALLBACKS_ENABLED=junit
ANSIBLE_CONFIG=/root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/integration.cfg
ANSIBLE_CONTROLLER_PYTHON_WARNING=false
ANSIBLE_DEPRECATION_WARNINGS=false
ANSIBLE_DEVEL_WARNING=false
ANSIBLE_FILTER_PLUGINS=/root/ansible/test/support/integration/plugins/filter
ANSIBLE_FORCE_COLOR=true
ANSIBLE_FORCE_HANDLERS=true
ANSIBLE_HOST_KEY_CHECKING=false
ANSIBLE_HOST_PATTERN_MISMATCH=error
ANSIBLE_INVENTORY=/dev/null
ANSIBLE_INVENTORY_PLUGINS=/root/ansible/test/support/integration/plugins/inventory
ANSIBLE_LIBRARY=/root/ansible/test/support/integration/plugins/modules
ANSIBLE_LOOKUP_PLUGINS=/root/ansible/test/support/integration/plugins/lookup
ANSIBLE_MODULE_UTILS=/root/ansible/test/support/integration/plugins/module_utils
ANSIBLE_PLAYBOOK_DIR=/root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration
ANSIBLE_PYTHON_INTERPRETER=/set/ansible_python_interpreter/in/inventory
ANSIBLE_PYTHON_MODULE_RLIMIT_NOFILE=1024
ANSIBLE_RETRY_FILES_ENABLED=false
ANSIBLE_ROLES_PATH=/root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets
ANSIBLE_TEST_CI=
ANSIBLE_TEST_COVERAGE=
ANSIBLE_TEST_PYTHON_INTERPRETER=/usr/bin/python
ANSIBLE_TEST_PYTHON_VERSION=3.8
ANSIBLE_WORKER_SHUTDOWN_POLL_COUNT=100
ANSIBLE_WORKER_SHUTDOWN_POLL_DELAY=0.1
HOME=/root
INVENTORY_PATH=/root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/inventory
JUNIT_OUTPUT_DIR=/root/ansible/test/results/junit
LC_ALL=en_US.UTF-8
OUTPUT_DIR=/root/ansible/test/results/.tmp/output_dir
PAGER=/bin/cat
PATH=/tmp/python-410n1wz8-ansible:/root/ansible/test/lib/ansible_test/_data/injector:/root/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PYTHONPATH=/root/ansible/lib
ansible-playbook [core 2.12.0.dev0]  (devel 9ba6cf9a72) last updated 2021/04/19 16:15:31 (GMT +550)
  config file = /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/integration.cfg
  configured module search path = ['/root/ansible/test/support/integration/plugins/modules']
  ansible python module location = /root/ansible/lib/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/ansible/bin/ansible-playbook
  python version = 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]
  jinja version = 2.10.1
  libyaml = True
Using /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/integration.cfg as config file
host_list declined parsing /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/inventory as it did not pass its verify_file() method
script declined parsing /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/inventory as it did not pass its verify_file() method
auto declined parsing /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/inventory as it did not pass its verify_file() method
Parsed /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/inventory inventory source with ini plugin
Read vars_file 'integration_config.yml'
Skipping callback 'default', as we already have a stdout callback.
[WARNING]: The `junit_xml` python module is not installed. Disabling the `junit` callback plugin.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: azure_rm_containerinstance-n1nw0lp0.yml *********************************************************************************************************************************************************
1 plays in azure_rm_containerinstance-n1nw0lp0.yml
Read vars_file 'integration_config.yml'
Read vars_file 'integration_config.yml'
Read vars_file 'integration_config.yml'

PLAY [testhost] *******************************************************************************************************************************************************************************************
Read vars_file 'integration_config.yml'

TASK [Gathering Facts] ************************************************************************************************************************************************************************************
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<testhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1624360381.303341-4465-271781278661446 `" && echo ansible-tmp-1624360381.303341-4465-271781278661446="` echo /root/.ansible/tmp/ansible-tmp-1624360381.303341-4465-271781278661446 `" ) && sleep 0'
Using module file /root/ansible/lib/ansible/modules/setup.py
<testhost> PUT /root/.ansible/tmp/ansible-local-4460xwm5fb10/tmpnkqwdk4e TO /root/.ansible/tmp/ansible-tmp-1624360381.303341-4465-271781278661446/AnsiballZ_setup.py
<testhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1624360381.303341-4465-271781278661446/ /root/.ansible/tmp/ansible-tmp-1624360381.303341-4465-271781278661446/AnsiballZ_setup.py && sleep 0'
<testhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1624360381.303341-4465-271781278661446/AnsiballZ_setup.py && sleep 0'
<testhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1624360381.303341-4465-271781278661446/ > /dev/null 2>&1 && sleep 0'
ok: [testhost]
Read vars_file 'integration_config.yml'
META: ran handlers
Read vars_file 'integration_config.yml'

TASK [azure_rm_containerinstance : Create sample container instance with volume] **************************************************************************************************************************
task path: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets/azure_rm_containerinstance/tasks/main.yml:19
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<testhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1624360383.2760081-4530-183241157075033 `" && echo ansible-tmp-1624360383.2760081-4530-183241157075033="` echo /root/.ansible/tmp/ansible-tmp-1624360383.2760081-4530-183241157075033 `" ) && sleep 0'
Using module file /root/ansible/lib/ansible/modules/azure_rm_containerinstance.py
<testhost> PUT /root/.ansible/tmp/ansible-local-4460xwm5fb10/tmpb45bjyzz TO /root/.ansible/tmp/ansible-tmp-1624360383.2760081-4530-183241157075033/AnsiballZ_azure_rm_containerinstance.py
<testhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1624360383.2760081-4530-183241157075033/ /root/.ansible/tmp/ansible-tmp-1624360383.2760081-4530-183241157075033/AnsiballZ_azure_rm_containerinstance.py && sleep 0'
<testhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1624360383.2760081-4530-183241157075033/AnsiballZ_azure_rm_containerinstance.py && sleep 0'
<testhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1624360383.2760081-4530-183241157075033/ > /dev/null 2>&1 && sleep 0'
[WARNING]: Installed azure-mgmt-containerinstance client version is 1.4.0. The expected version is 0.4.0. Try `pip install ansible[azure]`
changed: [testhost] => {
    "changed": true,
    "id": "/subscriptions/7b1b46f1-e266-404e-96b4-8738a385c254/resourceGroups/MyAzureResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/acic45a0c9",
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "append_tags": true,
            "auth_source": "auto",
            "cert_validation_mode": null,
            "client_id": null,
            "cloud_environment": "AzureCloud",
            "containers": [
                {
                    "commands": null,
                    "cpu": 1.0,
                    "environment_variables": null,
                    "image": "mcr.microsoft.com/azuredocs/aci-helloworld",
                    "memory": 1.5,
                    "name": "mycontainer1",
                    "ports": [
                        80,
                        81
                    ],
                    "volume_mounts": [
                        {
                            "mount_path": "/data/files",
                            "name": "my-filesharevolume",
                            "read_only": null
                        }
                    ]
                }
            ],
            "dns_name_label": null,
            "force_update": false,
            "ip_address": "public",
            "location": "eastus",
            "name": "acic45a0c9",
            "os_type": "linux",
            "password": null,
            "ports": [
                80
            ],
            "profile": null,
            "registry_login_server": null,
            "registry_password": null,
            "registry_username": null,
            "resource_group": "MyAzureResourceGroup",
            "restart_policy": null,
            "secret": null,
            "state": "present",
            "subscription_id": null,
            "tags": null,
            "tenant": null,
            "volumes": [
                {
                    "azure_file": {
                        "read_only": null,
                        "share_name": "my-fileshare",
                        "storage_account_key": "x3xaeDCHZxk3Jnm3/lHX9xaNCCzU4hwXN9OMw2GjBRva3ybVzQ+uc2TgAOcQzi/IV6OzHzt/5SM0JmU1xdjA6Q==",
                        "storage_account_name": "mystorageaccountap"
                    },
                    "empty_dir": null,
                    "git_repo": null,
                    "name": "my-filesharevolume",
                    "secret": null
                }
            ]
        }
    },
    "ip_address": "20.84.34.78",
    "provisioning_state": "Succeeded",
    "state": {}
}
Read vars_file 'integration_config.yml'

TASK [azure_rm_containerinstance : debug] *****************************************************************************************************************************************************************
task path: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets/azure_rm_containerinstance/tasks/main.yml:46
ok: [testhost] => {
    "output": {
        "changed": true,
        "failed": false,
        "id": "/subscriptions/7b1b46f1-e266-404e-96b4-8738a385c254/resourceGroups/MyAzureResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/acic45a0c9",
        "ip_address": "20.84.34.78",
        "provisioning_state": "Succeeded",
        "state": {},
        "warnings": [
            "Installed azure-mgmt-containerinstance client version is 1.4.0. The expected version is 0.4.0. Try `pip install ansible[azure]`"
        ]
    }
}
Read vars_file 'integration_config.yml'

TASK [azure_rm_containerinstance : Assert the container instance is well created] *************************************************************************************************************************
task path: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets/azure_rm_containerinstance/tasks/main.yml:49
ok: [testhost] => {
    "changed": false,
    "msg": "All assertions passed"
}
Read vars_file 'integration_config.yml'

TASK [azure_rm_containerinstance : Gather facts for Container Instance] ***********************************************************************************************************************************
task path: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets/azure_rm_containerinstance/tasks/main.yml:55
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<testhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1624360425.0305986-4562-96732305240264 `" && echo ansible-tmp-1624360425.0305986-4562-96732305240264="` echo /root/.ansible/tmp/ansible-tmp-1624360425.0305986-4562-96732305240264 `" ) && sleep 0'
Using module file /root/ansible/lib/ansible/modules/azure_rm_containerinstance_info.py
<testhost> PUT /root/.ansible/tmp/ansible-local-4460xwm5fb10/tmpupv9dt_6 TO /root/.ansible/tmp/ansible-tmp-1624360425.0305986-4562-96732305240264/AnsiballZ_azure_rm_containerinstance_info.py
<testhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1624360425.0305986-4562-96732305240264/ /root/.ansible/tmp/ansible-tmp-1624360425.0305986-4562-96732305240264/AnsiballZ_azure_rm_containerinstance_info.py && sleep 0'
<testhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1624360425.0305986-4562-96732305240264/AnsiballZ_azure_rm_containerinstance_info.py && sleep 0'
<testhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1624360425.0305986-4562-96732305240264/ > /dev/null 2>&1 && sleep 0'
ok: [testhost] => {
    "changed": false,
    "containerinstances": [
        {
            "containers": [
                {
                    "commands": null,
                    "cpu": 1.0,
                    "environment_variables": [],
                    "image": "mcr.microsoft.com/azuredocs/aci-helloworld",
                    "memory": 1.5,
                    "name": "mycontainer1",
                    "ports": [
                        80,
                        81
                    ],
                    "volume_mounts": [
                        {
                            "mount_path": "/data/files",
                            "name": "my-filesharevolume"
                        }
                    ]
                }
            ],
            "dns_name_label": null,
            "id": "/subscriptions/7b1b46f1-e266-404e-96b4-8738a385c254/resourceGroups/MyAzureResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/acic45a0c9",
            "ip_address": "20.84.34.78",
            "location": "eastus",
            "name": "acic45a0c9",
            "os_type": "Linux",
            "ports": [
                80,
                81
            ],
            "resource_group": "MyAzureResourceGroup",
            "restart_policy": null,
            "tags": null,
            "volumes": [
                {
                    "azure_file": {
                        "share_name": "my-fileshare",
                        "storage_account_name": "mystorageaccountap"
                    },
                    "name": "my-filesharevolume"
                }
            ]
        }
    ],
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "auth_source": "auto",
            "cert_validation_mode": null,
            "client_id": null,
            "cloud_environment": "AzureCloud",
            "name": "acic45a0c9",
            "password": null,
            "profile": null,
            "resource_group": "MyAzureResourceGroup",
            "secret": null,
            "subscription_id": null,
            "tags": null,
            "tenant": null
        }
    }
}
Read vars_file 'integration_config.yml'

TASK [azure_rm_containerinstance : debug] *****************************************************************************************************************************************************************
task path: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets/azure_rm_containerinstance/tasks/main.yml:61
ok: [testhost] => {
    "output": {
        "changed": false,
        "containerinstances": [
            {
                "containers": [
                    {
                        "commands": null,
                        "cpu": 1.0,
                        "environment_variables": [],
                        "image": "mcr.microsoft.com/azuredocs/aci-helloworld",
                        "memory": 1.5,
                        "name": "mycontainer1",
                        "ports": [
                            80,
                            81
                        ],
                        "volume_mounts": [
                            {
                                "mount_path": "/data/files",
                                "name": "my-filesharevolume"
                            }
                        ]
                    }
                ],
                "dns_name_label": null,
                "id": "/subscriptions/7b1b46f1-e266-404e-96b4-8738a385c254/resourceGroups/MyAzureResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/acic45a0c9",
                "ip_address": "20.84.34.78",
                "location": "eastus",
                "name": "acic45a0c9",
                "os_type": "Linux",
                "ports": [
                    80,
                    81
                ],
                "resource_group": "MyAzureResourceGroup",
                "restart_policy": null,
                "tags": null,
                "volumes": [
                    {
                        "azure_file": {
                            "share_name": "my-fileshare",
                            "storage_account_name": "mystorageaccountap"
                        },
                        "name": "my-filesharevolume"
                    }
                ]
            }
        ],
        "failed": false,
        "warnings": [
            "Installed azure-mgmt-containerinstance client version is 1.4.0. The expected version is 0.4.0. Try `pip install ansible[azure]`"
        ]
    }
}
Read vars_file 'integration_config.yml'

TASK [azure_rm_containerinstance : Assert that facts are returned] ****************************************************************************************************************************************
task path: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets/azure_rm_containerinstance/tasks/main.yml:64
ok: [testhost] => {
    "changed": false,
    "msg": "All assertions passed"
}
Read vars_file 'integration_config.yml'

TASK [azure_rm_containerinstance : Remove container instance] *********************************************************************************************************************************************
task path: /root/ansible/test/results/.tmp/integration/azure_rm_containerinstance-gv27ufvs-ÅÑŚÌβŁÈ/test/integration/targets/azure_rm_containerinstance/tasks/main.yml:80
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<testhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1624360430.384739-4595-237838525950797 `" && echo ansible-tmp-1624360430.384739-4595-237838525950797="` echo /root/.ansible/tmp/ansible-tmp-1624360430.384739-4595-237838525950797 `" ) && sleep 0'
Using module file /root/ansible/lib/ansible/modules/azure_rm_containerinstance.py
<testhost> PUT /root/.ansible/tmp/ansible-local-4460xwm5fb10/tmpkx861qdc TO /root/.ansible/tmp/ansible-tmp-1624360430.384739-4595-237838525950797/AnsiballZ_azure_rm_containerinstance.py
<testhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1624360430.384739-4595-237838525950797/ /root/.ansible/tmp/ansible-tmp-1624360430.384739-4595-237838525950797/AnsiballZ_azure_rm_containerinstance.py && sleep 0'
<testhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1624360430.384739-4595-237838525950797/AnsiballZ_azure_rm_containerinstance.py && sleep 0'
<testhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1624360430.384739-4595-237838525950797/ > /dev/null 2>&1 && sleep 0'
changed: [testhost] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "append_tags": true,
            "auth_source": "auto",
            "cert_validation_mode": null,
            "client_id": null,
            "cloud_environment": "AzureCloud",
            "containers": [
                {
                    "commands": null,
                    "cpu": 1.0,
                    "environment_variables": null,
                    "image": "mcr.microsoft.com/azuredocs/aci-helloworld",
                    "memory": 1.5,
                    "name": "mycontainer1",
                    "ports": [
                        80,
                        81
                    ],
                    "volume_mounts": [
                        {
                            "mount_path": "/data/files",
                            "name": "my-filesharevolume",
                            "read_only": null
                        }
                    ]
                }
            ],
            "dns_name_label": null,
            "force_update": false,
            "ip_address": "public",
            "location": "eastus",
            "name": "acic45a0c9",
            "os_type": "linux",
            "password": null,
            "ports": [
                80
            ],
            "profile": null,
            "registry_login_server": null,
            "registry_password": null,
            "registry_username": null,
            "resource_group": "MyAzureResourceGroup",
            "restart_policy": null,
            "secret": null,
            "state": "absent",
            "subscription_id": null,
            "tags": null,
            "tenant": null,
            "volumes": [
                {
                    "azure_file": {
                        "read_only": null,
                        "share_name": "my-fileshare",
                        "storage_account_key": "x3xaeDCHZxk3Jnm3/lHX9xaNCCzU4hwXN9OMw2GjBRva3ybVzQ+uc2TgAOcQzi/IV6OzHzt/5SM0JmU1xdjA6Q==",
                        "storage_account_name": "mystorageaccountap"
                    },
                    "empty_dir": null,
                    "git_repo": null,
                    "name": "my-filesharevolume",
                    "secret": null
                }
            ]
        }
    },
    "state": {}
}
Read vars_file 'integration_config.yml'
META: role_complete for testhost
Read vars_file 'integration_config.yml'
META: ran handlers
Read vars_file 'integration_config.yml'
META: ran handlers

PLAY RECAP ************************************************************************************************************************************************************************************************
testhost                   : ok=8    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Run command: /usr/bin/python /root/ansible/test/lib/ansible_test/_data/versions.py
Working directory: /root/ansible
Program found: /usr/bin/python
HOME=/root
LC_ALL=en_US.UTF-8
PATH=/root/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Run command: /usr/bin/python3 /root/ansible/test/lib/ansible_test/_data/versions.py
Working directory: /root/ansible
Program found: /usr/bin/python3
HOME=/root
LC_ALL=en_US.UTF-8
PATH=/root/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Run command: /usr/bin/python3.8 /root/ansible/test/lib/ansible_test/_data/versions.py
Working directory: /root/ansible
Program found: /usr/bin/python3.8
HOME=/root
LC_ALL=en_US.UTF-8
PATH=/root/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Cleaning up temporary python directory: /tmp/python-410n1wz8-ansible

Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aparna-patil Could you please help to authorize me to update this PR? Thank you very much!

tests/sanity/ignore-2.11.txt Show resolved Hide resolved
@aparna-patil
Copy link
Contributor Author

@aparna-patil Could you please help to authorize me to update this PR? Thank you very much!

@Fred-sun Provided the access, could you please verify once? Thank you!

@Fred-sun
Copy link
Collaborator

@aparna-patil Can you execute the test case as follows? The result of my arrival was fail。

---
- name: Run test suite for module
  hosts: localhost
  connection: local
  vars:
    resource_group: my-test-rg
  tasks:
    - name: create prerequisite resource group
      azure.azcollection.azure_rm_resourcegroup:
        name: "{{ resource_group }}"
        location: eastus
    - include: ../tests/integration/targets/azure_rm_appgateway/tasks/main.yml

@aparna-patil
Copy link
Contributor Author

@aparna-patil Can you execute the test case as follows? The result of my arrival was fail。

---
- name: Run test suite for module
  hosts: localhost
  connection: local
  vars:
    resource_group: my-test-rg
  tasks:
    - name: create prerequisite resource group
      azure.azcollection.azure_rm_resourcegroup:
        name: "{{ resource_group }}"
        location: eastus
    - include: ../tests/integration/targets/azure_rm_appgateway/tasks/main.yml

@Fred-sun Sure, let me try this way.. Could you please share the failure details for reference?

@Fred-sun
Copy link
Collaborator

@aparna-patil Okay, I'll share it with you later.

@Fred-sun Fred-sun added ready_for_review The PR has been modified and can be reviewed and merged and removed work in In trying to solve, or in working with contributors labels Jun 28, 2021
@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 2, 2021

@aparna-patil Can you help resolve conflicting files? I will move forward with the merger as soon as possible. Thank you very much!

@aparna-patil
Copy link
Contributor Author

@aparna-patil Can you help resolve conflicting files? I will move forward with the merger as soon as possible. Thank you very much!

@Fred-sun Done, Resolved merge conflicts. Thank you!

@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 3, 2021

@aparna-patil Thanks for your udpate! I will push for merged as soon as possible!

@Fred-sun
Copy link
Collaborator

@aparna-patil Can you help resolve conflicting files? I will move forward with the merger as soon as possible. Thank you very much!

@Fred-sun Fred-sun added work in In trying to solve, or in working with contributors and removed ready_for_review The PR has been modified and can be reviewed and merged labels Aug 11, 2021
@aparna-patil
Copy link
Contributor Author

@aparna-patil Can you help resolve conflicting files? I will move forward with the merger as soon as possible. Thank you very much!

@Fred-sun Done! resolved merge conflicts. Thank you!

@aparna-patil
Copy link
Contributor Author

Hi @Fred-sun Could you please help push this for merge whenever you get time? Actually this PR is stuck from last year. Thank you very much for your help!

@Fred-sun
Copy link
Collaborator

Fred-sun commented Oct 7, 2021

Hi @Fred-sun Could you please help push this for merge whenever you get time? Actually this PR is stuck from last year. Thank you very much for your help!

@aparna-patil I'm working on it. Thank you very much!

@Fred-sun Fred-sun added ready_for_review The PR has been modified and can be reviewed and merged and removed work in In trying to solve, or in working with contributors labels Oct 11, 2021
@xuzhang3
Copy link
Collaborator

LGTM

@xuzhang3 xuzhang3 merged commit 113470b into ansible-collections:dev Oct 14, 2021
nbr23 pushed a commit to nbr23/azure that referenced this pull request Oct 26, 2021
…ntainer instances (ansible-collections#338)

* Fixed issue ansible-collections#232 Added Volume mount support for container instances

* Updated Sanity test file

* Changed the name for filesharevolume

* Updated sanity files and tests file as per review comments

* Updated integration tests

* updated sanity test file

* Ignore errors in the test cases

* fix sanity error

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
Co-authored-by: Fred-sun <xiuxi.sun@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority new_feature New feature requirments ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azure_rm_containerinstance doesn't support Volume parameter
4 participants