Add default password for server.

This commit is contained in:
Laur Ivan 2021-09-17 09:28:47 +02:00
parent 891ea2a47b
commit 3d419366c4
2 changed files with 18 additions and 0 deletions

View File

@ -4,3 +4,4 @@
server_host: none server_host: none
portainer_config: /tmp/config portainer_config: /tmp/config
portainer_port: "8000" portainer_port: "8000"
portainer_password: "changeme"

View File

@ -1,6 +1,22 @@
--- ---
# tasks file for portainer role # tasks file for portainer role
#
# Set up the admin password
#
- name: Make sure htpasswd is installed
apt:
name: apache2-utils
state: present
when: inventory_hostname == server_host and server_host and server_host != "none"
- name: Create bcrypt password
shell:
cmd: |
htpasswd -nb -B admin "{{ portainer_password }}" | cut -d ":" -f 2
register: portainer_password_bcrypt
when: inventory_hostname == server_host and server_host and server_host != "none"
# #
# Install portainer server on the server host # Install portainer server on the server host
# #
@ -27,6 +43,7 @@
volumes: volumes:
- "/var/run/docker.sock:/var/run/docker.sock" - "/var/run/docker.sock:/var/run/docker.sock"
- "{{ portainer_config }}:/data" - "{{ portainer_config }}:/data"
command: [ "--admin-password", "'{{ portainer_password_bcrypt.stdout }}'"]
when: inventory_hostname == server_host and server_host and server_host != "none" when: inventory_hostname == server_host and server_host and server_host != "none"
# #