[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Setting OpenShift 3.11 router stats password in inventory



Hi,

How can we set the router stats password in an OpenShift 3.11 inventory
file? I've tried to put the following config in the inventory but it
ends up setting the STATS_PASSWORD environment variables twice in the
deployment config

```
openshift_hosted_router_edits:
  - key: "spec.template.spec.containers[0].env"
    value:
      name: "STATS_PASSWORD"
      value: "password"
    action: "update"
```

Replacing the update action with put in the above leads to an error
during playbook run:

```
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: string indices must be integers, not str
failed: [redacted] (item={u'extended_validation': True, u'name': u'router', u'certificate': {u'cafile': u'/builds/camptocamp/is/openshift-lab/files/applications-ca.crt', u'certfile': u'/builds/camptocamp/is/openshift-lab/files/applications.crt', u'keyfile': u'/builds/camptocamp/is/openshift-lab/files/applications.key'}, u'replicas': u'2', u'namespace': u'default', u'serviceaccount': u'router', u'selector': u'node-role.kubernetes.io/router=true', u'edits': [{u'action': u'put', u'key': u'spec.template.spec.containers[0].env', u'value': {u'name': u'STATS_PASSWORD', u'value': u'password'}}], u'images': u'registry.redhat.io/openshift3/ose-${component}:v3.11.161', u'stats_port': 1936, u'ports': [u'80:80', u'443:443']}) => {"changed": false, "item": {"certificate": {"cafile": "/builds/camptocamp/is/openshift-lab/files/applications-ca.crt", "certfile": "/builds/camptocamp/is/openshift-lab/files/applications.crt", "keyfile": "/builds/camptocamp/is/openshift-lab/files/applications.key"}, "edits": [{"action": "put", "key": "spec.template.spec.containers[0].env", "value": {"name": "STATS_PASSWORD", "value": "password"}}], "extended_validation": true, "images": "registry.redhat.io/openshift3/ose-${component}:v3.11.161", "name": "router", "namespace": "default", "ports": ["80:80", "443:443"], "replicas": "2", "selector": "node-role.kubernetes.io/router=true", "serviceaccount": "router", "stats_port": 1936}, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_TEfTiN/ansible_module_oc_adm_router.py\", line 3267, in <module>\n    main()\n  File \"/tmp/ansible_TEfTiN/ansible_module_oc_adm_router.py\", line 3258, in main\n    results = Router.run_ansible(module.params, module.check_mode)\n  File \"/tmp/ansible_TEfTiN/ansible_module_oc_adm_router.py\", line 3187, in run_ansible\n    if not ocrouter.needs_update():\n  File \"/tmp/ansible_TEfTiN/ansible_module_oc_adm_router.py\", line 3064, in needs_update\n    if env_var['name'] == 'STATS_PASSWORD':\nTypeError: string indices must be integers, not str\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
```

Is it a playbook bug or do I do something wrong?

Regards

Yann



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]