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

Stoping an ECS instance returns error #299

Open
juniorh opened this issue Aug 2, 2021 · 1 comment
Open

Stoping an ECS instance returns error #299

juniorh opened this issue Aug 2, 2021 · 1 comment

Comments

@juniorh
Copy link

juniorh commented Aug 2, 2021

I'm trying to create, modify, start & stop an ECS instance by changing the state parameter of module ali_instance.

Operation create, modify, and start running without an issue but stopping the instance return error (even the instance is actually turning off).

# playbook.yaml
---
- hosts: localhost
  gather_facts: no
  tasks:
  - ali_instance:
      instance_name: vm-test
      host_name: vm-test
      instance_type: ecs.t5-lc1m1.small
      image: debian_10_10_uefi_x64_20G_alibase_20210611.vhd
      vswitch_id: vsw-xxxxxx
      security_groups: sg-xxxxxx
      allocate_public_ip: False
      state: stopped

Ansible & module version

$ ansible --version
ansible 2.10.8
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]

$ pip3 list |grep alicloud
ansible-alicloud              1.19.0
ansible-alicloud-module-utils 1.5.0

Error

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "alicloud_access_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "alicloud_assume_role": null,
            "alicloud_assume_role_arn": null,
            "alicloud_assume_role_session_expiration": null,
            "alicloud_assume_role_session_name": null,
            "alicloud_region": "xxxxxx",
            "alicloud_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "alicloud_security_token": null,
            "allocate_public_ip": false,
            "auto_renew": false,
            "auto_renew_period": null,
            "availability_zone": null,
            "count": 1,
            "count_tag": null,
            "description": null,
            "dry_run": false,
            "ecs_role_name": null,
            "force": false,
            "host_name": "vm-test",
            "image": "debian_10_10_uefi_x64_20G_alibase_20210611.vhd",
            "image_id": "debian_10_10_uefi_x64_20G_alibase_20210611.vhd",
            "include_data_disks": true,
            "instance_charge_type": "PostPaid",
            "instance_ids": null,
            "instance_name": "vm-test",
            "instance_type": "ecs.t5-lc1m1.small",
            "internet_charge_type": "PayByBandwidth",
            "key_name": null,
            "max_bandwidth_in": 200,
            "max_bandwidth_out": 0,
            "password": null,
            "period": 1,
            "period_unit": "Month",
            "profile": null,
            "purge_tags": false,
            "ram_role_name": null,
            "security_groups": [
                "sg-xxxxxx"
            ],
            "shared_credentials_file": null,
            "spot_price_limit": null,
            "spot_strategy": "NoSpot",
            "state": "stopped",
            "system_disk_category": "cloud_efficiency",
            "system_disk_description": null,
            "system_disk_name": null,
            "system_disk_size": 40,
            "tags": null,
            "unique_suffix": false,
            "user_data": null,
            "vswitch_id": "vsw-xxxxxx"
        }
    },
    "msg": "Stop instances got an error: 'NoneType' object has no attribute 'encode'"
}
@tolikkk
Copy link

tolikkk commented Feb 15, 2023

Have the same behavior. Fix with setting user_data variable in ali_instance module. Use just the stub:
user_data: 'stub'

Looks like a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants