diff --git a/host_vars/dell.yml b/host_vars/dell.yml index 82f1ea2..d937ac4 100644 --- a/host_vars/dell.yml +++ b/host_vars/dell.yml @@ -2,7 +2,7 @@ vault_file: vault_vars/qnap-vault.yml portainer_required_templates: [] -#portainer_endpoint: 23 +portainer_endpoint: 34 services: [] docker_compose_services: diff --git a/host_vars/snunmu.yml b/host_vars/snunmu.yml index 7d1724f..c0905c9 100644 --- a/host_vars/snunmu.yml +++ b/host_vars/snunmu.yml @@ -7,7 +7,7 @@ portainer_required_templates: dest_directory: /etc/config/diun handler: restart-diun -portainer_endpoint: 23 +portainer_endpoint: 35 services: - name: hasteypaste - name: diun @@ -17,13 +17,6 @@ ansible_pull_path: /usr/local/bin/ansible-pull backup_directories: [] cron_hour: "4" -# docker options -docker_daemon_options: - hosts: - - "tcp://0.0.0.0:2375" - - "unix:///var/run/docker.sock" - - # Note: this must be inline with the host name, # this is a work around as it is not possible to template # the name of the volume in the portainer task. diff --git a/hosts.ini b/hosts.ini index cdb46ea..c9c4664 100644 --- a/hosts.ini +++ b/hosts.ini @@ -18,6 +18,10 @@ dell [portainer] qnap +[portainer_agent] +dell +snunmu + [docker] qnap snunmu diff --git a/playbooks/setup-homelab.yml b/playbooks/setup-homelab.yml index da4712e..2218296 100644 --- a/playbooks/setup-homelab.yml +++ b/playbooks/setup-homelab.yml @@ -42,8 +42,14 @@ roles: - role: setup_portainer tags: [services, portainer] - vars: - portainer_version: "2.18.3" + +- name: Install Portainer agent on Portainer agent hosts. + gather_facts: false + hosts: portainer_agent + become: true + roles: + - role: setup_portainer_agent + tags: [services, portainer_agent] - name: Setup and deploy compose services. hosts: dell diff --git a/roles/setup_portainer/defaults/main.yml b/roles/setup_portainer/defaults/main.yml new file mode 100644 index 0000000..7dd2473 --- /dev/null +++ b/roles/setup_portainer/defaults/main.yml @@ -0,0 +1,2 @@ +--- +portainer_version: 2.18.3 diff --git a/roles/setup_portainer_agent/defaults/main.yml b/roles/setup_portainer_agent/defaults/main.yml new file mode 100644 index 0000000..d8f5470 --- /dev/null +++ b/roles/setup_portainer_agent/defaults/main.yml @@ -0,0 +1,2 @@ +--- +portainer_agent_version: 2.18.3 diff --git a/roles/setup_portainer_agent/tasks/main.yml b/roles/setup_portainer_agent/tasks/main.yml new file mode 100644 index 0000000..b4bc385 --- /dev/null +++ b/roles/setup_portainer_agent/tasks/main.yml @@ -0,0 +1,16 @@ +--- +- name: Portainer Agent + community.docker.docker_compose: + project_name: portainer_agent + definition: + version: '3.3' + services: + agent: + ports: + - '9001:9001' + container_name: portainer_agent + restart: always + volumes: + - '/var/run/docker.sock:/var/run/docker.sock' + - '/var/lib/docker/volumes:/var/lib/docker/volumes' + image: 'portainer/agent:{{ portainer_agent_version }}'