From 227f8044578eff7a9cb6c45fb99ba2de3931e073 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Thu, 17 Aug 2023 20:39:12 +0200 Subject: [PATCH] Moved all hosts into one inventory and moved playbooks into setup playbook --- ansible/applications.yaml | 20 -------- ansible/devops.yaml | 20 -------- ansible/inventories/devops | 8 ---- .../{springBoot => applications}/public.yaml | 0 .../inventories/host_vars/devops/public.yaml | 2 +- .../inventories/{applications => production} | 9 +++- ansible/setup.yaml | 46 +++++++++++++++++++ ansible/site.yaml | 3 +- 8 files changed, 56 insertions(+), 52 deletions(-) delete mode 100644 ansible/applications.yaml delete mode 100644 ansible/devops.yaml delete mode 100644 ansible/inventories/devops rename ansible/inventories/group_vars/{springBoot => applications}/public.yaml (100%) rename ansible/inventories/{applications => production} (51%) create mode 100644 ansible/setup.yaml diff --git a/ansible/applications.yaml b/ansible/applications.yaml deleted file mode 100644 index 98b5cd1..0000000 --- a/ansible/applications.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Create server - hosts: setup - gather_facts: false - roles: - - server_setup -- name: Set up domain - hosts: frontend - gather_facts: false - remote_user: "{{ ssh_user }}" - roles: - - frontend -- name: Set up Spring Boot applications - hosts: springBoot - gather_facts: false - become: true - become_method: ansible.builtin.sudo - remote_user: "{{ ssh_user }}" - roles: - - spring_boot diff --git a/ansible/devops.yaml b/ansible/devops.yaml deleted file mode 100644 index a7c23b1..0000000 --- a/ansible/devops.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Create server - hosts: setup - gather_facts: false - roles: - - server_setup -- name: Set up drone - hosts: ci - gather_facts: false - become: true - become_method: ansible.builtin.sudo - remote_user: "{{ ssh_user }}" - roles: - - drone -- name: Set up Gitea - hosts: git - gather_facts: false - remote_user: "{{ ssh_user }}" - roles: - - gitea diff --git a/ansible/inventories/devops b/ansible/inventories/devops deleted file mode 100644 index 8e2a578..0000000 --- a/ansible/inventories/devops +++ /dev/null @@ -1,8 +0,0 @@ -[setup] -devops ansible_host=localhost ansible_connection=local ansible_python_interpreter=python3 - -[ci] -devops ansible_host=49.12.69.146 ansible_python_interpreter=python3 - -[git] -gitea ansible_host=giteajim.uber.space ansible_python_interpreter=/usr/bin/python diff --git a/ansible/inventories/group_vars/springBoot/public.yaml b/ansible/inventories/group_vars/applications/public.yaml similarity index 100% rename from ansible/inventories/group_vars/springBoot/public.yaml rename to ansible/inventories/group_vars/applications/public.yaml diff --git a/ansible/inventories/host_vars/devops/public.yaml b/ansible/inventories/host_vars/devops/public.yaml index 4ec927b..cf82098 100644 --- a/ansible/inventories/host_vars/devops/public.yaml +++ b/ansible/inventories/host_vars/devops/public.yaml @@ -1,3 +1,3 @@ --- -server_name: devops +server_name: production server_type: cax21 diff --git a/ansible/inventories/applications b/ansible/inventories/production similarity index 51% rename from ansible/inventories/applications rename to ansible/inventories/production index 1e9a847..84ac856 100644 --- a/ansible/inventories/applications +++ b/ansible/inventories/production @@ -1,8 +1,15 @@ [setup] +devops ansible_host=localhost ansible_connection=local ansible_python_interpreter=python3 applications ansible_host=localhost ansible_connection=local ansible_python_interpreter=python3 +[ci] +devops ansible_host=49.12.69.146 ansible_python_interpreter=python3 + +[git] +gitea ansible_host=giteajim.uber.space ansible_python_interpreter=/usr/bin/python + [frontend] wahlrecht-frontend ansible_host=wahlfron.uber.space ansible_python_interpreter=/usr/bin/python -[springBoot] +[applications] api-server ansible_host=49.13.77.70 ansible_python_interpreter=python3 diff --git a/ansible/setup.yaml b/ansible/setup.yaml new file mode 100644 index 0000000..8ea1be1 --- /dev/null +++ b/ansible/setup.yaml @@ -0,0 +1,46 @@ +--- +- name: Create server + hosts: setup + gather_facts: false + serial: 1 + roles: + - server_setup +- name: Set up frontend domains + hosts: frontend + gather_facts: false + remote_user: "{{ ssh_user }}" + roles: + - frontend +- name: Set up Drone + hosts: ci + gather_facts: false + become: true + become_method: ansible.builtin.sudo + remote_user: "{{ ssh_user }}" + roles: + - drone +- name: Set up Gitea + hosts: git + gather_facts: false + remote_user: "{{ ssh_user }}" + roles: + - gitea +- name: Set up application server + hosts: applications + gather_facts: false + become: true + become_method: ansible.builtin.sudo + remote_user: "{{ ssh_user }}" + roles: + - docker + - nginx + - letsencrypt + - kafka +- name: Set up Spring Boot applications + hosts: applications + gather_facts: false + become: true + become_method: ansible.builtin.sudo + remote_user: "{{ ssh_user }}" + roles: + - spring_boot diff --git a/ansible/site.yaml b/ansible/site.yaml index 86cfb02..0c2734b 100644 --- a/ansible/site.yaml +++ b/ansible/site.yaml @@ -1,3 +1,2 @@ --- -- include: devops.yaml -- include: applications.yaml +- include: setup.yaml