feat: add docker registry logins

This commit is contained in:
Adrien Waksberg 2021-11-23 16:43:51 +01:00
parent e1e0c79428
commit 66fe8fbf93
3 changed files with 23 additions and 0 deletions

View file

@ -51,6 +51,16 @@ wordpress:
state: present
```
* `swarm_registry_logins` - hash with the registry logins
```
gitlab:
registry_url: registry.gitlab.com
registry_username: myaccount
registry_password: secret
user: www-data
```
## How to use
* Install:

View file

@ -4,3 +4,4 @@ swarm_init: false
swarm_advertise_addr: 127.0.0.1
swarm_services: {}
swarm_networks: {}
swarm_registry_logins: {}

View file

@ -1,4 +1,16 @@
---
- name: copy registry login
community.general.docker_login:
registry_url: '{{ item.value.registry_url }}'
username: '{{ item.value.registry_username }}'
password: '{{ item.value.registry_password }}'
become: true
become_user: '{{ item.value.user|default(ansible_user_id) }}'
loop: '{{ swarm_registry_logins|dict2items }}'
loop_control:
label: '{{ item.key }}'
tags: swarm
- name: manage networks
community.docker.docker_network:
name: '{{ item.key }}'