Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit ba81d60

Browse files
authored
Merge pull request #1 from Diesel-Net/development
Promotion
2 parents 62a1907 + 0a3c450 commit ba81d60

10 files changed

Lines changed: 132 additions & 0 deletions

File tree

.ansible/ansible.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[defaults]
2+
3+
stdout_callback = debug
4+
host_key_checking = False
5+
retry_files_enabled = False
6+
7+
# Fixes ansible variable precedence issue: Makes inventory group_vars override playbook group_vars
8+
# https://github.com/ansible/ansible/issues/18154
9+
precedence = all_plugins_play, all_inventory, all_plugins_inventory, groups_plugins_play, groups_inventory, groups_plugins_inventory

.ansible/deploy.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ansible-playbook deploy.yaml -i inventories/prod/hosts --vault-id ~/.tokens/master_id
2+
3+
- hosts: tools
4+
strategy: linear
5+
roles:
6+
- common
7+
8+
tasks:
9+
10+
- include_role:
11+
name: common
12+
tasks_from: make_config_dir
13+
14+
- include_role:
15+
name: common
16+
tasks_from: make_data_dir
17+
18+
- include_role:
19+
name: docker
20+
tasks_from: stack_deploy
21+
22+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
domain: ldap.dev.diesel.net
2+
admin_password: ldap
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
all:
2+
children:
3+
tools:
4+
hosts:
5+
ldap.dev.diesel.net
6+
vars:
7+
ansible_user: automation
8+
ansible_python_interpreter: /usr/bin/python3
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
domain: ldap.diesel.net
2+
admin_password: !vault |
3+
$ANSIBLE_VAULT;1.1;AES256
4+
32333234346638666436326665663963616137363031303339653538653737653033353861336661
5+
3430653763353765316530373635313334636636316464310a393935653236666638663962306432
6+
65646438666261646265363034643033633139666161656635623239663731336366353165356533
7+
3964393537373032380a643838623761633931343037333864633530306463643832383664613737
8+
3230

.ansible/inventory/stable/hosts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
all:
2+
children:
3+
tools:
4+
hosts:
5+
ldap.diesel.net
6+
vars:
7+
ansible_user: automation
8+
ansible_python_interpreter: /usr/bin/python3

.ansible/roles/requirements.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- name: common
2+
scm: git
3+
src: "git@github.com:Diesel-Net/ansible-role-common.git"
4+
version: 1.0.1
5+
6+
- name: docker
7+
scm: git
8+
src: "git@github.com:Diesel-Net/ansible-role-docker.git"
9+
version: 1.2.1
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# docker-compose.yaml
2+
3+
version: '3.8'
4+
services:
5+
6+
7+
main:
8+
image: osixia/phpldapadmin:0.9.0
9+
volumes:
10+
- /etc/localtime:/etc/localtime
11+
- {{ ssl_cert_dir }}:/container/service/phpldapadmin/assets/apache2/certs
12+
environment:
13+
PHPLDAPADMIN_HTTPS: 'false'
14+
PHPLDAPADMIN_LDAP_CLIENT_TLS: 'true'
15+
PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME: {{ ssl_cert_filename }}
16+
PHPLDAPADMIN_LDAP_CLIENT_TLS_REQCERT: try
17+
PHPLDAPADMIN_LDAP_HOSTS: "#PYTHON2BASH:[{'{{ domain }}': [{'server': [{'tls': False}, {'port': 389}]},{'login': [{'bind_id': 'cn=admin,dc=diesel,dc=net'},{'bind_pass': '{{ admin_password }}'}]}]}]"
18+
command: >
19+
--loglevel debug
20+
deploy:
21+
labels:
22+
- traefik.enable=true
23+
- traefik.http.services.{{ git_repository }}.loadbalancer.server.port=80
24+
- traefik.http.routers.{{ git_repository }}.rule=Host(`{{ domain }}`)
25+
- traefik.http.routers.{{ git_repository }}.tls.certresolver=step-ca
26+
networks:
27+
- {{ docker_network }}
28+
29+
networks:
30+
{{ docker_network }}:
31+
external: true

.drone.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
kind: pipeline
3+
type: docker
4+
name: Install phpLDAPadmin
5+
6+
clone:
7+
depth: 1
8+
9+
steps:
10+
- name: deploy
11+
image: plugins/ansible:3
12+
environment:
13+
ANSIBLE_CONFIG: .ansible/ansible.cfg
14+
settings:
15+
playbook: .ansible/deploy.yaml
16+
galaxy: .ansible/roles/requirements.yaml
17+
private_key:
18+
from_secret: ansible_private_key
19+
vault_password:
20+
from_secret: ansible_vault_password
21+
commands:
22+
# dynamically select inventory based on Git branch/tag
23+
- version=$DRONE_BRANCH
24+
- if [ ! -z $DRONE_TAG ]; then version=production; fi
25+
- /bin/drone-ansible --inventory .ansible/inventory/$$version/hosts
26+
27+
trigger:
28+
branch:
29+
- development
30+
- stable
31+
event:
32+
- push
33+
...

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.ansible/roles/docker
2+
.ansible/roles/common

0 commit comments

Comments
 (0)