From 7afcd80bd844c5b9015c6f6d6b276b9499268a57 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Tue, 24 Nov 2020 19:42:03 +0100 Subject: [PATCH 1/7] Add dependency for docker management --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 597f5ff..e1cbfd3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Setup ```bash ansible-galaxy install -r requirements.yml +ansible-galaxy collection install community.general ``` Call with From b6eb94e0c448309c92d00d0c68d79747205fe3c7 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Tue, 24 Nov 2020 19:44:01 +0100 Subject: [PATCH 2/7] Rename task docker to docker_install --- main.yml | 2 +- tasks/{docker.yml => docker_install.yml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tasks/{docker.yml => docker_install.yml} (100%) diff --git a/main.yml b/main.yml index f945551..7c2a7d1 100644 --- a/main.yml +++ b/main.yml @@ -40,7 +40,7 @@ include_tasks: tasks/users.yml - name: Setup Docker - include_tasks: tasks/docker.yml + include_tasks: tasks/docker_install.yml - name: Setup httpd include_tasks: tasks/httpd.yml diff --git a/tasks/docker.yml b/tasks/docker_install.yml similarity index 100% rename from tasks/docker.yml rename to tasks/docker_install.yml From 556ec06a90f7e4c2a2f234095630d7bf1517848b Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Tue, 24 Nov 2020 21:21:47 +0100 Subject: [PATCH 3/7] Install python-docker --- tasks/docker_install.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/docker_install.yml b/tasks/docker_install.yml index 980ae20..38c91bf 100644 --- a/tasks/docker_install.yml +++ b/tasks/docker_install.yml @@ -42,6 +42,7 @@ vars: packages: - docker-ce + - python-docker - name: Set docker configuration copy: From b9d772be0e294fb469cbdaa8ab28f278846d5cbd Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Tue, 24 Nov 2020 22:44:38 +0100 Subject: [PATCH 4/7] Add mysql.adm.netz39.de to httpd tasks --- tasks/httpd.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/httpd.yml b/tasks/httpd.yml index 8b3f71d..1f8ac4c 100644 --- a/tasks/httpd.yml +++ b/tasks/httpd.yml @@ -10,6 +10,12 @@ name: rewrite state: present +- name: Setup proxy site mysql.adm.netz39.de + include_role: + name: setup-http-site-proxy + vars: + site_name: mysql.adm.netz39.de + proxy_port: 9001 - name: Setup proxy site testredmine.netz39.de include_role: From 7846c1b100d9160accdb2e8acda11f4cafff260c Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Tue, 24 Nov 2020 22:45:02 +0100 Subject: [PATCH 5/7] Add docker_setup for network and phpmyadmin container --- tasks/docker_setup.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tasks/docker_setup.yml diff --git a/tasks/docker_setup.yml b/tasks/docker_setup.yml new file mode 100644 index 0000000..59fdb63 --- /dev/null +++ b/tasks/docker_setup.yml @@ -0,0 +1,24 @@ +- name: Setup docker network + docker_network: + name: dockernet + driver: bridge + ipam_config: + - subnet: 192.168.0.0/24 + gateway: 192.168.0.1 + state: present + +- name: Setup phpmyadmin + docker_container: + name: phpmyadmin + state: started + image: phpmyadmin:5.0 + networks_cli_compatible: true + networks: + - name: dockernet + restart_policy: always + env: + PMA_HOST: 192.168.0.1 + MYSQL_ROOT_PASSWORD: "{{ mysql_root_pw }}" + PMA_ABSOLUTE_URI: "https://mysql.adm.netz39.de" + published_ports: + - 9001:80 From 4a9529d38c126762b441ef89c9a9cf220bc89fa0 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Tue, 24 Nov 2020 22:46:18 +0100 Subject: [PATCH 6/7] Add setup for phpmyadmin to main.yml --- main.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main.yml b/main.yml index 7c2a7d1..9f7fbe6 100644 --- a/main.yml +++ b/main.yml @@ -11,6 +11,14 @@ docker_compose_version: "1.25.4" docker_compose_path: /usr/local/bin/docker-compose + mysql_root_pw: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 64313138383833643866383332623265383863623332343864306537633931326139303638303761 + 6464653933613663643632383935376164393033363233330a313063613832396166666464666136 + 36633532393231663634663034666666356332373438646130643161383134653739663066626538 + 3661663132343639310a613431653031626434323064313465373866666332353931313836623465 + 3461 + roles: - role: ansible.timezone @@ -39,8 +47,11 @@ - name: Setup users include_tasks: tasks/users.yml - - name: Setup Docker + - name: Install Docker include_tasks: tasks/docker_install.yml + - name: Setup Docker Containers + include_tasks: tasks/docker_setup.yml + - name: Setup httpd include_tasks: tasks/httpd.yml From d692b00963ac8ce27033e054a944b67f972e1195 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Tue, 24 Nov 2020 22:46:30 +0100 Subject: [PATCH 7/7] Set to python3 --- main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.yml b/main.yml index 9f7fbe6..2b25a4e 100644 --- a/main.yml +++ b/main.yml @@ -3,6 +3,8 @@ become: true vars: + ansible_python_interpreter: /usr/bin/python3 + server_admin: "admin@netz39.de" admin_users: [tux, alex]