Added ansible and terraform
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
59
ansible/provision.yml
Normal file
59
ansible/provision.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
- hosts: all
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
- name: ensure repository key is installed
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
state: present
|
||||
|
||||
- name: ensure docker registry is available
|
||||
apt_repository: repo='deb https://download.docker.com/linux/ubuntu bionic stable' state=present
|
||||
|
||||
- name: ensure docker and dependencies are installed
|
||||
apt:
|
||||
pkg:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
- python3-docker
|
||||
- python3-pip
|
||||
update_cache: yes
|
||||
|
||||
- service: name=docker state=started
|
||||
|
||||
- name: Install docker-compose python package
|
||||
ansible.builtin.pip:
|
||||
name: docker-compose
|
||||
|
||||
- name: Log into registry
|
||||
docker_login:
|
||||
registry: registry.flokaiser.com
|
||||
username: "{{ REGISTRY_USERNAME }}"
|
||||
password: "{{ REGISTRY_PASSWORD }}"
|
||||
|
||||
- name: clone repository
|
||||
ansible.builtin.git:
|
||||
repo: https://git.flokaiser.com/DHBW/Cloud_Computing_II.git
|
||||
dest: /home/adminuser/Cloud_Computing_II
|
||||
single_branch: yes
|
||||
version: main
|
||||
|
||||
- name: deploy docker compose stack
|
||||
community.docker.docker_compose:
|
||||
project_src: /home/adminuser/Cloud_Computing_II
|
||||
files:
|
||||
- docker-compose.yml
|
||||
environment:
|
||||
CERTBOT_EMAIL: "{{ CERTBOT_EMAIL }}"
|
||||
DATABASE_URL: "{{ DATABASE_URL }}"
|
||||
AZURE_KEY: "{{ AZURE_KEY }}"
|
||||
AZURE_LOCATION: "{{ AZURE_LOCATION }}"
|
||||
AZURE_ENDPOINT: "https://api.cognitive.microsofttranslator.com"
|
||||
ENV: "dev"
|
||||
|
||||
- name: Log out of DockerHub
|
||||
docker_login:
|
||||
state: absent
|
Reference in New Issue
Block a user