有关于 atomic 的那些 ansible 模块: https://docs.ansible.com/ansible/latest/modules/atomic_image_module.html https://docs.ansible.com/ansible/latest/modules/atomic_container_module.html
我想在 ansible 中包装这个命令:
atomic install --name freeipa freeipa/freeipa-server --hostname=freeipa71.test.lx.domain.com ip-address 10.20.203.87 publish ipa-server-install --setup-dns --forwarder=10.10.30.1 --admin-password=adminadmin --ds-password=adminadmin --realm=LX.DOMAIN.COM --domain=lx.domain.com --auto-reverse --unattended
使用其中一个模块是否可能实现这一点?我还没有找到可行的方法,我正在尝试,但那不起作用:
- atomic_container:
name: freeipa
image: freeipa/freeipa-server
backend: ostree
state: latest
mode: system
values:
- hostname=freeipa71.lx.domain.com
- publish
- ipa-server-install
- --setup-dns
- -forwarder=10.10.30.1
- --admin-password=adminadmin
- --ds-password=adminadmin
- --realm=LX.DOMAIN.COM
- --domain=lx.domain.com
- --auto-reverse
- --unattended
编辑:错误输出是:
fatal: [freeipa71.lx.domain.com]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"backend": "ostree",
"image": "docker.io/freeipa/freeipa-server",
"mode": "system",
"name": "freeipa",
"rootfs": null,
"state": "latest",
"values": [
"hostname=freeipa71.lx.domain.com",
"ip-address=10.203.0.12",
"publish",
"ipa-server-install",
"--setup-dns",
"--forwarder=10.10.30.1",
"--admin-password=adminadmin",
"--ds-password=adminadmin",
"--realm=LX.DOMAIN.COM",
"--domain=lx.domain.com",
"--auto-reverse",
"--unattended"
]
}
},
"msg": "Invalid value 'publish'. Expected form NAME=VALUE\n",
"rc": 1
}
PLAY RECAP ****************************************************************************************************************************************************************************************************************
freeipa71.lx.domain.com : ok=1 changed=0 unreachable=0 failed=1