-
Notifications
You must be signed in to change notification settings - Fork 25
/
rancherAgent.yml
33 lines (32 loc) · 984 Bytes
/
rancherAgent.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
- name: RancherAgent
hosts: rancheragent
vars:
url_contents: "{{ lookup('file', 'url') }}"
ip_contents: "{{ lookup('file', 'ip') }}"
labels_contents: "{{ lookup('file', 'labels') }}"
datadir_contents: "{{ lookup('file', 'datadir') }}"
sudo: True
tasks:
- name: update_cache
apt: update_cache=yes cache_valid_time=3600
- name: Install python
apt: name=python state=present
- name: Install python-pip
apt: name=python-pip state=present
- name: Install docker-py
pip: name=docker-py version=1.1.0
- name: RancherOS rancher/agent
docker:
name: rancheragent
image: rancher/agent
privileged: True
state: reloaded
restart_policy: always
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "{{ datadir_contents }}:/var/lib/rancher"
command: "{{ url_contents }}"
env:
CATTLE_AGENT_IP: "{{ ip_contents }}"
CATTLE_HOST_LABELS: "{{ labels_contents }}"