This commit is contained in:
olli 2024-05-29 14:42:22 +02:00
parent 16c8ca7411
commit 2f22172088

View File

@ -28,7 +28,7 @@
echo "${WEBPASSWDCRYPT}" echo "${WEBPASSWDCRYPT}"
else else
webpassword=$(pwgen -s 32 1) webpassword=$(pwgen -s 32 1)
webpasswordcrypted=$(htpasswd -nbB foo $webpassword | cut -d: -f2) webpasswordcrypted=$(htpasswd -nbB foo $webpassword | cut -d: -f2 | sed -e s/\\$/\\$\\$/g)
echo "WEBUSER=admin echo "WEBUSER=admin
WEBPASSWD=${webpassword} WEBPASSWD=${webpassword}
@ -54,9 +54,9 @@
register: cryptpw register: cryptpw
changed_when: false changed_when: false
- name: /home/docker/portainer/docker-compose.yml Portainer Container Configuration - name: /home/docker/portainer.{{inventory_hostname}}/docker-compose.yml Portainer Container Configuration
blockinfile: blockinfile:
path: /home/docker/portainer/docker-compose.yml path: /home/docker/portainer.{{inventory_hostname}}/docker-compose.yml
create: yes create: yes
mode: 0440 mode: 0440
owner: root owner: root
@ -67,7 +67,6 @@
services: services:
portainer: portainer:
image: portainer/portainer-ce:latest image: portainer/portainer-ce:latest
# htpasswd -nb -B admin "PASSWORD" | cut -d ":" -f 2 | sed -e s/\\$/\\$\\$/g
command: --admin-password {{ cryptpw.stdout }} command: --admin-password {{ cryptpw.stdout }}
restart: unless-stopped restart: unless-stopped
networks: networks:
@ -97,4 +96,4 @@
- name: Restart portainer - name: Restart portainer
ansible.builtin.shell: docker-compose up -d --force-recreate ansible.builtin.shell: docker-compose up -d --force-recreate
args: args:
chdir: /home/docker/portainer chdir: /home/docker/portainer.{{inventory_hostname}}