diff --git a/ansible.cfg b/ansible.cfg index f237d47..e0ac21f 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,3 +1,6 @@ [defaults] inventory = ./environments/development interpreter_python = /usr/bin/python3 + +[connection] +pipelining = true diff --git a/roles/base/tasks/ansible.yml b/roles/base/tasks/ansible.yml index 16ae819..7927201 100644 --- a/roles/base/tasks/ansible.yml +++ b/roles/base/tasks/ansible.yml @@ -13,3 +13,9 @@ loop: - aptitude - python3-docker + +- name: Create Ansible's temporary remote directory + file: + path: "~/.ansible/tmp" + state: directory + mode: 0700 diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 370f7a9..2411f93 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -1,3 +1,4 @@ docker_root: /var/lib/docker-compose docker_compose: /usr/bin/docker-compose docker_compose_service: compose +docker_network: "172.17.0.1/16" diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 7175650..ce7be52 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -4,6 +4,18 @@ state: present update_cache: true +- name: Install Docker daemon configuration + template: + src: daemon.json.j2 + dest: /etc/docker/daemon.json + register: dockerd_config + +- name: Restart Docker + service: + name: docker + state: restarted + when: dockerd_config.changed + - name: Create docker-compose root file: path: "{{ docker_root }}" diff --git a/roles/docker/templates/daemon.json.j2 b/roles/docker/templates/daemon.json.j2 new file mode 100644 index 0000000..ccba523 --- /dev/null +++ b/roles/docker/templates/daemon.json.j2 @@ -0,0 +1,3 @@ +{ + "bip": "{{ docker_network }}" +} diff --git a/roles/gitea/tasks/main.yml b/roles/gitea/tasks/main.yml index fbb807e..b50dca0 100644 --- a/roles/gitea/tasks/main.yml +++ b/roles/gitea/tasks/main.yml @@ -6,12 +6,16 @@ - name: Create gitea database postgresql_db: name: "{{ gitea_dbname }}" + become: true + become_user: postgres - name: Create gitea database user postgresql_user: db: "{{ gitea_dbname }}" name: "{{ gitea_dbuser }}" password: "{{ gitea_dbpass }}" + become: true + become_user: postgres - name: Install Gitea's docker-compose file template: diff --git a/roles/gitea/templates/docker-compose.yml.j2 b/roles/gitea/templates/docker-compose.yml.j2 index 0fb1f29..db28af4 100644 --- a/roles/gitea/templates/docker-compose.yml.j2 +++ b/roles/gitea/templates/docker-compose.yml.j2 @@ -27,4 +27,4 @@ services: - /etc/localtime:/etc/localtime:ro volumes: - gitea: + {{ gitea_volume }}: