使用Redis Sentinel容器部署Ansible Docker会在受限环境支持的参数上出现错误。
我将环境写入Redis Sentinel容器,但收到错误消息。 这个模块应该支持那些envoirments变量吗?
版本:
-ansible 2.4.2.0
-Docker版本1.13.1,内部版本07f3374 / 1.13.1
以下是配置:
- name: run sentinel one container (sentinel1)
docker:
name: sentonel1
image: docker-registry.xxxx.xxxx.com/redis/sentinel:v1.0.1
environment:
- MASTER_ADDR=${HOST_PUBLIC_IP}
- MASTER_PORT=6379
- SENTINEL_ANNOUNCE_IP=${HOST_PUBLIC_IP}
- SENTINEL_ANNOUNCE_PORT=26379
- SENTINEL_QUORUM=2
- SENTINEL_FAILOVER=5000
- SENTINEL_DOWN_AFTER=18000
ports:
- "26379:26379"
这是我得到的错误:
TASK [run sentinel two container (sentinel2)] ****************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (docker_container) module: environment Supported parameters include: api_version,auto_remove,blkio_weight,cacert_path,capabilities,cert_path,cleanup,command,cpu_period,cpu_quota,cpu_shares,cpuset_cpus,cpuset_mems,debug,detach,devices,dns_opts,dns_search_domains,dns_servers,docker_host,entrypoint,env,env_file,etc_hosts,exposed_ports,filter_logger,force_kill,groups,hostname,ignore_image,image,interactive,ipc_mode,keep_volumes,kernel_memory,key_path,kill_signal,labels,links,log_driver,log_options,mac_address,memory,memory_reservation,memory_swap,memory_swappiness,name,network_mode,networks,oom_killer,oom_score_adj,paused,pid_mode,privileged,published_ports,pull,purge_networks,read_only,recreate,restart,restart_policy,restart_retries,security_opts,shm_size,ssl_version,state,stop_signal,stop_timeout,sysctls,timeout,tls,tls_hostname,tls_verify,tmpfs,trust_image_content,tty,ulimits,user,uts,volume_driver,volumes,volumes_from,working_dir"}
to retry, use: --limit @/ansible/ansible.retry
PLAY RECAP ***************************************************************************************************************************************************
localhost : ok=28 changed=2 unreachable=0 failed=1
答案 0 :(得分:2)
已弃用 Ansible Docker模块,因为应使用ansible 2.2,而应使用docker_container
。
将environment
键替换为env
,它应该可以工作,但是请注意,不支持使用${}
的变量,您应该使用{{ ansible_env.MY_VARIABLE }}
来访问系统上的任何环境变量
请参见https://docs.ansible.com/ansible/2.4/docker_container_module.html了解您的版本