Просмотр исходного кода

Add matrix_docker_installation_enabled

pull/312/head
Dan Arnfield 6 лет назад
Родитель
Сommit
80cfb2a93e
4 измененных файлов: 16 добавлений и 0 удалений
  1. +4
    -0
      roles/matrix-base/defaults/main.yml
  2. +6
    -0
      roles/matrix-base/tasks/server_base/setup.yml
  3. +3
    -0
      roles/matrix-base/tasks/server_base/setup_centos.yml
  4. +3
    -0
      roles/matrix-base/tasks/server_base/setup_debian.yml

+ 4
- 0
roles/matrix-base/defaults/main.yml Просмотреть файл

@@ -42,6 +42,10 @@ matrix_docker_network: "matrix"
# matrix domain (`matrix_server_fqn_matrix`). # matrix domain (`matrix_server_fqn_matrix`).
matrix_well_known_matrix_server_enabled: true matrix_well_known_matrix_server_enabled: true


# Controls whether docker is automatically installed.
# If you change this to false you must install and update docker manually.
matrix_docker_installation_enabled: true

# Variables to Control which parts of our roles run. # Variables to Control which parts of our roles run.
run_postgres_import: true run_postgres_import: true
run_postgres_upgrade: true run_postgres_upgrade: true


+ 6
- 0
roles/matrix-base/tasks/server_base/setup.yml Просмотреть файл

@@ -1,5 +1,11 @@
--- ---


- name: Gather package facts
package_facts:

- set_fact:
run_docker_installation: "{{ matrix_docker_installation_enabled|bool and 'docker.io' not in ansible_facts.packages }}"

- include_tasks: "{{ role_path }}/tasks/server_base/setup_centos.yml" - include_tasks: "{{ role_path }}/tasks/server_base/setup_centos.yml"
when: ansible_distribution == 'CentOS' when: ansible_distribution == 'CentOS'




+ 3
- 0
roles/matrix-base/tasks/server_base/setup_centos.yml Просмотреть файл

@@ -9,11 +9,13 @@
mode: 0644 mode: 0644
with_items: with_items:
- docker-ce.repo - docker-ce.repo
when: run_docker_installation|bool


- name: Ensure Docker's RPM key is trusted - name: Ensure Docker's RPM key is trusted
rpm_key: rpm_key:
state: present state: present
key: https://download.docker.com/linux/centos/gpg key: https://download.docker.com/linux/centos/gpg
when: run_docker_installation|bool


- name: Ensure yum packages are installed - name: Ensure yum packages are installed
yum: yum:
@@ -31,3 +33,4 @@
- docker-ce - docker-ce
state: latest state: latest
update_cache: yes update_cache: yes
when: run_docker_installation|bool

+ 3
- 0
roles/matrix-base/tasks/server_base/setup_debian.yml Просмотреть файл

@@ -15,12 +15,14 @@
state: present state: present
register: add_repository_key register: add_repository_key
ignore_errors: true ignore_errors: true
when: run_docker_installation|bool


- name: Ensure Docker repository is enabled - name: Ensure Docker repository is enabled
apt_repository: apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable" repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
state: present state: present
update_cache: yes update_cache: yes
when: run_docker_installation|bool


- name: Ensure APT packages are installed - name: Ensure APT packages are installed
apt: apt:
@@ -38,3 +40,4 @@
- docker-ce - docker-ce
state: latest state: latest
update_cache: yes update_cache: yes
when: run_docker_installation|bool

Загрузка…
Отмена
Сохранить