Hi,
I am running a Rocky Linux controller node and two managed nodes. I am using Ansible to run containers with Portainer on the managed nodes. I pull my repository to set up my Portainer stack based on the repository’s containers. In the stack task, I assign my repository’s Docker Compose file and set an environment variable for ADMIN_PASSWORD
as follows:
“name”: “ADMIN_PASSWORD”,
“value”: “{{ adminpassword.stdout }}”
Then, I set the adminpassword
in another task as follows:
container: opensearch-node1
command: /bin/bash -c “export OPENSEARCH_INITIAL_ADMIN_PASSWORD={{ adminpassword.stdout }} && /usr/share/opensearch/plugins/opensearch-security/tools/securityadmin.sh -cd /usr/share/opensearch/config/opensearch-security -icl -key /usr/share/opensearch/config/kirk-key.pem -cert /usr/share/opensearch/config/kirk.pem -cacert /usr/share/opensearch/config/root-ca.pem -nhnv”
chdir: /root
But, my OpenSearch containers go into restart mode on the managed hosts. Upon checking the logs, I see the above error.
In my repository’s Docker Compose file, I have the following configuration for opensearch-node1
:
opensearch-node1:
image: opensearchproject/opensearch:latest
build: ./components/opensearch
container_name: opensearch-node1
restart: always
environment:
- cluster.name=opensearch-cluster
- node.name=opensearch-node1
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${ADMIN_PASSWORD}
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch-data1:/usr/share/opensearch/data
-/root/prodir/project/components/opensearch/config/internal_users.yml:/usr/share/opensearch/config/opensearch-security/internal_users.yml
-/root/prodir/project/components/opensearch/config/roles.yml:/usr/share/opensearch/config/opensearch-security/roles.yml
/root/prodir/project/components/opensearch/config/roles_mapping.yml:/usr/share/opensearch/config/opensearch-security/roles_mapping.yml
-/root/prodir/project/components/opensearch/config/securityadmin_demo.sh:/usr/share/opensearch/config/securityadmin_demo.sh
and i am doing the same for opensearch-node2
volumes:
opensearch-data1:
opensearch-data2:
In my repository’s OpenSearch container Dockerfile, I have the following:
FROM opensearchproject/opensearch:latest
COPY ./config/internal_users.yml /usr/share/opensearch/config/opensearch-security/
COPY ./config/roles.yml /usr/share/opensearch/config/opensearch-security/
COPY ./config/securityadmin_demo.sh /usr/share/opensearch/config/securityadmin_demo.sh
USER root
RUN chmod +x /usr/share/opensearch/config/securityadmin_demo.sh
USER opensearch
What am I doing wrong here?