Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker-galaxy template and artifact #215

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions artifacts/docker-galaxy-01.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
- hosts: localhost
connection: local
vars:
docker_compose_folder: "{{ compose_folder | default('') }}"
git_version: "{{ repo_branch | default('master') }}"
roles:
- role: 'grycap.docker'
tasks:
- name: docker_compose_git is mandatory
ansible.builtin.fail:
msg: Please provide a git repository to clone and perform a docker-compose up
when: docker_compose_git is not defined or docker_compose_git == ""

- name: Install git package
ansible.builtin.package:
name: git
state: present
ignore_errors: true

- name: Clone docker-compose git repository
ansible.builtin.git:
repo: '{{ docker_compose_git }}'
dest: /opt/docker_compose
version: "{{ git_version }}"

- name: Make sure .env file exists
ansible.builtin.file:
path: /opt/docker_compose/.env
state: touch
modification_time: preserve
access_time: preserve
owner: root
group: root
mode: '0644'

- name: Configure GALAXY_CONFIG_BRAND
ansible.builtin.lineinfile:
path: /opt/docker_compose/.env
regexp: '^GALAXY_CONFIG_BRAND='
line: GALAXY_CONFIG_BRAND='{{ galaxy_config_brand }}'
when: galaxy_config_brand is defined and galaxy_config_brand != ""

- name: Configure PROXY_PREFIX
ansible.builtin.lineinfile:
path: /opt/docker_compose/.env
regexp: '^PROXY_PREFIX='
line: PROXY_PREFIX='{{ proxy_prefix }}'
when: proxy_prefix is defined and proxy_prefix != ""

- name: Configure NONUSE
ansible.builtin.lineinfile:
path: /opt/docker_compose/.env
regexp: '^NONUSE='
line: NONUSE='{{ nonuse }}'
when: nonuse is defined and nonuse != ""

- name: Configure GALAXY_CONFIG_ENABLE_MULLED_CONTAINERS
ansible.builtin.lineinfile:
path: /opt/docker_compose/.env
regexp: '^GALAXY_CONFIG_ENABLE_MULLED_CONTAINERS='
line: GALAXY_CONFIG_ENABLE_MULLED_CONTAINERS='{{ galaxy_config_enable_mulled_containers }}'
when: galaxy_config_enable_mulled_containers is defined and galaxy_config_enable_mulled_containers != ""

- name: docker-compose up
community.docker.docker_compose_v2:
project_src: "/opt/docker_compose/{{ docker_compose_folder }}"
state: present
env_files:
- "/opt/docker_compose/.env"
2 changes: 1 addition & 1 deletion artifacts/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
version: "{{ git_version }}"

- name: docker-compose up
docker_compose:
community.docker.docker_compose_v2:
project_src: "/opt/docker_compose/{{ docker_compose_folder }}"
state: present
Loading