generated from ansible/ansible_template
adjust the docker setup
This commit is contained in:
parent
e4c185b067
commit
8029666330
|
@ -1,12 +1,12 @@
|
||||||
---
|
---
|
||||||
- hosts: docker
|
- hosts: docker
|
||||||
become: true
|
become: true
|
||||||
roles:
|
# roles:
|
||||||
- role: common
|
# - role: common
|
||||||
vars:
|
# vars:
|
||||||
common_deploy_public_key: "/home/andreas/git_repos/projects/tintenwelt/keys/ansible.pub"
|
# common_deploy_public_key: "/home/andreas/git_repos/projects/tintenwelt/keys/ansible.pub"
|
||||||
- common-server
|
# - common-server
|
||||||
- restic
|
# - restic
|
||||||
tasks:
|
tasks:
|
||||||
- import_tasks: tasks/main.yml
|
- import_tasks: tasks/main.yml
|
||||||
vars_files:
|
vars_files:
|
||||||
|
|
|
@ -5,15 +5,33 @@
|
||||||
when:
|
when:
|
||||||
- ansible_facts['distribution'] == "Ubuntu"
|
- ansible_facts['distribution'] == "Ubuntu"
|
||||||
|
|
||||||
- name: "Add apt key for Docker"
|
- name: "Add apt key for Ubuntu Docker"
|
||||||
apt_key:
|
apt_key:
|
||||||
url: "https://download.docker.com/linux/ubuntu/gpg"
|
url: "https://download.docker.com/linux/ubuntu/gpg"
|
||||||
state: present
|
state: present
|
||||||
|
when:
|
||||||
|
- ansible_facts['distribution'] == "Ubuntu"
|
||||||
|
|
||||||
- name: "Add Docker repository"
|
- name: "Add Docker Ubuntu repository"
|
||||||
apt_repository:
|
apt_repository:
|
||||||
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
|
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
|
||||||
state: present
|
state: present
|
||||||
|
when:
|
||||||
|
- ansible_facts['distribution'] == "Ubuntu"
|
||||||
|
|
||||||
|
- name: "Add apt key for Debian Docker"
|
||||||
|
apt_key:
|
||||||
|
url: "https://download.docker.com/linux/debian/gpg"
|
||||||
|
state: present
|
||||||
|
when:
|
||||||
|
- ansible_facts['distribution'] == "Debian"
|
||||||
|
|
||||||
|
- name: "Add Docker Debian repository"
|
||||||
|
apt_repository:
|
||||||
|
repo: "deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
|
||||||
|
state: present
|
||||||
|
when:
|
||||||
|
- ansible_facts['distribution'] == "Debian"
|
||||||
|
|
||||||
- name: "Install Docker"
|
- name: "Install Docker"
|
||||||
apt:
|
apt:
|
||||||
|
@ -42,24 +60,26 @@
|
||||||
- name: "Get the Systems repository"
|
- name: "Get the Systems repository"
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "https://git.2li.ch/Nebucatnetzer/docker_systems.git"
|
repo: "https://git.2li.ch/Nebucatnetzer/docker_systems.git"
|
||||||
dest: "{{ lookup('env', 'HOME') }}/docker_systems"
|
dest: "/home/{{ ansible_ssh_user }}/docker_systems"
|
||||||
become: no
|
become: no
|
||||||
when: docker_skip_project is undefined
|
when: docker_skip_project is undefined
|
||||||
|
|
||||||
- name: "Get the .env template"
|
- name: "Get the .env template"
|
||||||
ansible.builtin.fetch:
|
ansible.builtin.fetch:
|
||||||
src: "{{ docker_project_path }}/.env.example"
|
src: "{{ docker_project_path }}/.env.j2"
|
||||||
dest: "/tmp/fetched/{{ inventory_hostname }}.env.example"
|
dest: "/tmp/fetched/{{ inventory_hostname }}.env.j2"
|
||||||
flat: yes
|
flat: yes
|
||||||
|
fail_on_missing: no
|
||||||
|
register: env_file
|
||||||
become: no
|
become: no
|
||||||
when: docker_skip_project is undefined
|
when: docker_skip_project is undefined
|
||||||
|
|
||||||
- name: "Copy the .env file"
|
- name: "Copy the .env file"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "/tmp/fetched/{{ inventory_hostname }}.env.example"
|
src: "/tmp/fetched/{{ inventory_hostname }}.env.j2"
|
||||||
dest: "{{ docker_project_path }}/.env"
|
dest: "{{ docker_project_path }}/.env"
|
||||||
become: no
|
become: no
|
||||||
when: docker_skip_project is undefined
|
when: docker_skip_project is undefined and env_file.changed
|
||||||
|
|
||||||
- name: "Open the required UDP ports"
|
- name: "Open the required UDP ports"
|
||||||
ansible.builtin.ufw:
|
ansible.builtin.ufw:
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
docker_lazydocker_version: 0.12
|
docker_lazydocker_version: 0.12
|
||||||
docker_project_path: "{{ lookup('env', 'HOME') }}/docker_systems/{{ docker_project_name }}"
|
docker_project_path: "/home/{{ ansible_ssh_user }}/docker_systems/{{ docker_project_name }}"
|
||||||
|
|
Reference in New Issue